Class FileChangeTriggerFactory
- java.lang.Object
-
- com.inet.taskplanner.server.api.common.AbstractFactory<COMPONENT,DEFINITION,INFO,SUMMARY>
-
- com.inet.taskplanner.server.api.common.SeriesIndependentFactory<T,TriggerDefinition,TriggerInfo,SummaryInfo>
-
- com.inet.taskplanner.server.api.trigger.TriggerFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger>
-
- com.inet.taskplanner.server.api.trigger.filechange.FileChangeTriggerFactory
-
- All Implemented Interfaces:
com.inet.plugin.NamedExtension
public class FileChangeTriggerFactory extends TriggerFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger>
A task planner trigger that executes a task when a file or folder changes.- Since:
- taskplanner 3.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXTENSION_NAME
Extension name of the file change trigger to use intriggerDefinitions
.static java.lang.String
PROPERTY_FILE_PATH
Key of the property which holds the path to the file to observe.static java.lang.String
PROPERTY_FOLDER_PATH
Key of the property which holds the path to the folder to observe.static java.lang.String
PROPERTY_TYPE
Key of the property type which determines whether a file or a folder must be observed.static java.lang.String
VALUE_FILE
Observe a file and trigger if that file is created, deleted or modified.static java.lang.String
VALUE_FOLDER
Observe a folder and trigger if files in that folder changed or the folder itself is changed.
-
Constructor Summary
Constructors Constructor Description FileChangeTriggerFactory()
Creates instance of file change trigger factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger
createInstanceFrom(TriggerDefinition definition, com.inet.id.GUID taskID)
Construct a component (PRODUCT) from the given definition.TriggerInfo
getInformation(com.inet.id.GUID taskID)
Returns an information object about components which can be produced with this factory.static java.lang.String
getPathOutOfDef(TriggerDefinition definition)
Gets path out of trigger definition.SummaryInfo
getSummary(TriggerDefinition definition)
Construct Summary infos for the component represented by given definition.boolean
isAvailable()
Whether the (COMPONENT) is available or not.void
validate(TriggerDefinition triggerDefinition, com.inet.id.GUID taskID)
Validate the given definition.-
Methods inherited from class com.inet.taskplanner.server.api.trigger.TriggerFactory
getNextExecutionTimes
-
Methods inherited from class com.inet.taskplanner.server.api.common.SeriesIndependentFactory
createFrom, updateValues
-
Methods inherited from class com.inet.taskplanner.server.api.common.AbstractFactory
checkDefinitionArgument, createInstanceFrom, getExtensionName
-
-
-
-
Field Detail
-
EXTENSION_NAME
public static final java.lang.String EXTENSION_NAME
Extension name of the file change trigger to use intriggerDefinitions
.- See Also:
- Constant Field Values
-
PROPERTY_TYPE
public static final java.lang.String PROPERTY_TYPE
Key of the property type which determines whether a file or a folder must be observed. Values can beVALUE_FILE
orVALUE_FOLDER
- See Also:
- Constant Field Values
-
VALUE_FILE
public static final java.lang.String VALUE_FILE
Observe a file and trigger if that file is created, deleted or modified.- See Also:
- Constant Field Values
-
VALUE_FOLDER
public static final java.lang.String VALUE_FOLDER
Observe a folder and trigger if files in that folder changed or the folder itself is changed.- See Also:
- Constant Field Values
-
PROPERTY_FILE_PATH
public static final java.lang.String PROPERTY_FILE_PATH
Key of the property which holds the path to the file to observe.- See Also:
- Constant Field Values
-
PROPERTY_FOLDER_PATH
public static final java.lang.String PROPERTY_FOLDER_PATH
Key of the property which holds the path to the folder to observe.- See Also:
- Constant Field Values
-
-
Method Detail
-
createInstanceFrom
protected com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger createInstanceFrom(TriggerDefinition definition, com.inet.id.GUID taskID)
Construct a component (PRODUCT) from the given definition.- Overrides:
createInstanceFrom
in classAbstractFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>
- Parameters:
definition
- the definition holding information for the PRODUCTtaskID
- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Returns:
- a new PRODUCT
-
getInformation
public TriggerInfo getInformation(com.inet.id.GUID taskID)
Returns an information object about components which can be produced with this factory.The returned info contains information about how such a component is to be presented in the taskPlanner GUI. This are display-infos or available options to configure. The returned information contains
fields
which describes the values a user can specify in the WEB GUI. The field is also responsible to replace any placeholders for the corresponding property in aserial
task. That means properties without a field definition will not get any series placeholder replaced.If you implement a factory for a component only to be used by API, only then you can return null here.
- Specified by:
getInformation
in classAbstractFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>
- Parameters:
taskID
- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Returns:
- an information object for components this factory can produce
-
validate
public void validate(TriggerDefinition triggerDefinition, com.inet.id.GUID taskID) throws ValidationException
Validate the given definition.The given definition is guaranteed to belong to this factory
- Specified by:
validate
in classSeriesIndependentFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>
- Parameters:
triggerDefinition
- the definition to validatetaskID
- the ID of the task the definition belongs or will belong to, for optional use. Can be null if the operation is done for a non-saved task.- Throws:
java.lang.IllegalArgumentException
- if given definition is null.ValidationException
- if the component has some errors
-
getPathOutOfDef
@Nullable public static java.lang.String getPathOutOfDef(TriggerDefinition definition)
Gets path out of trigger definition.- Parameters:
definition
- definition of the trigger.- Returns:
- path from the trigger definition. May be null.
- Throws:
java.lang.IllegalArgumentException
- if the definition is null- Since:
- taskplanner 3.0
-
getSummary
public SummaryInfo getSummary(TriggerDefinition definition)
Construct Summary infos for the component represented by given definition.The summary info is used when the webgui displays the component.
When implementing a factory for a component only to be used per API, only then you can return null here.
- Specified by:
getSummary
in classAbstractFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>
- Parameters:
definition
- the definition with the settings made by a user- Returns:
- summary infos containing text lines to be displayed in the webgui for this component.
-
isAvailable
public boolean isAvailable()
Whether the (COMPONENT) is available or not.- Overrides:
isAvailable
in classAbstractFactory<com.inet.taskplanner.server.api.trigger.filechange.FileChangeTrigger,TriggerDefinition,TriggerInfo,SummaryInfo>
- Returns:
- whether the (COMPONENT) is available or not
-
-