Package adams.core.io.filechanged
Class AbstractMessageDigestBasedMonitor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.io.filechanged.AbstractFileChangeMonitor
-
- adams.core.io.filechanged.AbstractMessageDigestBasedMonitor
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,FileChangeMonitor
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
FlowFileDigest
,MessageDigest
public abstract class AbstractMessageDigestBasedMonitor extends AbstractFileChangeMonitor
Ancestor for message digest based monitors.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Digest
the digest.protected MessageDigestType
m_Type
the digest type.-
Fields inherited from class adams.core.io.filechanged.AbstractFileChangeMonitor
m_File, m_Initialized
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractMessageDigestBasedMonitor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkChange(File file)
Performs the actual check whether the file has changed.protected abstract String
computeDigest(File file, MessageCollection errors)
Generates the message digest, if possible.void
defineOptions()
Adds options to the internal list of options.protected String
doInitialize(File file)
Performs the actual initialization of the monitor with the specified file.protected String
doUpdate(File file)
Performs the actual updating of the monitor with the specified file.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.MessageDigestType
getType()
Returns the type of digest to use.protected void
reset()
Resets the scheme.void
setType(MessageDigestType value)
Sets the type of digest to use.String
typeTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.io.filechanged.AbstractFileChangeMonitor
checkFile, getMonitoredFile, hasChanged, initialize, isInitialized, update
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Type
protected MessageDigestType m_Type
the digest type.
-
m_Digest
protected String m_Digest
the digest.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractFileChangeMonitor
-
setType
public void setType(MessageDigestType value)
Sets the type of digest to use.- Parameters:
value
- the type
-
getType
public MessageDigestType getType()
Returns the type of digest to use.- Returns:
- the type
-
typeTipText
public String typeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractFileChangeMonitor
- Returns:
- null if no info available, otherwise short string
-
computeDigest
protected abstract String computeDigest(File file, MessageCollection errors)
Generates the message digest, if possible.- Parameters:
file
- the file to generate the digest forerrors
- for collecting any errors- Returns:
- the digest
-
doInitialize
protected String doInitialize(File file)
Performs the actual initialization of the monitor with the specified file.- Specified by:
doInitialize
in classAbstractFileChangeMonitor
- Parameters:
file
- the file to initialize with- Returns:
- null if successful, otherwise error message
-
checkChange
protected boolean checkChange(File file)
Performs the actual check whether the file has changed.- Specified by:
checkChange
in classAbstractFileChangeMonitor
- Parameters:
file
- the file to check- Returns:
- true if changed
-
doUpdate
protected String doUpdate(File file)
Performs the actual updating of the monitor with the specified file.- Specified by:
doUpdate
in classAbstractFileChangeMonitor
- Parameters:
file
- the file to update with- Returns:
- null if successful, otherwise error message
-
-