org.sourcejammer.client.filesys
Class SourceVersionChecker
java.lang.Object
|
+--org.sourcejammer.client.filesys.SourceVersionChecker
- public class SourceVersionChecker
- extends java.lang.Object
The function of this class is to act as the go-between for retreiving source
files from the server and saving them to the local file system and also for
retreiving files from the local filesystem and sending them to the server.
This class uses the file source.jam to track what has been stored in the
directory it is responsible for. The source.jam file contains information about
the version number and archive that each relavent file originates from. If
the version number and archive match and the file, the file does not need
to be retrieved again from the server.
Constructor Summary |
SourceVersionChecker(java.io.File flTargetDirectory,
java.lang.String serverURL,
java.lang.String archiveName)
|
Method Summary |
StoredFileInfoBean |
getStoredFileInfo(java.lang.String sFileName)
Returns the StoredFileInfoBean for the specified file in the
directory served by this SourceVersionChecker. |
boolean |
isFileCurrent(java.lang.String sFileName,
long lSourceVersionUniqueID)
Returns true if the specified version of the specified file is the
version of that file currently stored in the directory for this
SourceVersionChecker. |
boolean |
isStoredFileInfoAccurate(java.lang.String sFileName)
Returns true if the file info in the source.jam file matches the actual
file in the directory. |
boolean |
saveFile(java.lang.String sName,
long lSourceVersionUniqueID,
byte[] byFile,
boolean setToReadOnly,
boolean promptIfWritable)
Save the file (byte array) to the target directory for this
SourceVersionChecker, using the name specified. |
boolean |
saveFile(java.lang.String sName,
long lSourceVersionUniqueID,
long lTempFileId,
boolean setToReadOnly,
boolean promptIfWritable)
Save the file (byte array) to the target directory for this
SourceVersionChecker, using the name specified. |
void |
updateLocalInfo(java.lang.String sFileName,
long lSourceVersionID)
Updates the source.jam file for the target directory for this
SourceVersionChecker. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOCAL_FILE_INFO_FILE_NAME
public static final java.lang.String LOCAL_FILE_INFO_FILE_NAME
SourceVersionChecker
public SourceVersionChecker(java.io.File flTargetDirectory,
java.lang.String serverURL,
java.lang.String archiveName)
throws java.io.IOException
- Parameters:
flTargetDirectory
- -- the directory that this SourceVersionChecker
is responsible for.serverURL
- -- URL for the SJ server that the client is connected to.archiveName
- -- name of the SJ archive the client is connected to.
saveFile
public boolean saveFile(java.lang.String sName,
long lSourceVersionUniqueID,
byte[] byFile,
boolean setToReadOnly,
boolean promptIfWritable)
throws java.io.IOException
- Save the file (byte array) to the target directory for this
SourceVersionChecker, using the name specified.
- Parameters:
sName
- -- name to use in saving the file.lSourceVersionUniqueID
- -- unique ID of the VERSION of the file
being saved.byFile
- -- the file as a byte array.setToReadOnly
- -- if true, the file will be set to read-only after
it is saved.promptIfWritable
- -- prompts the user if a file named sName already
exists in this directory and that file is NOT read-only. This
property only works when called from Swing. Always set to false
if calling from command line.- Returns:
- true if the file was saved successfully. False otherwise.
saveFile
public boolean saveFile(java.lang.String sName,
long lSourceVersionUniqueID,
long lTempFileId,
boolean setToReadOnly,
boolean promptIfWritable)
throws java.io.IOException
- Save the file (byte array) to the target directory for this
SourceVersionChecker, using the name specified.
- Parameters:
sName
- -- name to use in saving the file.lSourceVersionUniqueID
- -- unique ID of the VERSION of the file
being saved.lTempFileId
- -- id of temp file to be saved to parent directory.setToReadOnly
- -- if true, the file will be set to read-only after
it is saved.promptIfWritable
- -- prompts the user if a file named sName already
exists in this directory and that file is NOT read-only. This
property only works when called from Swing. Always set to false
if calling from command line.- Returns:
- true if the file was saved successfully. False otherwise.
getStoredFileInfo
public StoredFileInfoBean getStoredFileInfo(java.lang.String sFileName)
throws java.io.IOException
- Returns the StoredFileInfoBean for the specified file in the
directory served by this SourceVersionChecker. The StoredFileInfoBean
will contain identifying information about version of this file
that is stored in this directory. This information may or may not be
current. Call isStoredFileInfoAccurate() to check.
updateLocalInfo
public void updateLocalInfo(java.lang.String sFileName,
long lSourceVersionID)
throws java.io.IOException
- Updates the source.jam file for the target directory for this
SourceVersionChecker. Sets the version ID of the specified file.
- Parameters:
sFileName
- -- name of the file whose version id is to be updated.lSourceVersionID
- -- version id of the specified file.
isStoredFileInfoAccurate
public boolean isStoredFileInfoAccurate(java.lang.String sFileName)
throws java.io.IOException
- Returns true if the file info in the source.jam file matches the actual
file in the directory.
isFileCurrent
public boolean isFileCurrent(java.lang.String sFileName,
long lSourceVersionUniqueID)
throws java.io.IOException
- Returns true if the specified version of the specified file is the
version of that file currently stored in the directory for this
SourceVersionChecker.