Class MaintenanceTaskManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.workspaces.repository.maintenance.MaintenanceTaskManager
-
- All Implemented Interfaces:
Component,Contextualizable,LogEnabled,Serviceable
- Direct Known Subclasses:
MaintenanceTaskManager
public class MaintenanceTaskManager extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
The MaintenanceTaskManager Component
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMaintenanceTaskManager.MaintenanceTaskTypeTask types
-
Field Summary
Fields Modifier and Type Field Description private Context_contextprivate ExecutorService_executorprivate FutureTask<Void>_futureprotected static MaintenanceTaskManager.MaintenanceTaskType_lastRunningTaskTypeThe maintenance running taskprivate RepositoryProvider_repositoryProviderThe repository provider.private boolean_repositoryShutdownprotected static AbstractMaintenanceTask_runningTaskThe maintenance running taskprotected MaintenanceTaskManager.MaintenanceTaskType_runningTaskTypeThe maintenance running task typeprotected SystemStatus_systemStatusSystem status providerstatic StringMAINTENANCE_TASK_ENDEDThe maintenance task ended system statusstatic StringMAINTENANCE_TASK_RUNNINGThe maintenance task running system statusstatic StringREPOSITORY_UNAVAILABLEThe repository unavailable system statusstatic StringROLEThe avalon role.
-
Constructor Summary
Constructors Constructor Description MaintenanceTaskManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractMaintenanceTask_createTask(MaintenanceTaskManager.MaintenanceTaskType type)Initialize the tasks.private RepositoryConfig_getRepositoryConfig()voidcontextualize(Context context)StringgetLastRunningTaskType()Retrieves the type of the previous running task, if no task is currently running.Map<String,Object>getProgressInfo()Get progress information.StringgetRunningTaskType()Retrieves the type of the running taskbooleanisJndi()Determines if the repository is obtained through JNDIbooleanisRepositoryStarted()Indicates is the Ametys repository is started or has been shut down.booleanisTaskRunning()Indicates if a maintenance task is running.booleanlaunch(MaintenanceTaskManager.MaintenanceTaskType type)Launch a maintenance taskprivate voidrun(MaintenanceTaskManager.MaintenanceTaskType type)voidservice(ServiceManager manager)protected voidshutdownRepository()Shutdown the Ametys repository instance-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
REPOSITORY_UNAVAILABLE
public static final String REPOSITORY_UNAVAILABLE
The repository unavailable system status- See Also:
- Constant Field Values
-
MAINTENANCE_TASK_RUNNING
public static final String MAINTENANCE_TASK_RUNNING
The maintenance task running system status- See Also:
- Constant Field Values
-
MAINTENANCE_TASK_ENDED
public static final String MAINTENANCE_TASK_ENDED
The maintenance task ended system status- See Also:
- Constant Field Values
-
_runningTask
protected static AbstractMaintenanceTask _runningTask
The maintenance running task
-
_lastRunningTaskType
protected static MaintenanceTaskManager.MaintenanceTaskType _lastRunningTaskType
The maintenance running task
-
_runningTaskType
protected MaintenanceTaskManager.MaintenanceTaskType _runningTaskType
The maintenance running task type
-
_systemStatus
protected SystemStatus _systemStatus
System status provider
-
_repositoryProvider
private RepositoryProvider _repositoryProvider
The repository provider.
-
_executor
private final ExecutorService _executor
-
_future
private FutureTask<Void> _future
-
_repositoryShutdown
private boolean _repositoryShutdown
-
-
Constructor Detail
-
MaintenanceTaskManager
public MaintenanceTaskManager()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
launch
public boolean launch(MaintenanceTaskManager.MaintenanceTaskType type)
Launch a maintenance task- Parameters:
type- The maintenance task type- Returns:
- true if a task has been launched
-
run
private void run(MaintenanceTaskManager.MaintenanceTaskType type) throws ConfigurationException, RepositoryException
-
isJndi
public boolean isJndi()
Determines if the repository is obtained through JNDI- Returns:
- true if the repository is obtained through JNDI
-
shutdownRepository
protected void shutdownRepository() throws RepositoryException
Shutdown the Ametys repository instance- Throws:
RepositoryException- If the repository cannot be shutdown
-
_getRepositoryConfig
private RepositoryConfig _getRepositoryConfig() throws ConfigurationException
- Throws:
ConfigurationException
-
_createTask
protected AbstractMaintenanceTask _createTask(MaintenanceTaskManager.MaintenanceTaskType type) throws RepositoryException
Initialize the tasks.- Parameters:
type- MaintenanceTaskType- Returns:
- the task.
- Throws:
RepositoryException- If an error occurs during the task creation
-
isTaskRunning
public boolean isTaskRunning()
Indicates if a maintenance task is running.- Returns:
- true if a task is running.
-
getProgressInfo
public Map<String,Object> getProgressInfo()
Get progress information.- Returns:
- a map containing information on the progress status.
-
getRunningTaskType
public String getRunningTaskType()
Retrieves the type of the running task- Returns:
- the type of the running task or null.
-
getLastRunningTaskType
public String getLastRunningTaskType()
Retrieves the type of the previous running task, if no task is currently running. Otherwise, the current task type will be return.- Returns:
- the type or null
-
isRepositoryStarted
public boolean isRepositoryStarted()
Indicates is the Ametys repository is started or has been shut down.- Returns:
- true is the repository is started
-
-