Class RepositoryManager
- java.lang.Object
-
- com.jalios.jcms.fileprocessor.repository.RepositoryManager
-
public class RepositoryManager extends java.lang.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.- Version:
- $Revision: 101220 $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JCMS_UPLOAD_REPOSITORY
static java.lang.String
REVISION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.boolean
executeNextPostponedAlarmNow(java.lang.String id)
Execute now, in a specific thread (not in the current thread) the AlarmListener used to process postponed item.boolean
executeNextScanAlarmNow(java.lang.String id)
Execute now, in a specific thread (not in the current thread) the AlarmListener used to trigger directory scanning.static RepositoryManager
getInstance()
The first time, instanciate the RepositoryManager.java.util.Date
getNextPostponedProcessingDate(java.lang.String id)
Returns the date of the next call to the AlarmListener scheduled for postponed item processing.java.util.Date
getNextScanDate(java.lang.String id)
Returns the date of the next call to the AlarmListener scheduled for directory scanningjava.util.Collection<Repository>
getRepositories()
Gives the collection of RepositoryConfiguration registered in the manager.Repository
getRepository(java.lang.String id)
Gives the RepositoryConfiguration mapped with this id.boolean
isLaunched(java.lang.String id)
We store in memory the information that a repository is stored.boolean
launchRepository(java.lang.String id)
Launch a repository if not.Repository
removeRepository(java.lang.String id)
Stops, removes and returns the repository mapped to this id off from the manager.boolean
stopRepository(java.lang.String id)
Stops the treatment if needed and checkout the AlarmEntry.
-
-
-
Field Detail
-
REVISION
public static final java.lang.String REVISION
- See Also:
- Constant Field Values
-
JCMS_UPLOAD_REPOSITORY
public static final java.lang.String JCMS_UPLOAD_REPOSITORY
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.
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(java.lang.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(java.lang.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 java.util.Collection<Repository> getRepositories()
Gives the collection of RepositoryConfiguration registered in the manager.- Returns:
- the collection of repositories.
-
isLaunched
public boolean isLaunched(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.util.Date getNextScanDate(java.lang.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 java.util.Date getNextPostponedProcessingDate(java.lang.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.
-
-