| | |
| | | import org.opends.server.api.SynchronizationProvider; |
| | | import org.opends.server.backends.jeb.BackendImpl; |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Update the state of the task. |
| | | */ |
| | | protected TaskState updateTaskCompletionState() |
| | | { |
| | | if (exception == null) |
| | | return TaskState.COMPLETED_SUCCESSFULLY; |
| | | else |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | // Update the task that initiated the import |
| | | ((InitializeTask)ieContext.initializeTask). |
| | | setState(ieContext.updateTaskCompletionState(),ieContext.exception); |
| | | updateTaskCompletionState(ieContext.exception); |
| | | |
| | | releaseIEContext(); |
| | | } |
| | |
| | | |
| | | Backend backend = retrievesBackend(baseDN); |
| | | |
| | | try |
| | | { |
| | | if (!backend.supportsLDIFImport()) |
| | | { |
| | | Message message = ERR_INIT_IMPORT_NOT_SUPPORTED.get( |
| | | backend.getBackendID().toString()); |
| | | logError(message); |
| | | throw new DirectoryException(ResultCode.OTHER, message); |
| | | de = new DirectoryException(ResultCode.OTHER, message); |
| | | } |
| | | |
| | | try |
| | | else |
| | | { |
| | | if (initializeMessage.getRequestorID() == serverId) |
| | | { |
| | |
| | | TRACER.debugInfo("The import has ended successfully on " + |
| | | this.baseDN); |
| | | stateSavingDisabled = false; |
| | | |
| | | } |
| | | } |
| | | catch(Exception e) |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | if ((ieContext != null) && (ieContext.exception != null)) |
| | | de = ieContext.exception; |
| | | |
| | | // Cleanup |
| | | if (importConfig != null) |
| | | { |
| | | importConfig.close(); |
| | | |
| | | // Re-enable backend |
| | | closeBackendImport(backend); |
| | | } |
| | | |
| | | // Update the task that initiated the import |
| | | if ((ieContext != null ) && (ieContext.initializeTask != null)) |
| | | { |
| | | ((InitializeTask)ieContext.initializeTask). |
| | | setState(ieContext.updateTaskCompletionState(),ieContext.exception); |
| | | updateTaskCompletionState(de); |
| | | } |
| | | releaseIEContext(); |
| | | |
| | | } |
| | | // Sends up the root error. |
| | | if (de != null) |
| | | { |
| | | throw de; |
| | | } |
| | | else |
| | | { |
| | | // Retrieves the generation ID associated with the data imported |
| | | try |
| | | { |
| | |
| | | // Re-exchange generationID and state with RS |
| | | broker.reStart(); |
| | | } |
| | | // Sends up the root error. |
| | | if (de != null) |
| | | throw de; |
| | | } |
| | | |
| | | /** |