| | |
| | | */ |
| | | package org.opends.server.tasks; |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.TaskMessages; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.core.DirectoryServer.getAttributeType; |
| | |
| | | private File backupDirectory; |
| | | private String incrementalBase; |
| | | |
| | | private BackupConfig backupConfig; |
| | | |
| | | /** |
| | | * All the backend configuration entries defined in the server mapped |
| | | * by their backend ID. |
| | |
| | | |
| | | |
| | | // Create a backup configuration. |
| | | BackupConfig backupConfig = new BackupConfig(backupDir, backupID, |
| | | backupConfig = new BackupConfig(backupDir, backupID, |
| | | incremental); |
| | | backupConfig.setCompressData(compress); |
| | | backupConfig.setEncryptData(encrypt); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void interruptTask(TaskState interruptState, Message interruptReason) |
| | | { |
| | | if (TaskState.STOPPED_BY_ADMINISTRATOR.equals(interruptState) && |
| | | backupConfig != null) |
| | | { |
| | | addLogMessage(TaskMessages.INFO_TASK_STOPPED_BY_ADMIN.get( |
| | | interruptReason)); |
| | | setTaskInterruptState(interruptState); |
| | | backupConfig.cancel(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isInterruptable() { |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected TaskState runTask() |
| | | { |
| | | if (!argumentsAreValid()) |
| | |
| | | boolean errorsEncountered = false; |
| | | for (Backend b : backendsToArchive) |
| | | { |
| | | if (isCancelled()) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | // Acquire a shared lock for this backend. |
| | | if (!lockBackend(b)) |
| | | { |
| | |
| | | logError(message); |
| | | return TaskState.COMPLETED_WITH_ERRORS; |
| | | } |
| | | else if (isCancelled()) |
| | | { |
| | | Message message = NOTE_BACKUPDB_CANCELLED.get(); |
| | | logError(message); |
| | | return getTaskInterruptState(); |
| | | } |
| | | else |
| | | { |
| | | Message message = NOTE_BACKUPDB_COMPLETED_SUCCESSFULLY.get(); |