org.sourcejammer.project.model
Interface NodeLibrary

All Known Implementing Classes:
NodeLibraryFS

public interface NodeLibrary

Title: $FileName: NodeLibrary.java$

Version:
$VerNum: 9$ $KeyWordsOff: $

Interface for a factory class that retrieves or constructs nodes based on unique ID. A Project/File node cache could be added to the classes implementing this interface
Author:
$AuthorName: Rob MacGrogan$

Method Summary
 FileNode getFileNode(long nodeID)
          Retrieve or construct a FileNode based on it's node id.
 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)
          Low impact way of getting a node's name without adding the node or any of it's children to the cache.
 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)
           
 long lockNode(ControllerNode nd)
          Locks the node and returns the key.
 long lockNode(MasterFileNode nd)
           
 void permanentlyDeleteFile(long fileID)
          Permanently remove all vestiges of specified file from model.
 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 model.
 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)
           
 

Method Detail

getProjectNode

public ProjectNode getProjectNode(long nodeID)
                           throws FileAccessException,
                                  ProjectDoesNotExistException,
                                  SecurityException
Retrieve or construct a ProjectNode based on it's node id.

FileAccessException
ProjectDoesNotExistException
SecurityException

getMasterFileNode

public MasterFileNode getMasterFileNode(long nodeID)
                                 throws FileAccessException,
                                        FileDoesNotExistException,
                                        SecurityException
FileAccessException
FileDoesNotExistException
SecurityException

getFileNode

public FileNode getFileNode(long nodeID)
                     throws FileAccessException,
                            FileDoesNotExistException,
                            SecurityException
Retrieve or construct a FileNode based on it's node id.

FileAccessException
FileDoesNotExistException
SecurityException

releaseNode

public void releaseNode(ControllerNode nd)
                 throws FileAccessException
Releases the node after use.

FileAccessException

storeVersionFull

public void storeVersionFull(FileNode ndFile,
                             long fileKey,
                             org.sourcejammer.project.view.NodeInfo versionNode,
                             java.io.File file)
                      throws FileAccessException
Subclasses should implement to store version file in the model implementation. FileNode must be locked and passed key must "fit" the FileNode, or ControllerNodeLockException is thrown.

FileAccessException

storeVersionDelta

public void storeVersionDelta(FileNode ndFile,
                              long fileKey,
                              org.sourcejammer.project.view.NodeInfo versionNode,
                              java.io.File file)
                       throws FileAccessException
Subclasses should implement to store file delta in the model implementation. FileNode must be locked and passed key must "fit" the FileNode, or ControllerNodeLockException is thrown.

FileAccessException

storeVersionTextDiff

public void storeVersionTextDiff(FileNode ndFile,
                                 long fileKey,
                                 org.sourcejammer.project.view.NodeInfo versionNode,
                                 TextDiff file)
                          throws FileAccessException
FileAccessException

getNewProjectFromModel

public ProjectNode getNewProjectFromModel()
                                   throws FileAccessException
Subclasses should implement this to return a new ProjectNode object. Unique ID for new project will be already be set in returned Node.

FileAccessException

getNewFileNodeFromModel

public FileNode getNewFileNodeFromModel()
                                 throws FileAccessException
Subclasses should implement this to return a new FileNode object. Unique Id for file will already be set in returned Node.

FileAccessException

getNextVersionNodeID

public long getNextVersionNodeID()
                          throws FileAccessException
Returns next unique ID for a version.

FileAccessException

storeVersionComment

public void storeVersionComment(FileNode ndFile,
                                long fileKey,
                                long versionID,
                                java.lang.String comment)
                         throws FileAccessException,
                                SecurityException
FileAccessException
SecurityException

retrieveVersionComment

public java.lang.String retrieveVersionComment(long versionID)
                                        throws FileAccessException
FileAccessException

retrieveVersionFull

public byte[] retrieveVersionFull(org.sourcejammer.project.view.NodeInfo versionNode)
                           throws FileAccessException,
                                  WrongFileTypeException
FileAccessException
WrongFileTypeException

getSourceFilePointer

public java.io.File getSourceFilePointer(org.sourcejammer.project.view.NodeInfo versionNode)

getVersionCommentPointer

public java.io.File getVersionCommentPointer(org.sourcejammer.project.view.NodeInfo versionNode)

retrieveVersionTextLineReader

public TextLineReader retrieveVersionTextLineReader(org.sourcejammer.project.view.NodeInfo versionNode)
                                             throws FileAccessException,
                                                    WrongFileTypeException,
                                                    org.sourcejammer.util.SourceJammerVersionException
When implemented, this method returns the full source of the specified VersionNode as a TextLineReader. This method should only be called for files stored as Text. Implementing classes should throw WrongFileType if the underlying file is not text.

FileAccessException
WrongFileTypeException
org.sourcejammer.util.SourceJammerVersionException

retrieveVersionDelta

public Delta retrieveVersionDelta(org.sourcejammer.project.view.NodeInfo versionNode)
                           throws FileAccessException,
                                  WrongFileTypeException
FileAccessException
WrongFileTypeException

retrieveVersionTextDelta

public Delta retrieveVersionTextDelta(org.sourcejammer.project.view.NodeInfo versionNode)
                               throws FileAccessException,
                                      WrongFileTypeException
FileAccessException
WrongFileTypeException

retrieveVersionDeltaFile

public java.io.File retrieveVersionDeltaFile(org.sourcejammer.project.view.NodeInfo versionNode)
                                      throws FileAccessException,
                                             WrongFileTypeException
FileAccessException
WrongFileTypeException

lockNode

public long lockNode(MasterFileNode nd)
              throws SecurityException
SecurityException

lockNode

public long lockNode(ControllerNode nd)
              throws SecurityException
Locks the node and returns the key. Times out after default number of milliseconds.

SecurityException

permanentlyDeleteProject

public void permanentlyDeleteProject(long projectID)
                              throws SecurityException,
                                     ProjectDoesNotExistException,
                                     FileAccessException
Only deleted the project file. It is up to the calling routine to delete any file object, as needed.

SecurityException
ProjectDoesNotExistException
FileAccessException

permanentlyDeleteFile

public void permanentlyDeleteFile(long fileID)
                           throws SecurityException,
                                  FileDoesNotExistException,
                                  FileAccessException
Permanently remove all vestiges of specified file from model. This method does the following:

  • Removes file from all parents
  • Removes file from removed listing in all parents from which it has already been removed
  • Deletes all source and comments
  • Deletes file itself
  • Removes File object from cache.
  • SecurityException
    FileDoesNotExistException
    FileAccessException

    getProjectChildName

    public java.lang.String getProjectChildName(ProjectChild child)
                                         throws FileAccessException,
                                                org.sourcejammer.project.NodeDoesNotExistException
    Low impact way of getting a node's name without adding the node or any of it's children to the cache.

    FileAccessException
    org.sourcejammer.project.NodeDoesNotExistException

    removeVersion

    public void removeVersion(FileNode ndFile,
                              long fileKey,
                              long versionID)
                       throws FileAccessException,
                              NoSuchVersionException
    Remove all files assocaited with version from model.

    FileAccessException
    NoSuchVersionException

    getNewMasterFileFromModel

    public MasterFileNode getNewMasterFileFromModel()
                                             throws FileAccessException
    Returns a new MasterFile object with unique id already set.

    FileAccessException


    Copyright 2003 Soucejammer project.