Class FileProcessorManager

java.lang.Object
com.jalios.jcms.ChannelListener
com.jalios.jcms.fileprocessor.processingmanagement.FileProcessorManager
All Implemented Interfaces:
PluginComponent, JPropertiesListener, Comparable

public class FileProcessorManager extends ChannelListener implements JPropertiesListener
FileProcessor singleton manager class
  • Method Details

    • getInstance

      public static FileProcessorManager getInstance()
    • init

      public void init()
    • propertiesChange

      public void propertiesChange(JProperties properties)
      Description copied from interface: JPropertiesListener
      Invoked 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.getProperties or channel.getProperty.

      Specified by:
      propertiesChange in interface JPropertiesListener
      Parameters:
      properties - the properties which have been submitted to change
    • initAfterStoreLoad

      public void initAfterStoreLoad() throws Exception
      Description copied from class: ChannelListener
      Called 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:
      initAfterStoreLoad in class ChannelListener
      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: ChannelListener
      Called when the channel is finalized
      Overrides:
      handleFinalize in class ChannelListener
    • 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

      public boolean isRunnningDataFromScan(String repositoryId)
      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

      public void addRunningDataFromScan(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.
      Parameters:
      repositoryId - the id of the given repository
    • getLastFinishedProcessingData

      public ProcessingData 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

      public ProcessingData 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

      public void add(ProcessingData data)
      Add ProcessingData in the queue for a futur processing
      Parameters:
      data - the ProcessingData to be processed
    • getProcessingData

      public ProcessingData getProcessingData() throws InterruptedException
      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

      public List<ProcessingData> 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 null
      operation - 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 null
      file - 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