001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2007-2010 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.server.tools.dsreplication;
018
019import static org.opends.messages.AdminToolMessages.*;
020
021import org.forgerock.i18n.LocalizableMessage;
022
023/**
024 *
025 * The enumeration which defines the return code.
026 *
027 */
028public enum ReplicationCliReturnCode
029{
030  /** Successful. */
031  SUCCESSFUL(0, INFO_REPLICATION_SUCCESSFUL.get()),
032  /** Successful but no operation was performed. */
033  SUCCESSFUL_NOP(SUCCESSFUL.getReturnCode(), INFO_REPLICATION_SUCCESSFUL_NOP.get()),
034  /** Unable to initialize arguments. */
035  CANNOT_INITIALIZE_ARGS(1, ERR_REPLICATION_NO_MESSAGE.get()),
036  /**
037   * Cannot parse arguments because the user provided arguments are not valid
038   * or there was an error checking the user data.
039   */
040  ERROR_USER_DATA(2, ERR_REPLICATION_NO_MESSAGE.get()),
041  /** The user canceled the operation in interactive mode. */
042  USER_CANCELLED(3, ERR_REPLICATION_USER_CANCELLED.get()),
043  /** Conflicting arguments. */
044  CONFLICTING_ARGS(4, ERR_REPLICATION_NO_MESSAGE.get()),
045  /** The provided base DNs cannot be used to enable replication. */
046  REPLICATION_CANNOT_BE_ENABLED_ON_BASEDN(5, ERR_REPLICATION_NO_MESSAGE.get()),
047  /** The provided base DNs cannot be used to disable replication. */
048  REPLICATION_CANNOT_BE_DISABLED_ON_BASEDN(6, ERR_REPLICATION_NO_MESSAGE.get()),
049  /** The provided base DNs cannot be used to initialize the contents of the replicas. */
050  REPLICATION_CANNOT_BE_INITIALIZED_ON_BASEDN(7, ERR_REPLICATION_NO_MESSAGE.get()),
051  /** Error connecting with the provided credentials. */
052  ERROR_CONNECTING(8, ERR_REPLICATION_NO_MESSAGE.get()),
053  /** Could not find the replication ID of the domain to be used to initialize the replica. */
054  REPLICATIONID_NOT_FOUND(9, ERR_REPLICATION_NO_MESSAGE.get()),
055  /**
056   * The number of tries we perform to start the initialization are over.
057   * We systematically receive a peer not found error.
058   */
059  INITIALIZING_TRIES_COMPLETED(10, ERR_REPLICATION_NO_MESSAGE.get()),
060  /** Error enabling replication on a base DN. */
061  ERROR_ENABLING_REPLICATION_ON_BASEDN(11, ERR_REPLICATION_NO_MESSAGE.get()),
062  /** Error initializing base DN. */
063  ERROR_INITIALIZING_BASEDN_GENERIC(12, ERR_REPLICATION_NO_MESSAGE.get()),
064  /** Error reading configuration. */
065  ERROR_READING_CONFIGURATION(13, ERR_REPLICATION_NO_MESSAGE.get()),
066  /** Error updating ADS. */
067  ERROR_UPDATING_ADS(14, ERR_REPLICATION_NO_MESSAGE.get()),
068  /** Error reading ADS. */
069  ERROR_READING_ADS(15, ERR_REPLICATION_NO_MESSAGE.get()),
070  /** Error reading TopologyCache. */
071  ERROR_READING_TOPOLOGY_CACHE(16, ERR_REPLICATION_NO_MESSAGE.get()),
072  /** Error configuring replication server. */
073  ERROR_CONFIGURING_REPLICATIONSERVER(17, ERR_REPLICATION_NO_MESSAGE.get()),
074  /** Unsupported ADS scenario. */
075  REPLICATION_ADS_MERGE_NOT_SUPPORTED(18, ERR_REPLICATION_NO_MESSAGE.get()),
076  /** Error disabling replication on base DN. */
077  ERROR_DISABLING_REPLICATION_ON_BASEDN(19, ERR_REPLICATION_NO_MESSAGE.get()),
078  /** Error removing replication port reference on base DN. */
079  ERROR_DISABLING_REPLICATION_REMOVE_REFERENCE_ON_BASEDN(20, ERR_REPLICATION_NO_MESSAGE.get()),
080  /** Error initializing Administration Framework. */
081  ERROR_INITIALIZING_ADMINISTRATION_FRAMEWORK(21, ERR_REPLICATION_NO_MESSAGE.get()),
082  /** Error seeding trustore. */
083  ERROR_SEEDING_TRUSTORE(22, ERR_REPLICATION_NO_MESSAGE.get()),
084  /** Error launching pre external initialization. */
085  ERROR_LAUNCHING_PRE_EXTERNAL_INITIALIZATION(23, ERR_REPLICATION_NO_MESSAGE.get()),
086  /** Error launching pre external initialization. */
087  ERROR_LAUNCHING_POST_EXTERNAL_INITIALIZATION(24, ERR_REPLICATION_NO_MESSAGE.get()),
088  /** Error disabling replication server. */
089  ERROR_DISABLING_REPLICATION_SERVER(25, ERR_REPLICATION_NO_MESSAGE.get()),
090  /** Error executing purge historical. */
091  ERROR_EXECUTING_PURGE_HISTORICAL(26, ERR_REPLICATION_NO_MESSAGE.get()),
092  /** The provided base DNs cannot be purged. */
093  HISTORICAL_CANNOT_BE_PURGED_ON_BASEDN(27, ERR_REPLICATION_NO_MESSAGE.get()),
094  /** Error launching purge historical. */
095  ERROR_LAUNCHING_PURGE_HISTORICAL(28, ERR_REPLICATION_NO_MESSAGE.get()),
096  /**
097   * Error loading configuration class in local purge historical.
098   * @deprecated unused now
099   */
100  ERROR_LOCAL_PURGE_HISTORICAL_CLASS_LOAD(29, ERR_REPLICATION_NO_MESSAGE.get()),
101  /** Error starting server in local purge historical. */
102   ERROR_LOCAL_PURGE_HISTORICAL_SERVER_START(30, ERR_REPLICATION_NO_MESSAGE.get()),
103  /** Timeout error in local purge historical. */
104  ERROR_LOCAL_PURGE_HISTORICAL_TIMEOUT(31, ERR_REPLICATION_NO_MESSAGE.get()),
105  /** Generic error executing local purge historical. */
106  ERROR_LOCAL_PURGE_HISTORICAL_EXECUTING(32, ERR_REPLICATION_NO_MESSAGE.get()),
107  /** Change number does not exists. */
108  ERROR_UNKNOWN_CHANGE_NUMBER(33, ERR_REPLICATION_NO_MESSAGE.get()),
109  /** Error launching reset change number task. */
110  ERROR_LAUNCHING_RESET_CHANGE_NUMBER(34, ERR_REPLICATION_NO_MESSAGE.get()),
111  /** CSN for a given change is not present. */
112  ERROR_RESET_CHANGE_NUMBER_NO_CSN(35, ERR_REPLICATION_NO_MESSAGE.get()),
113  /** Exception from lower layers. */
114  ERROR_RESET_CHANGE_NUMBER_PROBLEM(36, ERR_REPLICATION_NO_MESSAGE.get()),
115  /** Target DN for change could not be computed. */
116  ERROR_RESET_CHANGE_NUMBER_UNKNOWN_BASEDN(37, ERR_REPLICATION_NO_MESSAGE.get()),
117  /** Server configuration differs, base DNs are different. */
118  ERROR_RESET_CHANGE_NUMBER_BASEDNS_SHOULD_EQUAL(38, ERR_REPLICATION_NO_MESSAGE.get());
119
120  private LocalizableMessage message;
121  private int returnCode;
122
123  /** Private constructor. */
124  private ReplicationCliReturnCode(int returnCode, LocalizableMessage message)
125  {
126    this.returnCode = returnCode;
127    this.message = message;
128  }
129
130  /**
131   * Get the corresponding message.
132   *
133   * @return The corresponding message.
134   */
135  public LocalizableMessage getMessage()
136  {
137    return message;
138  }
139
140  /**
141   * Get the corresponding return code value.
142   *
143   * @return The corresponding return code value.
144   */
145  public int getReturnCode()
146  {
147    return returnCode;
148  }
149}