Class FileProcessorManager
java.lang.Object
com.jalios.jcms.ChannelListener
com.jalios.jcms.fileprocessor.processingmanagement.FileProcessorManager
- All Implemented Interfaces:
PluginComponent,JPropertiesListener,Comparable
FileProcessor singleton manager class
-
Field Summary
Fields inherited from class com.jalios.jcms.ChannelListener
order -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ProcessingData data) Add ProcessingData in the queue for a futur processingvoidaddRunningDataFromScan(String repositoryId) Tell the manager that a scan of a repository is currently beginning and no other scan of the same repository should be done until the first has been totally processed.static FileProcessorManagerRetrieve the last ProcessingData instance that was added for processing (ie for which process may still be pending, in progress or completely finished).Retrieve the last ProcessingData instance that WAS processed (ie for which process is finished).Retrieve the next ProcessingData to processe, wait until one is added if none is yet available.Retrieve a copy of the Processing queue containing the current ProcessingData being process (first, and all other ProcessingData yet to be processed.voidCalled when the channel is finalizedvoidinit()voidCalled just after the store has been loaded and the channel has been initialized.static booleanCheck if the File Processor is enabled.booleanTell if the processing of files is alive (which is expected at all time after JCMS startup, even if FileProcessor is disabled, otherwise a complete restart is required).booleanTell if the processing of files is running (Otherwise, it is stopped, or waiting).booleanisRunnningDataFromScan(String repositoryId) Indicates if the processing thread currently process a set of data sent by a scan of the repository directory.voidpropertiesChange(JProperties properties) Invoked after properties have been modified in JCMS and save on disk.booleanqueueContains(Repository repository, FileActionComponent.Operation operation, File file) Check if the queue contains a ProcessingData matching the specified parameters.Methods inherited from class com.jalios.jcms.ChannelListener
compareTo, equals, getOrder, init, initAfterStartup, initBeforeHibernateFactoryBuild, initBeforeStoreLoad
-
Method Details
-
getInstance
-
init
public void init() -
propertiesChange
Description copied from interface:JPropertiesListenerInvoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getPropertiesorchannel.getProperty.- Specified by:
propertiesChangein interfaceJPropertiesListener- Parameters:
properties- the properties which have been submitted to change
-
initAfterStoreLoad
Description copied from class:ChannelListenerCalled just after the store has been loaded and the channel has been initialized. If for any reason you want to interrupt JCMS startup, you can throw an exception. The exception's message will be displayed in JCMS status page (to any user!).- Overrides:
initAfterStoreLoadin classChannelListener- Throws:
Exception- any exception you may want to throw if a problem occurs needing to interrupt JCMS startup.
-
handleFinalize
public void handleFinalize()Description copied from class:ChannelListenerCalled when the channel is finalized- Overrides:
handleFinalizein classChannelListener
-
isEnabled
public static boolean isEnabled()Check if the File Processor is enabled.- Returns:
- true if enabled false otherwise
- Since:
- JCMS-5197
-
isProcessingThreadRunning
public boolean isProcessingThreadRunning()Tell if the processing of files is running (Otherwise, it is stopped, or waiting).- Returns:
- true if the processing is currently running
-
isProcessingThreadAlive
public boolean isProcessingThreadAlive()Tell if the processing of files is alive (which is expected at all time after JCMS startup, even if FileProcessor is disabled, otherwise a complete restart is required).- Returns:
- true if the processing is currently not stopped
-
isRunnningDataFromScan
Indicates if the processing thread currently process a set of data sent by a scan of the repository directory.- Parameters:
repositoryId- The id of the given repository- Returns:
- true if a scan of the given repository is already pending or running
-
addRunningDataFromScan
Tell the manager that a scan of a repository is currently beginning and no other scan of the same repository should be done until the first has been totally processed.- Parameters:
repositoryId- the id of the given repository
-
getLastFinishedProcessingData
Retrieve the last ProcessingData instance that WAS processed (ie for which process is finished).- Returns:
- a ProcessingData instance or null if no processing has yet occured.
-
getLastAddedProcessingData
Retrieve the last ProcessingData instance that was added for processing (ie for which process may still be pending, in progress or completely finished).- Returns:
- a ProcessingData instance or null if no processing request was ever requestd.
-
add
Add ProcessingData in the queue for a futur processing- Parameters:
data- the ProcessingData to be processed
-
getProcessingData
Retrieve the next ProcessingData to processe, wait until one is added if none is yet available.- Returns:
- the ProcessingData, never return null.
- Throws:
InterruptedException
-
getProcessingDataQueueCopy
Retrieve a copy of the Processing queue containing the current ProcessingData being process (first, and all other ProcessingData yet to be processed.- Returns:
- a unmodifiable list of ProcessingData, never return null
-
queueContains
public boolean queueContains(Repository repository, FileActionComponent.Operation operation, File file) Check if the queue contains a ProcessingData matching the specified parameters.- Parameters:
repository- a repository that must be matched by the ProcessingData to look for, may be null if at least one of the other parameters is not nulloperation- an Operation that must be matched by the ProcessingData to look for, may be null if at least one of the other parameters is not nullfile- a File that must be found in the file set of the ProcessingData to look for, may be null if at least one of the other parameters is not null- Returns:
- true if a match was found, false otherwise
- Throws:
IllegalArgumentException- if no valid parameters were specified- Since:
- jcms-9.0.2 DEVJCMS-1490
-