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 class
MaintenanceTaskManager.MaintenanceTaskType
Task types
-
Field Summary
Fields Modifier and Type Field Description protected static MaintenanceTaskManager.MaintenanceTaskType
_lastRunningTaskType
The maintenance running taskprotected static AbstractMaintenanceTask
_runningTask
The maintenance running taskprotected MaintenanceTaskManager.MaintenanceTaskType
_runningTaskType
The maintenance running task typeprotected SystemStatus
_systemStatus
System status providerstatic String
MAINTENANCE_TASK_ENDED
The maintenance task ended system statusstatic String
MAINTENANCE_TASK_RUNNING
The maintenance task running system statusstatic String
REPOSITORY_UNAVAILABLE
The repository unavailable system statusstatic String
ROLE
The 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.void
contextualize(Context context)
String
getLastRunningTaskType()
Retrieves the type of the previous running task, if no task is currently running.Map<String,Object>
getProgressInfo()
Get progress information.String
getRunningTaskType()
Retrieves the type of the running taskboolean
isJndi()
Determines if the repository is obtained through JNDIboolean
isRepositoryStarted()
Indicates is the Ametys repository is started or has been shut down.boolean
isTaskRunning()
Indicates if a maintenance task is running.boolean
launch(MaintenanceTaskManager.MaintenanceTaskType type)
Launch a maintenance taskvoid
service(ServiceManager manager)
protected void
shutdownRepository()
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
-
-
Constructor Detail
-
MaintenanceTaskManager
public MaintenanceTaskManager()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in 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
-
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
-
_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
-
-