public class ExtendedArchiveManager extends ArchiveManager
Modifier and Type | Class and Description |
---|---|
protected static class |
ExtendedArchiveManager.AbstractWorkerThread
Class AbstractWorkerThread is a general worker thread for archive managers.
|
protected static class |
ExtendedArchiveManager.ArchiveItemWorkerThread
Class ArchiveItemWorkerThread fetches items from the queue
and adds them to the archive.
|
protected static class |
ExtendedArchiveManager.PurgeWorkerThread
Class PurgeWorkerThread purges items from the archive.
|
ArchiveManager.ProcessCallBack
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector |
archiveItemQueueVec
The archive item queue vector.
|
protected static ExtendedArchiveManager.ArchiveItemWorkerThread |
archiveItemWTObj |
protected static java.lang.Object |
archiveItemWTSyncObj |
protected static ExtendedArchiveManager.PurgeWorkerThread |
purgeWTObj |
protected static java.lang.Object |
purgeWTSyncObj |
protected boolean |
strictArchiveDateFlag
Set 'true' if items must be in ascending date/time order.
|
archiveAccessSyncObj, archiveClosedFlag, archivedClassConstructor, archivedFormPrefixStr, archivedItemDelimiter, archiveFileNameStr, archiveOutStm, archiveRootDirName, assumeNewlineFlag, dontPurgeLastFileFlag, filesForDateRangeVec, lastItemArchiveDate, leaveOutputStreamsOpenFlag, purgeIntoArchiveFlag, timeCheckOffsetMs
Constructor and Description |
---|
ExtendedArchiveManager(java.lang.Class classObj,
java.lang.String archiveFileNameStr)
Creates a new instance of ExtendedArchiveManager to archive instances of
the given class.
|
ExtendedArchiveManager(java.lang.Class classObj,
java.lang.String archiveRootDirName,
java.lang.String archiveFileNameStr)
Creates a new instance of ExtendedArchiveManager to archive instances of
the given class.
|
ExtendedArchiveManager(java.lang.Class classObj,
java.lang.String archiveRootDirName,
java.lang.String archiveFileNameStr,
boolean strictArchiveDateFlag)
Creates a new instance of ExtendedArchiveManager to archive instances of
the given class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addToWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
Adds this archive manager to the worker thread
if it has not already been added.
|
boolean |
archiveItem(Archivable item)
Inserts an item into the archive.
|
protected void |
archiveQueuedItem(Archivable item)
Inserts an item into the archive.
|
void |
closeArchive()
Releases resources allocated for this archive manager.
|
long |
getArchivePollTime()
Gets the archive poll time.
|
long |
getArchivePurgeAge()
Gets the archive purge age in milliseconds.
|
boolean |
isArchiveItemQueueEnabled()
Determines if the archive item queue is enabled.
|
protected boolean |
purgeArchive(long currentTime)
Purges items and archive files with an archive date older than the
purge age if enable.
|
protected void |
removeFromWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
Removes this archive manager from the worker thread if it was added.
|
void |
setArchiveItemQueueEnabled(boolean b)
Enables/disables the archive item queue.
|
void |
setArchivePollTime(long archivePollTime)
Sets the archive poll time.
|
void |
setArchivePurgeAge(long age)
Sets the archive purge age in milliseconds.
|
protected void |
signalWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
Signals the worker thread.
|
static void |
terminateWorkerThreads()
Terminates the worker threads started by this archive manager.
|
archiveItem, checkItemArchiveDate, close, close, closeArchiveOutStms, convertStringToArchivable, deleteFile, doesNextArchiveFileExist, flush, getArchiveAccessSyncObj, getArchivedFormPrefixStr, getArchivedItemDelimiter, getArchivedItems, getArchivedItems, getArchivedItemsVector, getArchivedItemsVector, getArchiveFileForName, getArchiveFileNameForDate, getArchiveFilesForDateRange, getDontPurgeLastFileFlag, getLeaveOutputStreamsOpenFlag, getLogFile, getLogPrefixString, getNewestArchiveFile, getNewestItemInArchiveFile, getNewestItemInEntireArchive, getNextItemDataFromFile, getNextLineFromFile, getOldestArchiveFile, getOldestItemInArchiveFile, getOldestItemInEntireArchive, getOutputStreamForItem, getPurgeIntoArchiveFlag, getTimeCheckOffsetMs, isArchiveClosed, processArchivedItems, processArchivedItems, purgeArchive, purgeArchive, renameTo, setArchivedFormPrefixStr, setArchivedItemDelimiter, setDontPurgeLastFileFlag, setLeaveOutputStreamsOpenFlag, setLogFile, setLogPrefixString, setPurgeIntoArchiveFlag, setTimeCheckOffsetMs, writeItemToFile
protected final java.util.Vector archiveItemQueueVec
protected final boolean strictArchiveDateFlag
protected static final java.lang.Object archiveItemWTSyncObj
protected static ExtendedArchiveManager.ArchiveItemWorkerThread archiveItemWTObj
protected static final java.lang.Object purgeWTSyncObj
protected static ExtendedArchiveManager.PurgeWorkerThread purgeWTObj
public ExtendedArchiveManager(java.lang.Class classObj, java.lang.String archiveRootDirName, java.lang.String archiveFileNameStr, boolean strictArchiveDateFlag) throws java.lang.NoSuchMethodException
classObj
- class object representing the class to be archived.archiveRootDirName
- name of root directory in which to place
archive files (and possibly directories), or null to use the
current working directory.archiveFileNameStr
- name to use for the archive file(s).strictArchiveDateFlag
- true if items must be in ascending
date/time order; false if not.java.lang.NoSuchMethodException
- if a proper constructor does not exist
for the class.java.lang.NullPointerException
- If archiveFileNameStr
is null
public ExtendedArchiveManager(java.lang.Class classObj, java.lang.String archiveRootDirName, java.lang.String archiveFileNameStr) throws java.lang.NoSuchMethodException
classObj
- class object representing the class to be archived.archiveRootDirName
- name of root directory in which to place
archive files (and possibly directories), or null to use the
current working directory.archiveFileNameStr
- name to use for the archive file(s).java.lang.NoSuchMethodException
- if a proper constructor does not exist
for the class.java.lang.NullPointerException
- If archiveFileNameStr
is null
public ExtendedArchiveManager(java.lang.Class classObj, java.lang.String archiveFileNameStr) throws java.lang.NoSuchMethodException
classObj
- class object representing the class to be archived.archiveFileNameStr
- name to use for the archive file(s).java.lang.NoSuchMethodException
- if a proper constructor does not exist
for the class.java.lang.NullPointerException
- If archiveFileNameStr
is null
public boolean archiveItem(Archivable item) throws java.io.IOException
archiveItem
in class ArchiveManager
item
- the item to be archived.java.io.IOException
- if the archive file can not be written to.public void closeArchive()
closeArchive
in class ArchiveManager
public long getArchivePurgeAge()
setArchivePurgeAge
public long getArchivePollTime()
public boolean isArchiveItemQueueEnabled()
setArchiveItemQueueEnabled
public void setArchiveItemQueueEnabled(boolean b)
b
- true to enable, false to disable.
NOTE: The archive poll time should be set prior to calling this method
via the 'setArchivePollTime' method.isArchiveItemQueueEnabled
,
setArchivePollTime
public void setArchivePollTime(long archivePollTime)
archivePollTime
- the archive poll time in milliseconds or 0
for interrupts (default).public void setArchivePurgeAge(long age)
age
- the archive purge age in milliseconds (0 for disabled.)getArchivePurgeAge
public static void terminateWorkerThreads()
protected void addToWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
wt
- the worker thread.protected void archiveQueuedItem(Archivable item) throws java.io.IOException
item
- the item to be archived.java.io.IOException
- if the archive file can not be written to.protected void signalWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
wt
- the worker thread.protected boolean purgeArchive(long currentTime)
currentTime
- the current time in milliseconds.setArchivePurgeAge, setArchivePurgeAge
protected void removeFromWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
wt
- the worker thread.