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
Modifier and TypeClassDescriptionstatic enum
Task types -
Field Summary
Modifier and TypeFieldDescriptionprotected static MaintenanceTaskManager.MaintenanceTaskType
The maintenance running taskprotected RepositoryProvider
The repository provider.protected static AbstractMaintenanceTask
The maintenance running taskThe maintenance running task typeprotected SystemStatus
System status providerstatic final String
The maintenance task ended system statusstatic final String
The maintenance task running system statusstatic final String
The repository unavailable system statusstatic final String
The avalon role. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected RepositoryConfig
Create a repository configprotected AbstractMaintenanceTask
Initialize the tasks.protected Pair<RepositoryConfig,
RepositoryContext> Retrieve the repository config if no repository is available or the repository context of the available repositoryvoid
contextualize
(Context context) Retrieves the type of the previous running task, if no task is currently running.Get progress information.Retrieves the type of the running taskboolean
Indicates is the Ametys repository is started or has been shut down.boolean
Indicates if a maintenance task is running.boolean
Launch a maintenance taskvoid
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The avalon role. -
REPOSITORY_UNAVAILABLE
The repository unavailable system status- See Also:
-
MAINTENANCE_TASK_RUNNING
The maintenance task running system status- See Also:
-
MAINTENANCE_TASK_ENDED
The maintenance task ended system status- See Also:
-
_runningTask
The maintenance running task -
_lastRunningTaskType
The maintenance running task -
_runningTaskType
The maintenance running task type -
_systemStatus
System status provider -
_repositoryProvider
The repository provider.
-
-
Constructor Details
-
MaintenanceTaskManager
public MaintenanceTaskManager()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
launch
Launch a maintenance task- Parameters:
type
- The maintenance task type- Returns:
- true if a task has been launched
- Throws:
Exception
- when an error occurred
-
_getRepositoryInfo
protected Pair<RepositoryConfig,RepositoryContext> _getRepositoryInfo() throws ConfigurationException, javax.jcr.UnsupportedRepositoryOperationExceptionRetrieve the repository config if no repository is available or the repository context of the available repository- Returns:
- Either the config or the context depending if the repository is available. The other one will be null.
- Throws:
ConfigurationException
- if an error occurred while generating the configjavax.jcr.UnsupportedRepositoryOperationException
- if the repository doesn't support retrieving the context
-
_createRepositoryConfig
Create a repository config- Returns:
- the repository config
- Throws:
ConfigurationException
- if an error occurred
-
_createTask
Initialize the tasks.- Parameters:
type
- MaintenanceTaskType- Returns:
- the task.
-
isTaskRunning
Indicates if a maintenance task is running.- Returns:
- true if a task is running.
-
getProgressInfo
Get progress information.- Returns:
- a map containing information on the progress status.
-
getRunningTaskType
Retrieves the type of the running task- Returns:
- the type of the running task or null.
-
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
Indicates is the Ametys repository is started or has been shut down.- Returns:
- true is the repository is started
-