public class MaintenanceTaskManager extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
Modifier and Type | Class and Description |
---|---|
static class |
MaintenanceTaskManager.MaintenanceTaskType
Task types
|
Modifier and Type | Field and Description |
---|---|
private Context |
_context |
private ExecutorService |
_executor |
private FutureTask<Void> |
_future |
protected static MaintenanceTaskManager.MaintenanceTaskType |
_lastRunningTaskType
The maintenance running task
|
private RepositoryProvider |
_repositoryProvider
The repository provider.
|
private boolean |
_repositoryShutdown |
protected static AbstractMaintenanceTask |
_runningTask
The maintenance running task
|
protected MaintenanceTaskManager.MaintenanceTaskType |
_runningTaskType
The maintenance running task type
|
protected SystemStatus |
_systemStatus
System status provider
|
static String |
MAINTENANCE_TASK_ENDED
The maintenance task ended system status
|
static String |
MAINTENANCE_TASK_RUNNING
The maintenance task running system status
|
static String |
REPOSITORY_UNAVAILABLE
The repository unavailable system status
|
static String |
ROLE
The avalon role.
|
Constructor and Description |
---|
MaintenanceTaskManager() |
Modifier and Type | Method and Description |
---|---|
protected AbstractMaintenanceTask |
_createTask(MaintenanceTaskManager.MaintenanceTaskType type)
Initialize the tasks.
|
private RepositoryConfig |
_getRepositoryConfig() |
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 task
|
boolean |
isJndi()
Determines if the repository is obtained through JNDI
|
boolean |
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 task
|
private void |
run(MaintenanceTaskManager.MaintenanceTaskType type) |
void |
service(ServiceManager manager) |
protected void |
shutdownRepository()
Shutdown the Ametys repository instance
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
public static final String REPOSITORY_UNAVAILABLE
public static final String MAINTENANCE_TASK_RUNNING
public static final String MAINTENANCE_TASK_ENDED
protected static AbstractMaintenanceTask _runningTask
protected static MaintenanceTaskManager.MaintenanceTaskType _lastRunningTaskType
protected MaintenanceTaskManager.MaintenanceTaskType _runningTaskType
protected SystemStatus _systemStatus
private RepositoryProvider _repositoryProvider
private final ExecutorService _executor
private FutureTask<Void> _future
private boolean _repositoryShutdown
public MaintenanceTaskManager()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public boolean launch(MaintenanceTaskManager.MaintenanceTaskType type)
type
- The maintenance task typeprivate void run(MaintenanceTaskManager.MaintenanceTaskType type) throws ConfigurationException, RepositoryException
public boolean isJndi()
protected void shutdownRepository() throws RepositoryException
RepositoryException
- If the repository cannot be shutdownprivate RepositoryConfig _getRepositoryConfig() throws ConfigurationException
ConfigurationException
protected AbstractMaintenanceTask _createTask(MaintenanceTaskManager.MaintenanceTaskType type) throws RepositoryException
type
- MaintenanceTaskTypeRepositoryException
- If an error occurs during the task creationpublic boolean isTaskRunning()
public Map<String,Object> getProgressInfo()
public String getRunningTaskType()
public String getLastRunningTaskType()
public boolean isRepositoryStarted()