| File was renamed from opendj-sdk/opends/src/server/org/opends/server/tasks/InitializeTargetTask.java |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tasks; |
| | | package org.opends.server.replication.service; |
| | | import org.opends.server.tasks.TaskUtils; |
| | | |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | |
| | | |
| | | import org.opends.server.backends.task.Task; |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.replication.plugin.ReplicationDomain; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | |
| | | |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | /** |
| | | * This class provides an implementation of a Directory Server task that can |
| | | * be used to import data from an LDIF file into a backend. |
| | |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | // Config properties |
| | | boolean append = false; |
| | | boolean isCompressed = false; |
| | | boolean isEncrypted = false; |
| | | boolean skipSchemaValidation = false; |
| | | String domainString = null; |
| | | ReplicationDomain domain = null; |
| | | short target; |
| | | long total; |
| | | long left; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getDisplayName() { |
| | | return TaskMessages.INFO_TASK_INITIALIZE_TARGET_NAME.get(); |
| | | } |
| | | private String domainString = null; |
| | | private ReplicationDomain domain = null; |
| | | private short target; |
| | | private long total; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | DN domainDN = DN.nullDN(); |
| | | try |
| | | { |
| | | domainDN = DN.decode(domainString); |
| | | domain = ReplicationDomain.retrievesReplicationDomain(domainString); |
| | | } |
| | | catch(Exception e) |
| | | catch(DirectoryException e) |
| | | { |
| | | MessageBuilder mb = new MessageBuilder(); |
| | | mb.append(TaskMessages.ERR_TASK_INITIALIZE_INVALID_DN.get()); |
| | | mb.append(e.getLocalizedMessage()); |
| | | throw new DirectoryException(ResultCode.INVALID_DN_SYNTAX, |
| | | mb.toMessage()); |
| | | mb.append(e.getMessage()); |
| | | throw new DirectoryException(ResultCode.INVALID_DN_SYNTAX, e); |
| | | } |
| | | domain=ReplicationDomain.retrievesReplicationDomain(domainDN); |
| | | |
| | | attrList = taskEntry.getAttribute(typeScope); |
| | | String targetString = TaskUtils.getSingleValueString(attrList); |
| | |
| | | */ |
| | | public void setLeft(long left) throws DirectoryException |
| | | { |
| | | this.left = left; |
| | | replaceAttributeValue(ATTR_TASK_INITIALIZE_LEFT, String.valueOf(left)); |
| | | replaceAttributeValue(ATTR_TASK_INITIALIZE_DONE,String.valueOf(total-left)); |
| | | } |