| | |
| | | import static org.opends.server.messages.TaskMessages.*; |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | |
| | | */ |
| | | public class ImportTask extends Task |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.tasks.ImportTask"; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override public void initializeTask() throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeTask"); |
| | | |
| | | |
| | | // If the client connection is available, then make sure the associated |
| | |
| | | */ |
| | | protected TaskState runTask() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "runTask"); |
| | | |
| | | // See if there were any user-defined sets of include/exclude attributes or |
| | | // filters. If so, then process them. |
| | |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "runTask", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | e.getErrorMessage(), e.getErrorMessageID()); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "runTask", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_LOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | assert debugException(CLASS_NAME, "runTask", de); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, de); |
| | | } |
| | | |
| | | int msgID = MSGID_LDIFIMPORT_ERROR_DURING_IMPORT; |
| | | String message = getMessage(msgID, de.getErrorMessage()); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "runTask", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_LDIFIMPORT_ERROR_DURING_IMPORT; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "runTask", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_LDIFIMPORT_CANNOT_UNLOCK_BACKEND; |
| | | String message = getMessage(msgID, backend.getBackendID(), |
| | |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "runTask", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, |
| | | e.getErrorMessage(), e.getErrorMessageID()); |