com.jalios.jcms.fileprocessor.repository
Class RepositoryManager

java.lang.Object
  extended by 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.

Version:
$Revision: 47975 $

Field Summary
static String JCMS_UPLOAD_REPOSITORY
           
static String REVISION
           
 
Method Summary
 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 executeNextAlarmNow(String id)
          Execute now, in a specific thread (not in the current thread) the AlarmListener
static RepositoryManager getInstance()
          The first time, instanciate the RepositoryManager.
 Date getNextScanDate(String id)
          Returns the date of the next call to the AlarmListener scheduled.
 Collection<Repository> getRepositories()
          Gives the collection of RepositoryConfiguration registered in the manager.
 Repository getRepository(String id)
          Gives the RepositoryConfiguration mapped with this id.
 boolean isLaunched(String id)
          We store in memory the information that a repository is stored.
 boolean launchRepository(String id)
          Launch a repository if not.
 Repository removeRepository(String id)
          Stops, removes and returns the repository mapped to this id off from the manager.
 boolean stopRepository(String id)
          Stops the treatment if needed and checkout the AlarmEntry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

JCMS_UPLOAD_REPOSITORY

public static final 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 : 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.

executeNextAlarmNow

public boolean executeNextAlarmNow(String id)
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.

Parameters:
id - The id of the repository
Returns:
the date of the next call to the scan of the repository.


Copyright © 2001-2010 Jalios SA. All Rights Reserved.