public abstract class AbstractMaintenanceTask extends Object implements LogEnabled
Modifier and Type | Field and Description |
---|---|
private boolean |
_isFinished |
protected Logger |
_logger
Logger for traces
|
protected TaskProgress |
_progress
TaskProgress
|
protected RepositoryConfig |
_repositoryConfig
The repository config
|
protected RepositoryProvider |
_repositoryProvider
The repository provider.
|
Constructor and Description |
---|
AbstractMaintenanceTask() |
Modifier and Type | Method and Description |
---|---|
protected String |
_getFormattedDuration(long elapsedTime)
Transforms millisecond to a formatted string representing a duration.
|
protected abstract void |
apply()
Apply the tasks (within the execute method()).
|
protected void |
close()
Close the tasks
|
void |
execute(RepositoryConfig repositoryConfig)
Execute the task
|
Map<String,Object> |
getProgressInfo()
Get progress information.
|
protected void |
initialize()
Initialize the tasks.
|
boolean |
isFinished()
Is the execution of the task finished?
|
private void |
setFinished() |
private void |
setInErrorState(Exception e) |
protected abstract void |
setLogger()
Set the tasks logger.
|
void |
setLogger(Logger logger)
Called at creation time to provide a
Logger . |
private void |
setRunning() |
protected TaskProgress _progress
protected RepositoryConfig _repositoryConfig
protected RepositoryProvider _repositoryProvider
private boolean _isFinished
public AbstractMaintenanceTask()
public void execute(RepositoryConfig repositoryConfig) throws RepositoryException
repositoryConfig
- The RepositoryConfig object, used to create new Repository instance.RepositoryException
- If an error with the repository occurs while the task is executed.protected void initialize() throws RepositoryException
TaskProgress
object bounded to the task.RepositoryException
- If a repository exceptionprotected abstract void setLogger()
public void setLogger(Logger logger)
LogEnabled
Logger
.setLogger
in interface LogEnabled
logger
- a Logger
for messages.protected abstract void apply() throws RepositoryException
RepositoryException
- If a repository exceptionprotected void close() throws RepositoryException
RepositoryException
- If a repository exceptionpublic Map<String,Object> getProgressInfo()
public boolean isFinished()
private void setRunning()
private void setFinished()
private void setInErrorState(Exception e)
protected String _getFormattedDuration(long elapsedTime)
elapsedTime
- milleseconds corresponding to the duration.