Class FileProcessorManager

    • Method Detail

      • 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 java.lang.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:
        java.lang.Exception - any exception you may want to throw if a problem occurs needing to interrupt JCMS startup.
      • 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​(java.lang.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​(java.lang.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 processed (ie for which process may still be pending, in progress or completely finished).
        Returns:
        a ProcessingData instance or null if no processing has yet occured.
      • 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 java.lang.InterruptedException
        Retrieve the next ProcessingData to processe, wait until one is added if none is yet available.
        Returns:
        the ProcessingData, never return null.
        Throws:
        java.lang.InterruptedException
      • getProcessingDataQueueCopy

        public java.util.List<ProcessingData> getProcessingDataQueueCopy()
        Retrieve a copy of the Processing queue containing all ProcessingData yet to be processed
        Returns:
        a list of ProcessingData, never return null
      • queueContains

        public boolean queueContains​(Repository repository,
                                     FileActionComponent.Operation operation,
                                     java.io.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:
        java.lang.IllegalArgumentException - if no valid parameters were specified
        Since:
        jcms-9.0.2 DEVJCMS-1490