Package adams.flow.condition.bool
Class FileInUse
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<BooleanCondition>
,SizeOfHandler
,Stoppable
,BooleanCondition
,Serializable
public class FileInUse extends AbstractBooleanCondition
Evaluates to 'true' if the file is currently being used by another process.
If a filename generator other than adams.core.io.NullFilenameGenerator is specified, then this takes precedence over the supplied filename (uses the token passing through).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-file <adams.core.io.PlaceholderFile> (property: file) The file to check. default: ${CWD}
-generator <adams.core.io.AbstractFilenameGenerator> (property: generator) The generator to use for generating the filename; uses the token passing through. default: adams.core.io.NullFilenameGenerator
-check <adams.core.io.fileuse.AbstractFileUseCheck> (property: check) The check scheme to use. default: adams.core.io.fileuse.Default
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractFileUseCheck
m_Check
the check scheme to use.protected PlaceholderFile
m_File
the file to look for.protected AbstractFilenameGenerator
m_Generator
the filename generator.-
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 FileInUse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.String
checkTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected boolean
doEvaluate(Actor owner, Token token)
Performs the actual evaluation.String
fileTipText()
Returns the tip text for this property.String
generatorTipText()
Returns the tip text for this property.AbstractFileUseCheck
getCheck()
Returns the 'in use' check scheme.PlaceholderFile
getFile()
Returns the file to check.AbstractFilenameGenerator
getGenerator()
Returns the generator to use (ignored ifNullFilenameGenerator
).String
getQuickInfo()
Returns the quick info string to be displayed in the flow editor.String
globalInfo()
Returns a string describing the object.void
setCheck(AbstractFileUseCheck value)
Sets the 'in use' check scheme.void
setFile(PlaceholderFile value)
Sets the file to check.void
setGenerator(AbstractFilenameGenerator value)
Sets the generator to use (ignored ifNullFilenameGenerator
).String
setUp(Actor owner)
Configures the condition.-
Methods inherited from class adams.flow.condition.bool.AbstractBooleanCondition
evaluate, preEvaluate, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, 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_File
protected PlaceholderFile m_File
the file to look for.
-
m_Generator
protected AbstractFilenameGenerator m_Generator
the filename generator.
-
m_Check
protected AbstractFileUseCheck m_Check
the check scheme to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setFile
public void setFile(PlaceholderFile value)
Sets the file to check.- Parameters:
value
- the file
-
getFile
public PlaceholderFile getFile()
Returns the file to check.- Returns:
- the file
-
fileTipText
public String fileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setGenerator
public void setGenerator(AbstractFilenameGenerator value)
Sets the generator to use (ignored ifNullFilenameGenerator
).- Parameters:
value
- the generator
-
getGenerator
public AbstractFilenameGenerator getGenerator()
Returns the generator to use (ignored ifNullFilenameGenerator
).- Returns:
- the generator
-
generatorTipText
public String generatorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCheck
public void setCheck(AbstractFileUseCheck value)
Sets the 'in use' check scheme.- Parameters:
value
- the check scheme
-
getCheck
public AbstractFileUseCheck getCheck()
Returns the 'in use' check scheme.- Returns:
- the check scheme
-
checkTipText
public String checkTipText()
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 the quick info string to be displayed in the flow editor.- Specified by:
getQuickInfo
in interfaceBooleanCondition
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Specified by:
getQuickInfo
in classAbstractBooleanCondition
- Returns:
- the info or null if no info to be displayed
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
accepts
in interfaceBooleanCondition
- Specified by:
accepts
in classAbstractBooleanCondition
- Returns:
- Unknown
-
setUp
public String setUp(Actor owner)
Configures the condition.- Specified by:
setUp
in interfaceBooleanCondition
- Overrides:
setUp
in classAbstractBooleanCondition
- Parameters:
owner
- the actor this condition belongs to- Returns:
- null if everything is fine, otherwise error message
-
doEvaluate
protected boolean doEvaluate(Actor owner, Token token)
Performs the actual evaluation.- Specified by:
doEvaluate
in classAbstractBooleanCondition
- Parameters:
owner
- the owning actortoken
- the current token passing through- Returns:
- the result of the evaluation
-
-