|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.cougaar.core.persist.PersistencePluginAdapter
org.cougaar.core.persist.FilePersistenceBase
public abstract class FilePersistenceBase
This PersistencePlugin abstract base class saves and
restores blackboard objects in files. The actual opening of the
input and output streams remains abstract.
There is one optional parameter naming the persistence root directory. If the parameter is omitted, the persistence root is specified by system properties.
| org.cougaar.install.path | Used by FilePersistence as the parent directory for persistence snapshots when there is no directory specified in configuration parameters and org.cougaar.core.persistence.path is a relative pathname. This property is not used if the plugin is configured with a specific parameter specifying the location of the persistence root. |
| org.cougaar.core.persistence.path | Specifies the directory in which persistence snapshots should be saved. If this is a relative path, it the base will be the value or org.cougaar.install.path. This property is not used if the plugin is configured with a specific parameter specifying the location of the persistence root. |
| Fields inherited from class org.cougaar.core.persist.PersistencePluginAdapter |
|---|
archiveCount, consolidationPeriod, controlNames, emptyOMCRangeList, emptyStringArray, name, params, persistenceInterval, pps, writable |
| Constructor Summary | |
|---|---|
FilePersistenceBase()
|
|
| Method Summary | |
|---|---|
void |
abortOutputStream(SequenceNumbers retainNumbers)
Clean up after output was aborted. |
boolean |
checkOwnership()
Check that this agent instance still owns the persistence data |
void |
cleanupArchive()
Delete old archives |
void |
cleanupOldDeltas(SequenceNumbers cleanupNumbers)
Cleanup old deltas as specified by cleanupNumbers. |
void |
finishInputStream(int deltaNumber)
Clean up after closing the input stream |
void |
finishOutputStream(SequenceNumbers retainNumbers,
boolean full)
Clean up after closing the output stream. |
protected void |
handleParameter(java.lang.String param)
|
void |
init(PersistencePluginSupport pps,
java.lang.String name,
java.lang.String[] params,
boolean deleteOldPersistence)
Initialize the plugin with PersistencePluginSupport and parameters. |
void |
lockOwnership()
Lock out other instances of this agent. |
protected abstract java.io.InputStream |
openFileInputStream(java.io.File file)
|
protected abstract java.io.OutputStream |
openFileOutputStream(java.io.File file)
|
java.io.InputStream |
openInputStream(int deltaNumber)
Open an InputStream from which a persistence delta can be read. |
java.io.OutputStream |
openOutputStream(int deltaNumber,
boolean full)
Open an OutputStream onto which a persistence delta can be written. |
SequenceNumbers[] |
readSequenceNumbers(java.lang.String suffix)
Read the specified set of sequence numbers. |
protected abstract boolean |
rename(java.io.File from,
java.io.File to)
|
DataProtectionKey |
retrieveDataProtectionKey(int deltaNumber)
Retrieve an encrypted key for a particular delta number |
void |
storeDataProtectionKey(int deltaNumber,
DataProtectionKey key)
Store an encrypted key for a particular delta number |
void |
unlockOwnership()
Release the lockout of other instances of this agent. |
| Methods inherited from class org.cougaar.core.persist.PersistencePluginAdapter |
|---|
getConsolidationPeriod, getControlNames, getControlValues, getDatabaseConnection, getName, getParam, getParamCount, getPersistenceInterval, init, isWritable, parseParamValue, releaseDatabaseConnection, setConsolidationPeriod, setControl, setPersistenceInterval, setWritable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.cougaar.core.persist.PersistencePlugin |
|---|
getConsolidationPeriod, getControlNames, getControlValues, getDatabaseConnection, getName, getParam, getParamCount, getPersistenceInterval, isWritable, releaseDatabaseConnection, setConsolidationPeriod, setControl, setPersistenceInterval, setWritable |
| Field Detail |
|---|
public static final java.lang.String PERSISTENCE_PROP_PREFIX
public static final java.lang.String PERSISTENCE_ARCHIVE_COUNT_NAME
public static final java.lang.String PERSISTENCE_CONSOLIDATION_PERIOD_NAME
public static final java.lang.String PERSISTENCE_INTERVAL_NAME
public static final java.lang.String PERSISTENCE_ENABLE_NAME
public static final java.lang.String PERSISTENCE_VERIFY_JAVA_IO_PATCH_NAME
public static final java.lang.String PERSISTENCE_DISABLE_WRITE_NAME
public static final java.lang.String PERSISTENCE_ARCHIVE_NUMBER_NAME
public static final java.lang.String PERSISTENCE_CLASS_NAME
public static final java.lang.String PERSISTENCE_ROOT_NAME
public static final java.lang.String PERSISTENCE_DB_DRIVER_NAME
public static final java.lang.String PERSISTENCE_DB_URL_NAME
public static final java.lang.String PERSISTENCE_DB_USER_NAME
public static final java.lang.String PERSISTENCE_DB_PASSWORD_NAME
public static final java.lang.String PERSISTENCE_DB_INTDEF_NAME
public static final java.lang.String PERSISTENCE_DB_LONGBINARYDEF_NAME
public static final java.lang.String PERSISTENCE_PARAMETERS_NAME
public static final java.lang.String[] NAMES
public static final java.lang.String PERSISTENCE_ARCHIVE_COUNT_PREFIX
public static final java.lang.String PERSISTENCE_CONSOLIDATION_PERIOD_PREFIX
public static final java.lang.String PERSISTENCE_INTERVAL_PREFIX
public static final java.lang.String PERSISTENCE_ENABLE_PREFIX
public static final java.lang.String PERSISTENCE_VERIFY_JAVA_IO_PATCH_PREFIX
public static final java.lang.String PERSISTENCE_DISABLE_WRITE_PREFIX
public static final java.lang.String PERSISTENCE_ARCHIVE_NUMBER_PREFIX
public static final java.lang.String PERSISTENCE_CLASS_PREFIX
public static final java.lang.String PERSISTENCE_ROOT_PREFIX
public static final java.lang.String PERSISTENCE_DB_DRIVER_PREFIX
public static final java.lang.String PERSISTENCE_DB_URL_PREFIX
public static final java.lang.String PERSISTENCE_DB_USER_PREFIX
public static final java.lang.String PERSISTENCE_DB_PASSWORD_PREFIX
public static final java.lang.String PERSISTENCE_DB_INTDEF_PREFIX
public static final java.lang.String PERSISTENCE_DB_LONGBINARYDEF_PREFIX
public static final java.lang.String PERSISTENCE_PARAMETERS_PREFIX
public static final java.lang.String PERSISTENCE_ARCHIVE_COUNT_PROP
public static final java.lang.String PERSISTENCE_CONSOLIDATION_PERIOD_PROP
public static final java.lang.String PERSISTENCE_INTERVAL_PROP
public static final java.lang.String PERSISTENCE_ENABLE_PROP
public static final java.lang.String PERSISTENCE_VERIFY_JAVA_IO_PATCH_PROP
public static final java.lang.String PERSISTENCE_DISABLE_WRITE_PROP
public static final java.lang.String PERSISTENCE_ARCHIVE_NUMBER_PROP
public static final java.lang.String PERSISTENCE_CLASS_PROP
public static final java.lang.String PERSISTENCE_ROOT_PROP
public static final java.lang.String PERSISTENCE_DB_DRIVER_PROP
public static final java.lang.String PERSISTENCE_DB_URL_PROP
public static final java.lang.String PERSISTENCE_DB_USER_PROP
public static final java.lang.String PERSISTENCE_DB_PASSWORD_PROP
public static final java.lang.String PERSISTENCE_DB_INTDEF_PROP
public static final java.lang.String PERSISTENCE_DB_LONGBINARYDEF_PROP
public static final java.lang.String PERSISTENCE_PARAMETERS_PROP
| Constructor Detail |
|---|
public FilePersistenceBase()
| Method Detail |
|---|
protected void handleParameter(java.lang.String param)
handleParameter in class PersistencePluginAdapter
public void init(PersistencePluginSupport pps,
java.lang.String name,
java.lang.String[] params,
boolean deleteOldPersistence)
throws PersistenceException
PersistencePlugin
init in interface PersistencePluginpps - the persistence plugin support specifies the context
within which persistence is being performed.name - the name of this plugin.params - String parameters to configure the plugin. The
parameters come from configuration information and
interpretation is up to the plugin.
PersistenceExceptionpublic boolean checkOwnership()
PersistencePlugin
checkOwnership in interface PersistencePlugincheckOwnership in class PersistencePluginAdapterpublic void lockOwnership()
PersistencePlugin
lockOwnership in interface PersistencePluginlockOwnership in class PersistencePluginAdapterpublic void unlockOwnership()
PersistencePlugin
unlockOwnership in interface PersistencePluginunlockOwnership in class PersistencePluginAdapter
protected abstract java.io.InputStream openFileInputStream(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundException
protected abstract java.io.OutputStream openFileOutputStream(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundException
protected abstract boolean rename(java.io.File from,
java.io.File to)
public SequenceNumbers[] readSequenceNumbers(java.lang.String suffix)
PersistencePlugin
readSequenceNumbers in interface PersistencePluginsuffix - identifies which set of persistence deltas are
wanted. A non-empty suffix specifies an specific, archived
state. An empty suffix specifies all available sets.
public void cleanupOldDeltas(SequenceNumbers cleanupNumbers)
PersistencePlugin
cleanupOldDeltas in interface PersistencePlugincleanupNumbers - the numbers to be discarded (or archived).public void cleanupArchive()
PersistencePlugin
cleanupArchive in interface PersistencePlugin
public java.io.OutputStream openOutputStream(int deltaNumber,
boolean full)
throws java.io.IOException
PersistencePlugin
openOutputStream in interface PersistencePlugindeltaNumber - the number of the delta that will be
written. Numbers are never re-used so this number can be used
to uniquely identify the delta.full - indicates that the information to be written is a
complete state dump and does not depend on any earlier deltas.
It may be useful to distinctively mark such deltas.
java.io.IOException
public void finishOutputStream(SequenceNumbers retainNumbers,
boolean full)
PersistencePlugin
finishOutputStream in interface PersistencePluginretainNumbers - the numbers of the deltas including the
one just written that comprise a complete rehydration set.
Subsequent calls to readSequenceNumbers should return these
values.public void abortOutputStream(SequenceNumbers retainNumbers)
PersistencePlugin
abortOutputStream in interface PersistencePluginretainNumbers - the numbers of the deltas excluding the
one just written that comprise a complete rehydration set.
Subsequent calls to readSequenceNumbers should return these
values.
public java.io.InputStream openInputStream(int deltaNumber)
throws java.io.IOException
PersistencePlugin
openInputStream in interface PersistencePlugindeltaNumber - the number of the delta to be opened
java.io.IOExceptionpublic void finishInputStream(int deltaNumber)
PersistencePlugin
finishInputStream in interface PersistencePlugindeltaNumber - the number of the delta being closed.
Provided as a convenience to the method
public void storeDataProtectionKey(int deltaNumber,
DataProtectionKey key)
throws java.io.IOException
PersistencePlugin
storeDataProtectionKey in interface PersistencePlugindeltaNumber - the number of the delta for which the key is used.key - has the encrypted key to be stored
java.io.IOException
public DataProtectionKey retrieveDataProtectionKey(int deltaNumber)
throws java.io.IOException
PersistencePlugin
retrieveDataProtectionKey in interface PersistencePlugindeltaNumber - the number of the delta for which the key is used.
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||