Class RepositoryManager

java.lang.Object
com.jalios.jcms.fileprocessor.repository.RepositoryManager

public class RepositoryManager extends Object
This singleton manages Repositories in the following way : - allows checkin/checkout ; - allows launching/stopping ; - manages scheduling informations ; - tells if a task from a scan of the repository is pending.
  • Field Details

  • Method Details

    • getInstance

      public static RepositoryManager getInstance()
      The first time, instanciate the RepositoryManager.
      Returns:
      the only instance of RepositoryManager
    • addRepository

      public boolean addRepository(Repository configuration)
      A new repository is added to the manager, except if :
      • it is null;
      • the id is alreadey used for another configuration;
      • the conditions are not verified.
      The repository will still need to be started by invoking launchRepository(String)
      Parameters:
      configuration - the Repository configuration to add to the manager
      Returns:
      true if the repository was added, false otherwise
    • removeRepository

      public Repository removeRepository(String id)
      Stops, removes and returns the repository mapped to this id off from the manager.

      Returns null if no repository is mapped to this id.

      Parameters:
      id - the id of the Repository
      Returns:
      the repository that is no longer registered nor launched/running
    • getRepository

      public Repository getRepository(String id)
      Gives the RepositoryConfiguration mapped with this id.
      Parameters:
      id - The id of the repository
      Returns:
      RepositoryConfiguration mapped with this id, null if there is none
    • getRepositories

      public Collection<Repository> getRepositories()
      Gives the collection of RepositoryConfiguration registered in the manager.
      Returns:
      the collection of repositories.
    • isLaunched

      public boolean isLaunched(String id)
      We store in memory the information that a repository is stored.
      Parameters:
      id - The id of the repository
      Returns:
      true if there is a repository associated to this id and it is launched
    • launchRepository

      public boolean launchRepository(String id)
      Launch a repository if not.
      Parameters:
      id - The id of the repository
      Returns:
      true if the repository is launched by the call to this method, false if it is already launched.
    • stopRepository

      public boolean stopRepository(String id)
      Stops the treatment if needed and checkout the AlarmEntry.
      Parameters:
      id - The id of the repository
      Returns:
      true if the repository is not checked in.
    • executeNextScanAlarmNow

      public boolean executeNextScanAlarmNow(String id)
      Execute now, in a specific thread (not in the current thread) the AlarmListener used to trigger directory scanning.
      Parameters:
      id - The id of the repository
      Returns:
      true if the repository is not checked in.
    • executeNextPostponedAlarmNow

      public boolean executeNextPostponedAlarmNow(String id)
      Execute now, in a specific thread (not in the current thread) the AlarmListener used to process postponed item. Execute now, in a specific thread (not in the current thread) the AlarmListener
      Parameters:
      id - The id of the repository
      Returns:
      true if the repository is not checked in.
    • getNextScanDate

      public Date getNextScanDate(String id)
      Returns the date of the next call to the AlarmListener scheduled for directory scanning
      Parameters:
      id - The id of the repository
      Returns:
      the date of the next call to the scan of the repository.
    • getNextPostponedProcessingDate

      public Date getNextPostponedProcessingDate(String id)
      Returns the date of the next call to the AlarmListener scheduled for postponed item processing.
      Parameters:
      id - The id of the repository
      Returns:
      the date of the next call to the postponed items processing of the repository.