Package adams.core.io.dirchanged
Class AbstractMessageDigestBasedMonitor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.io.dirchanged.AbstractDirChangeMonitor
-
- adams.core.io.dirchanged.AbstractMessageDigestBasedMonitor
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,DirChangeMonitor,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Serializable
- Direct Known Subclasses:
FlowFileDigest,MessageDigest
public abstract class AbstractMessageDigestBasedMonitor extends AbstractDirChangeMonitor
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 Map<File,String>m_Digeststhe digests per file.protected MessageDigestTypem_Typethe digest type.-
Fields inherited from class adams.core.io.dirchanged.AbstractDirChangeMonitor
m_Dir, m_Initialized, m_LastFiles, m_RegExp
-
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 booleancheckChange(File dir)Performs the actual check whether the dir has changed.protected abstract StringcomputeDigest(File file, MessageCollection errors)Generates the message digest, if possible.voiddefineOptions()Adds options to the internal list of options.protected StringdoInitialize(File dir)Performs the actual initialization of the monitor with the specified dir.protected StringdoUpdate(File dir)Performs the actual updating of the monitor with the specified dir.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.MessageDigestTypegetType()Returns the type of digest to use.protected voidreset()Resets the scheme.voidsetType(MessageDigestType value)Sets the type of digest to use.StringtypeTipText()Returns the tip text for this property.-
Methods inherited from class adams.core.io.dirchanged.AbstractDirChangeMonitor
checkContentChanged, checkFile, getMonitoredDir, getRegExp, hasChanged, initialize, isInitialized, listFiles, regExpTipText, setRegExp, 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.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractDirChangeMonitor
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classAbstractDirChangeMonitor
-
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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractDirChangeMonitor- 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 dir)
Performs the actual initialization of the monitor with the specified dir.- Specified by:
doInitializein classAbstractDirChangeMonitor- Parameters:
dir- the dir to initialize with- Returns:
- null if successful, otherwise error message
-
checkChange
protected boolean checkChange(File dir)
Performs the actual check whether the dir has changed.- Specified by:
checkChangein classAbstractDirChangeMonitor- Parameters:
dir- the dir to check- Returns:
- true if changed
-
doUpdate
protected String doUpdate(File dir)
Performs the actual updating of the monitor with the specified dir.- Specified by:
doUpdatein classAbstractDirChangeMonitor- Parameters:
dir- the dir to update with- Returns:
- null if successful, otherwise error message
-
-