|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sourcejammer.project.model.filesys.NodeLibraryFS
Title: $FileName: NodeLibraryFS.java$
Nested Class Summary | |
static class |
NodeLibraryFS.NodeType
|
private static class |
NodeLibraryFS.XMLNodes
|
Field Summary | |
private FSNodeCache |
fileCache
|
private java.util.Random |
keyGenerator
|
private static java.lang.String |
LOCK_DIRECTORY
|
private static long |
LOCK_NUM_TRIES
|
private static long |
LOCK_RETRY_WAIT
|
private FSNodeCache |
masterFileCache
|
private ArchiveInfoFlexFS |
moArchiveInfo
|
private FSNodeCache |
projectCache
|
Constructor Summary | |
NodeLibraryFS(ArchiveInfoFlexFS info)
|
Method Summary | |
private void |
clearLocks()
Clears all locks from lock directory. |
private org.w3c.dom.Document |
generateLockFile(long nodeID,
java.lang.String nodeType,
long lKey)
Generates and returns a lock XML file. |
FileNode |
getFileNode(long nodeID)
Retrieves and locks a File node on the file system. |
private java.io.File |
getLockFile(long nodeID,
java.lang.String nodeType)
|
private java.lang.String |
getLockFileName(long nodeID,
java.lang.String nodeType)
Builds the file name to use for the lock file for the specified node. |
MasterFileNode |
getMasterFileNode(long nodeID)
|
FileNode |
getNewFileNodeFromModel()
Subclasses should implement this to return a new FileNode object. |
MasterFileNode |
getNewMasterFileFromModel()
Returns a new MasterFile object with unique id already set. |
ProjectNode |
getNewProjectFromModel()
Subclasses should implement this to return a new ProjectNode object. |
long |
getNextVersionNodeID()
Returns next unique ID for a version. |
java.lang.String |
getProjectChildName(ProjectChild child)
Return the name of a project child object. |
ProjectNode |
getProjectNode(long nodeID)
Retrieve or construct a ProjectNode based on it's node id. |
java.io.File |
getSourceFilePointer(org.sourcejammer.project.view.NodeInfo versionNode)
|
java.io.File |
getVersionCommentPointer(org.sourcejammer.project.view.NodeInfo versionNode)
|
private boolean |
isNodeLocked(long nodeID,
java.lang.String nodeType)
Returns true if node is already locked. |
long |
lockNode(ControllerNode nd)
Locks the node and returns the key. |
private long |
lockNode(ControllerNode nd,
long lTimeOutValue)
Locks the node and returns the key used to lock it. |
private long |
lockNode(long nodeID,
java.lang.String nodeType)
Locks the node with the specified ID, if that node is not already locked. |
long |
lockNode(MasterFileNode nd)
Locks the node and returns the key. |
private long |
lockNode(MasterFileNode nd,
long lTimeOutValue)
Locks the node and returns the key used to lock it. |
private long |
obtainLock(long nodeID,
java.lang.String nodeType)
|
void |
permanentlyDeleteFile(long fileID)
Permanently remove all vestiges of specified file from filesystem. |
void |
permanentlyDeleteProject(long projectID)
Only deleted the project file. |
void |
releaseNode(ControllerNode nd)
Releases the node after use. |
void |
removeVersion(FileNode ndFile,
long fileKey,
long versionID)
Remove all files assocaited with version from file system. |
private long |
retrieveKey(java.io.File fl)
Retrieves key for the specified node. |
java.lang.String |
retrieveVersionComment(long versionID)
|
Delta |
retrieveVersionDelta(org.sourcejammer.project.view.NodeInfo versionNode)
|
java.io.File |
retrieveVersionDeltaFile(org.sourcejammer.project.view.NodeInfo versionNode)
|
byte[] |
retrieveVersionFull(org.sourcejammer.project.view.NodeInfo versionNode)
|
Delta |
retrieveVersionTextDelta(org.sourcejammer.project.view.NodeInfo versionNode)
|
TextLineReader |
retrieveVersionTextLineReader(org.sourcejammer.project.view.NodeInfo versionNode)
When implemented, this method returns the full source of the specified VersionNode as a TextLineReader. |
void |
storeVersionComment(FileNode ndFile,
long fileKey,
long versionID,
java.lang.String comment)
|
void |
storeVersionDelta(FileNode ndFile,
long fileKey,
org.sourcejammer.project.view.NodeInfo versionNode,
java.io.File file)
Subclasses should implement to store file delta in the model implementation. |
void |
storeVersionFull(FileNode ndFile,
long fileKey,
org.sourcejammer.project.view.NodeInfo versionNode,
java.io.File file)
Subclasses should implement to store version file in the model implementation. |
void |
storeVersionTextDiff(FileNode ndFile,
long fileKey,
org.sourcejammer.project.view.NodeInfo versionNode,
TextDiff file)
|
protected void |
unlockNode(ControllerNode nd)
|
protected void |
unlockNode(long nodeID,
java.lang.String nodeType,
long key)
Unlocks the node with the specified ID and type, using the key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String LOCK_DIRECTORY
private static final long LOCK_RETRY_WAIT
private static final long LOCK_NUM_TRIES
private ArchiveInfoFlexFS moArchiveInfo
private java.util.Random keyGenerator
private FSNodeCache fileCache
private FSNodeCache projectCache
private FSNodeCache masterFileCache
Constructor Detail |
public NodeLibraryFS(ArchiveInfoFlexFS info)
Method Detail |
private long obtainLock(long nodeID, java.lang.String nodeType) throws ObjectLockingException
ObjectLockingException
private long lockNode(long nodeID, java.lang.String nodeType) throws ObjectLockingException
nodeID
- -- unique ID of the node.
ObjectLockingException
- if the node is already locked.private void clearLocks()
protected void unlockNode(long nodeID, java.lang.String nodeType, long key) throws ObjectLockingException
nodeID
- -- unique id of the node.
ObjectLockingException
- if the node is not locked, or if the key
is inaccurate.public ProjectNode getProjectNode(long nodeID) throws FileAccessException, ProjectDoesNotExistException, SecurityException
NodeLibrary
getProjectNode
in interface NodeLibrary
FileAccessException
ProjectDoesNotExistException
SecurityException
public java.lang.String getProjectChildName(ProjectChild child) throws FileAccessException, org.sourcejammer.project.NodeDoesNotExistException
getProjectChildName
in interface NodeLibrary
FileAccessException
org.sourcejammer.project.NodeDoesNotExistException
public MasterFileNode getMasterFileNode(long nodeID) throws FileAccessException, FileDoesNotExistException, SecurityException
getMasterFileNode
in interface NodeLibrary
FileAccessException
FileDoesNotExistException
SecurityException
public FileNode getFileNode(long nodeID) throws FileAccessException, FileDoesNotExistException, SecurityException
getFileNode
in interface NodeLibrary
FileAccessException
FileDoesNotExistException
SecurityException
public void releaseNode(ControllerNode nd) throws FileAccessException
NodeLibrary
releaseNode
in interface NodeLibrary
FileAccessException
protected void unlockNode(ControllerNode nd) throws FileAccessException
FileAccessException
private java.lang.String getLockFileName(long nodeID, java.lang.String nodeType)
private boolean isNodeLocked(long nodeID, java.lang.String nodeType)
private org.w3c.dom.Document generateLockFile(long nodeID, java.lang.String nodeType, long lKey)
private long retrieveKey(java.io.File fl) throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
private java.io.File getLockFile(long nodeID, java.lang.String nodeType)
public void permanentlyDeleteProject(long projectID) throws SecurityException, ProjectDoesNotExistException, FileAccessException
permanentlyDeleteProject
in interface NodeLibrary
SecurityException
ProjectDoesNotExistException
FileAccessException
public void permanentlyDeleteFile(long fileID) throws SecurityException, FileDoesNotExistException, FileAccessException
permanentlyDeleteFile
in interface NodeLibrary
SecurityException
FileDoesNotExistException
FileAccessException
public void storeVersionFull(FileNode ndFile, long fileKey, org.sourcejammer.project.view.NodeInfo versionNode, java.io.File file) throws FileAccessException
storeVersionFull
in interface NodeLibrary
FileAccessException
public void storeVersionDelta(FileNode ndFile, long fileKey, org.sourcejammer.project.view.NodeInfo versionNode, java.io.File file) throws FileAccessException
storeVersionDelta
in interface NodeLibrary
FileAccessException
public void storeVersionTextDiff(FileNode ndFile, long fileKey, org.sourcejammer.project.view.NodeInfo versionNode, TextDiff file) throws FileAccessException
storeVersionTextDiff
in interface NodeLibrary
FileAccessException
public MasterFileNode getNewMasterFileFromModel() throws FileAccessException
getNewMasterFileFromModel
in interface NodeLibrary
FileAccessException
public ProjectNode getNewProjectFromModel() throws FileAccessException
getNewProjectFromModel
in interface NodeLibrary
FileAccessException
public FileNode getNewFileNodeFromModel() throws FileAccessException
getNewFileNodeFromModel
in interface NodeLibrary
FileAccessException
public long getNextVersionNodeID() throws FileAccessException
getNextVersionNodeID
in interface NodeLibrary
FileAccessException
public void storeVersionComment(FileNode ndFile, long fileKey, long versionID, java.lang.String comment) throws FileAccessException
storeVersionComment
in interface NodeLibrary
FileAccessException
public java.lang.String retrieveVersionComment(long versionID) throws FileAccessException
retrieveVersionComment
in interface NodeLibrary
FileAccessException
public java.io.File getSourceFilePointer(org.sourcejammer.project.view.NodeInfo versionNode)
getSourceFilePointer
in interface NodeLibrary
public java.io.File getVersionCommentPointer(org.sourcejammer.project.view.NodeInfo versionNode)
getVersionCommentPointer
in interface NodeLibrary
public byte[] retrieveVersionFull(org.sourcejammer.project.view.NodeInfo versionNode) throws FileAccessException, WrongFileTypeException
retrieveVersionFull
in interface NodeLibrary
FileAccessException
WrongFileTypeException
public TextLineReader retrieveVersionTextLineReader(org.sourcejammer.project.view.NodeInfo versionNode) throws FileAccessException, WrongFileTypeException, org.sourcejammer.util.SourceJammerVersionException
retrieveVersionTextLineReader
in interface NodeLibrary
FileAccessException
WrongFileTypeException
org.sourcejammer.util.SourceJammerVersionException
public java.io.File retrieveVersionDeltaFile(org.sourcejammer.project.view.NodeInfo versionNode) throws FileAccessException, WrongFileTypeException
retrieveVersionDeltaFile
in interface NodeLibrary
FileAccessException
WrongFileTypeException
public Delta retrieveVersionDelta(org.sourcejammer.project.view.NodeInfo versionNode) throws FileAccessException, WrongFileTypeException
retrieveVersionDelta
in interface NodeLibrary
FileAccessException
WrongFileTypeException
public Delta retrieveVersionTextDelta(org.sourcejammer.project.view.NodeInfo versionNode) throws FileAccessException, WrongFileTypeException
retrieveVersionTextDelta
in interface NodeLibrary
FileAccessException
WrongFileTypeException
public long lockNode(MasterFileNode nd) throws SecurityException
lockNode
in interface NodeLibrary
SecurityException
private long lockNode(MasterFileNode nd, long lTimeOutValue) throws SecurityException
SecurityException
public long lockNode(ControllerNode nd) throws SecurityException
lockNode
in interface NodeLibrary
SecurityException
private long lockNode(ControllerNode nd, long lTimeOutValue) throws SecurityException
SecurityException
public void removeVersion(FileNode ndFile, long fileKey, long versionID) throws FileAccessException, NoSuchVersionException
removeVersion
in interface NodeLibrary
FileAccessException
NoSuchVersionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |