sharpster.daemon.filemanagement
Class FileManager

java.lang.Object
  |
  +--sharpster.daemon.filemanagement.FileManager

public class FileManager
extends java.lang.Object

Class responsible for the overall management of files, both local files and files stored in the local CVS. Most of its work is delegated to the classes of the CVSManager, the LocalFileManager or the FileKeyManager.


Constructor Summary
FileManager()
          Constructs an instance of the FileManager object.
 
Method Summary
 sharpster.common.ResponseCollection checkFilesExistance(sharpster.common.FileCollection files)
          Verifies that the given files exist.
 void clearTemporaryFiles()
           
 net.jxta.id.ID getFileID(java.lang.String filePath)
          Returns a unique key value for a given filename and CVS path.
 java.lang.String getFilePath(net.jxta.id.ID id)
          Returns a filename, including the CVS path of the file, for a given key.
 sharpster.common.FileCollection getRemovedFiles(java.lang.String command)
          If the command specifies a file remove, it returns the files which have been removed, otherwise null is returned.
 void initialize(sharpster.daemon.daemonplugin.DaemonPluginManager pm)
          Perform eventual initializations.
 boolean loadFromFile(java.lang.String file)
          Load the file database from a configuration file.
 sharpster.common.ResponseCollection localDoCVS(java.lang.String command, java.lang.String workingDirectory)
          Executes a CVS command requested by the user of the local client.
 sharpster.common.ResponseCollection localLoadFiles(sharpster.common.FileCollection files, java.lang.String workingDirectory)
           
 sharpster.common.ResponseCollection localSaveFiles(sharpster.common.FileCollection files, java.lang.String workingDirectory)
          Saves the specified files in the given working directory.
 sharpster.common.ResponseCollection remoteAddFiles(sharpster.common.FileCollection files)
          Adds the specified files to the CVS.
 sharpster.common.ResponseCollection remoteCheckoutFiles(sharpster.common.FileCollection files, java.lang.String role)
          Update the files argument by adding the specified files and information about their versions.
 sharpster.common.ResponseCollection remoteCommitFiles(sharpster.common.FileCollection files, java.lang.String role)
          Commits the specified files to the CVS.
 sharpster.common.ResponseCollection remoteRemoveFiles(sharpster.common.FileCollection files)
          Removes the specified files to the CVS.
 sharpster.common.ResponseCollection remoteUpdateFiles(sharpster.common.FileCollection files)
          Updates the given files with possible changes from the CVS.
 boolean saveToFile(java.lang.String file)
          Save the file database to a configuration file.
 sharpster.common.ResponseCollection synchronizeCVS(java.lang.String workingDirectory)
          Synchronizes the file database with the specified directory.
 sharpster.common.ResponseCollection translateLocalPaths(sharpster.common.FileCollection files, java.lang.String workingDirectory, boolean cvs)
          Updates the files object.
 sharpster.common.ResponseCollection translateRemotePaths(sharpster.common.FileCollection files, boolean recursive)
          Updates the files object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileManager

public FileManager()
Constructs an instance of the FileManager object. Creates the FileKeyManager, a CVSManager, and a LocalFileManager, and initializes the member attributes.

Method Detail

initialize

public void initialize(sharpster.daemon.daemonplugin.DaemonPluginManager pm)
Perform eventual initializations.


getFileID

public net.jxta.id.ID getFileID(java.lang.String filePath)
Returns a unique key value for a given filename and CVS path. Uses the fkm.


getFilePath

public java.lang.String getFilePath(net.jxta.id.ID id)
Returns a filename, including the CVS path of the file, for a given key. Uses the fkm.


getRemovedFiles

public sharpster.common.FileCollection getRemovedFiles(java.lang.String command)
If the command specifies a file remove, it returns the files which have been removed, otherwise null is returned.


localDoCVS

public sharpster.common.ResponseCollection localDoCVS(java.lang.String command,
                                                      java.lang.String workingDirectory)
Executes a CVS command requested by the user of the local client. The command attribute contains the CVS command and arguments associated with it. Uses the cvsm.


localSaveFiles

public sharpster.common.ResponseCollection localSaveFiles(sharpster.common.FileCollection files,
                                                          java.lang.String workingDirectory)
Saves the specified files in the given working directory. Returns information about the result of the operation. Uses the cvsm.


localLoadFiles

public sharpster.common.ResponseCollection localLoadFiles(sharpster.common.FileCollection files,
                                                          java.lang.String workingDirectory)

translateLocalPaths

public sharpster.common.ResponseCollection translateLocalPaths(sharpster.common.FileCollection files,
                                                               java.lang.String workingDirectory,
                                                               boolean cvs)
Updates the files object. For each file which is specified, it insert a File object, containing the name and the path in the local CVS of the file. This method is used for commands which operate on the local CVS. Uses the cvsm.


translateRemotePaths

public sharpster.common.ResponseCollection translateRemotePaths(sharpster.common.FileCollection files,
                                                                boolean recursive)
Updates the files object. For each file which is specified, it insert a File object, containing the name, the remote owning user and the path to the remote CVS of the file. This method is used for commands which operate on the remote CVS. Uses the cvsm.


checkFilesExistance

public sharpster.common.ResponseCollection checkFilesExistance(sharpster.common.FileCollection files)
Verifies that the given files exist.


synchronizeCVS

public sharpster.common.ResponseCollection synchronizeCVS(java.lang.String workingDirectory)
Synchronizes the file database with the specified directory.


clearTemporaryFiles

public void clearTemporaryFiles()

remoteCheckoutFiles

public sharpster.common.ResponseCollection remoteCheckoutFiles(sharpster.common.FileCollection files,
                                                               java.lang.String role)
Update the files argument by adding the specified files and information about their versions. The updated collection is then returned by a ResponseCollection. Uses the fkm.


remoteUpdateFiles

public sharpster.common.ResponseCollection remoteUpdateFiles(sharpster.common.FileCollection files)
Updates the given files with possible changes from the CVS. The changes are specified in conflict files, files created to provide information about conflicting changes. Information about the result of the operation is returned. Uses the fkm.


remoteCommitFiles

public sharpster.common.ResponseCollection remoteCommitFiles(sharpster.common.FileCollection files,
                                                             java.lang.String role)
Commits the specified files to the CVS. Returns information about the result of the operation. Uses the fkm.


remoteAddFiles

public sharpster.common.ResponseCollection remoteAddFiles(sharpster.common.FileCollection files)
Adds the specified files to the CVS. Returns information about the result of the operation. Uses the fkm.


remoteRemoveFiles

public sharpster.common.ResponseCollection remoteRemoveFiles(sharpster.common.FileCollection files)
Removes the specified files to the CVS. Returns information about the result of the operation. Uses the fkm.


saveToFile

public boolean saveToFile(java.lang.String file)
Save the file database to a configuration file.


loadFromFile

public boolean loadFromFile(java.lang.String file)
Load the file database from a configuration file.