|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpl.mipl.mdms.FileService.komodo.api.ClientRestartCache
public class ClientRestartCache
Purpose: Client restart cache JavaBean is used to cache file download and query information. The cached data can be persisted in XML format to assist restarting of user query or file download session. The cache data is stored with file name: <servergroup>.<filetype>.<subtype>.<restart|notify>. It is created per file type.
Copyright 2005, California Institute of Technology. ALL RIGHTS RESERVED. U.S. Government Sponsorship acknowledge. 2005.
============================================================================ Modification History : ---------------------- Date Who What ---------------------------------------------------------------------------- 01/01/0001 Thomas Initial Release 01/10/2006 Nick Initial documentation. 01/10/2006 Nick Added backup capability. When committing a backup of existing file is made. When restoring, if cannot restore from file, the backup is checked. ============================================================================
Constructor Summary | |
---|---|
ClientRestartCache()
Default constructor - required by JavaBean encoding architecture |
|
ClientRestartCache(String servergroup,
String filetype,
String subtype,
Character command,
String queryExpression,
String cacheFilename)
Constructor |
Method Summary | |
---|---|
void |
addPersist(String filename,
long size,
long utc)
Method to add persist informtion used by resume transfer. |
void |
addPersist(String filename,
String vft,
long size,
long utc)
Method to add persist infomation used by resume transfer on getVFT |
static boolean |
canRestoreFromCache(String servergroup,
String filetype,
String subtype,
Character command,
String classicRegistry,
String outputDir)
Checks if a cache file associated with the parameters exists. |
void |
commit()
Method to persist this cache JavaBean in XML format. |
protected void |
commitBackup()
Copies existing restart file to a backup version in the name of fault tolerance. |
protected void |
copyFile(File src,
File dst)
Copies file using standard Java I/O library. |
protected void |
copyFileNIO(File src,
File dst)
Copies file using NIO package. |
String |
getCacheFilename()
Accessor method to return the cache file name |
Character |
getCommand()
Accessor method to return the user command |
Hashtable |
getFilesToResume()
Accessor method to return internal hashtable used to keep track of file resume transfer information |
String |
getFileType()
Accessor method to get file type name |
String |
getLastQueryExpression()
Accessor for last file query expression |
String |
getLastQueryTime()
Accessor to obtain the last query time in CCSDS formated time string |
String |
getOutputDir()
Accessor to file output directory |
String |
getPersistedCCSDSModTimeString(String filename)
Method to return the file modification time in CCSDS formated string |
Long |
getPersistedFileSize(String filename)
Method to obtain the cached file size |
Date |
getPersistedModTime(String filename)
Method to return the file modification time in a Date object |
String |
getPersistedVFT(String filename)
Method to get peristed resume transfer information on a VFT reference |
Long |
getResumeOffset(String filename)
Method to get resume offset value of a file. |
String |
getServerGroup()
Accessor method to return server group name |
String |
getSubType()
Accessor method to file sub-type name |
protected void |
moveFile(File src,
File dst)
Renames source file to destination file. |
void |
removePersist(String filename)
Method to remove resume transfer information. |
static ClientRestartCache |
restoreFromCache(String servergroup,
String filetype,
String subtype,
Character command,
String queryExpression,
String classicRegistry,
String outputDir)
Factory method to create a client restart cache. |
void |
setCacheFilename(String cacheFilename)
Method to set the cache file name |
void |
setCommand(Character command)
Method to set the user command operator character |
void |
setFilesToResume(Hashtable filesToResume)
Method to set file resume transfer internal data structure. |
void |
setFileType(String filetype)
Method to set file type name |
void |
setLastQueryExpression(String lastQueryExpression)
Method to set last file query expression |
void |
setLastQueryTime(long utc)
Method to set the last query time in UTC long integer |
void |
setLastQueryTime(String ccsds)
Method to set the last query time in CCSDS-formated time |
void |
setOutputDir(String outputDir)
Method to set the output directory |
void |
setServerGroup(String servergroup)
Method to set server group name |
void |
setSubType(String subtype)
Method to set sub-type name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClientRestartCache()
public ClientRestartCache(String servergroup, String filetype, String subtype, Character command, String queryExpression, String cacheFilename)
servergroup
- the server groupfiletype
- the file typesubtype
- the file sub-typecommand
- the user commandqueryExpression
- the file name query expressioncacheFilename
- the cache file nameMethod Detail |
---|
public static ClientRestartCache restoreFromCache(String servergroup, String filetype, String subtype, Character command, String queryExpression, String classicRegistry, String outputDir)
servergroup
- server group namefiletype
- file tye namesubtype
- file sub-type namecommand
- the command (add,get,list..)queryExpression
- the file name query expressionclassicRegistry
- the classic registry locaionoutputDir
- the file output location. For get or autoget, this should
be the output directory where new files will be stored. For show
or autoshow, this should be the user cache directory (i.e.
$HOME/.komdo)
public static boolean canRestoreFromCache(String servergroup, String filetype, String subtype, Character command, String classicRegistry, String outputDir)
servergroup
- Servergroup namefiletype
- Filetype namesubtype
- Sub-filetype namecommand
- Character associated with commandoutputDir
- Output directory pathoutputDir
- Output directory path
public void addPersist(String filename, long size, long utc)
filename
- the file namesize
- the file sizeutc
- the file modification timepublic void addPersist(String filename, String vft, long size, long utc)
filename
- the file namevft
- the reference name registered under a VFTsize
- the file sizeutc
- the file modification timepublic void removePersist(String filename)
filename
- the file namepublic String getPersistedVFT(String filename)
filename
- the file anme
public Long getResumeOffset(String filename)
filename
- the file name
public Long getPersistedFileSize(String filename)
filename
- the file name
public String getPersistedCCSDSModTimeString(String filename)
filename
- the file name
public Date getPersistedModTime(String filename)
filename
- the file name
public String getCacheFilename()
public void setCacheFilename(String cacheFilename)
cacheFilename
- the cache file namepublic Character getCommand()
public void setCommand(Character command)
command
- the command operatorpublic String getServerGroup()
public void setServerGroup(String servergroup)
servergroup
- the server group namepublic String getFileType()
public void setFileType(String filetype)
filetype
- the file type namepublic String getSubType()
public void setSubType(String subtype)
subtype
- the sub type namepublic Hashtable getFilesToResume()
public void setFilesToResume(Hashtable filesToResume)
filesToResume
- the hashtablepublic String getLastQueryTime()
public void setLastQueryTime(long utc)
utc
- the UTC long integerpublic void setLastQueryTime(String ccsds)
ccsds
- the CCSDS formated timepublic String getLastQueryExpression()
public void setLastQueryExpression(String lastQueryExpression)
lastQueryExpression
- the last file query expressionpublic String getOutputDir()
public void setOutputDir(String outputDir)
outputDir
- the output directorypublic void commit() throws SessionException
SessionException
protected void commitBackup()
protected void moveFile(File src, File dst) throws IOException
src
- Source filedst
- Destination file
IOException
protected void copyFile(File src, File dst) throws IOException
src
- Source filedst
- Destination file
IOException
protected void copyFileNIO(File src, File dst) throws IOException
src
- Source filedst
- Destination file
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |