001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2007-2010 Sun Microsystems, Inc.
025 *      Portions Copyright 2014-2015 ForgeRock AS
026 */
027
028package org.opends.server.tools.dsreplication;
029
030import static org.opends.messages.AdminToolMessages.*;
031
032import org.forgerock.i18n.LocalizableMessage;
033
034/**
035 *
036 * The enumeration which defines the return code.
037 *
038 */
039public enum ReplicationCliReturnCode
040{
041  /** Successful. */
042  SUCCESSFUL(0, INFO_REPLICATION_SUCCESSFUL.get()),
043
044  /** Successful but no operation was performed. */
045  SUCCESSFUL_NOP(SUCCESSFUL.getReturnCode(),
046      INFO_REPLICATION_SUCCESSFUL_NOP.get()),
047
048  /** Unable to initialize arguments. */
049  CANNOT_INITIALIZE_ARGS(1, ERR_REPLICATION_NO_MESSAGE.get()),
050
051  /**
052   * Cannot parse arguments because the user provided arguments are not valid
053   * or there was an error checking the user data.
054   */
055  ERROR_USER_DATA(2, ERR_REPLICATION_NO_MESSAGE.get()),
056
057  /** The user canceled the operation in interactive mode. */
058  USER_CANCELLED(3, ERR_REPLICATION_USER_CANCELLED.get()),
059
060  /** Conflicting arguments. */
061  CONFLICTING_ARGS(4, ERR_REPLICATION_NO_MESSAGE.get()),
062
063  /** The provided base DNs cannot be used to enable replication. */
064  REPLICATION_CANNOT_BE_ENABLED_ON_BASEDN(5, ERR_REPLICATION_NO_MESSAGE.get()),
065
066  /** The provided base DNs cannot be used to disable replication. */
067  REPLICATION_CANNOT_BE_DISABLED_ON_BASEDN(6, ERR_REPLICATION_NO_MESSAGE.get()),
068
069  /**
070   * The provided base DNs cannot be used to initialize the contents of the
071   * replicas.
072   */
073  REPLICATION_CANNOT_BE_INITIALIZED_ON_BASEDN(7,
074      ERR_REPLICATION_NO_MESSAGE.get()),
075
076  /**
077   * Error connecting with the provided credentials.
078   */
079  ERROR_CONNECTING(8, ERR_REPLICATION_NO_MESSAGE.get()),
080
081  /**
082   * Could not find the replication ID of the domain to be used to initialize
083   * the replica.
084   */
085  REPLICATIONID_NOT_FOUND(9, ERR_REPLICATION_NO_MESSAGE.get()),
086
087  /**
088   * The number of tries we perform to start the initialization are over.
089   * We systematically receive a peer not found error.
090   */
091  INITIALIZING_TRIES_COMPLETED(10, ERR_REPLICATION_NO_MESSAGE.get()),
092
093  /** Error enabling replication on a base DN. */
094  ERROR_ENABLING_REPLICATION_ON_BASEDN(11, ERR_REPLICATION_NO_MESSAGE.get()),
095
096  /** Error initializing base DN. */
097  ERROR_INITIALIZING_BASEDN_GENERIC(12, ERR_REPLICATION_NO_MESSAGE.get()),
098
099  /** Error reading configuration. */
100  ERROR_READING_CONFIGURATION(13, ERR_REPLICATION_NO_MESSAGE.get()),
101
102  /** Error updating ADS. */
103  ERROR_UPDATING_ADS(14, ERR_REPLICATION_NO_MESSAGE.get()),
104
105  /** Error reading ADS. */
106  ERROR_READING_ADS(15, ERR_REPLICATION_NO_MESSAGE.get()),
107
108  /** Error reading TopologyCache. */
109  ERROR_READING_TOPOLOGY_CACHE(16, ERR_REPLICATION_NO_MESSAGE.get()),
110
111  /** Error configuring replication server. */
112  ERROR_CONFIGURING_REPLICATIONSERVER(17, ERR_REPLICATION_NO_MESSAGE.get()),
113
114  /** Unsupported ADS scenario. */
115  REPLICATION_ADS_MERGE_NOT_SUPPORTED(18, ERR_REPLICATION_NO_MESSAGE.get()),
116
117  /** Error disabling replication on base DN. */
118  ERROR_DISABLING_REPLICATION_ON_BASEDN(19, ERR_REPLICATION_NO_MESSAGE.get()),
119
120  /** Error removing replication port reference on base DN. */
121  ERROR_DISABLING_REPLICATION_REMOVE_REFERENCE_ON_BASEDN(20,
122      ERR_REPLICATION_NO_MESSAGE.get()),
123
124  /** Error initializing Administration Framework. */
125  ERROR_INITIALIZING_ADMINISTRATION_FRAMEWORK(21,
126      ERR_REPLICATION_NO_MESSAGE.get()),
127
128  /** Error seeding trustore. */
129  ERROR_SEEDING_TRUSTORE(22, ERR_REPLICATION_NO_MESSAGE.get()),
130
131  /** Error launching pre external initialization. */
132  ERROR_LAUNCHING_PRE_EXTERNAL_INITIALIZATION(23,
133      ERR_REPLICATION_NO_MESSAGE.get()),
134
135  /** Error launching pre external initialization. */
136  ERROR_LAUNCHING_POST_EXTERNAL_INITIALIZATION(24,
137      ERR_REPLICATION_NO_MESSAGE.get()),
138
139  /** Error disabling replication server. */
140  ERROR_DISABLING_REPLICATION_SERVER(25, ERR_REPLICATION_NO_MESSAGE.get()),
141
142  /** Error executing purge historical. */
143  ERROR_EXECUTING_PURGE_HISTORICAL(26,
144      ERR_REPLICATION_NO_MESSAGE.get()),
145
146  /** The provided base DNs cannot be purged. */
147  HISTORICAL_CANNOT_BE_PURGED_ON_BASEDN(27,
148      ERR_REPLICATION_NO_MESSAGE.get()),
149
150  /** Error launching purge historical. */
151  ERROR_LAUNCHING_PURGE_HISTORICAL(28,
152      ERR_REPLICATION_NO_MESSAGE.get()),
153
154  /** Error loading configuration class in local purge historical. */
155  ERROR_LOCAL_PURGE_HISTORICAL_CLASS_LOAD(29,
156         ERR_REPLICATION_NO_MESSAGE.get()),
157
158  /** Error starting server in local purge historical. */
159   ERROR_LOCAL_PURGE_HISTORICAL_SERVER_START(30,
160       ERR_REPLICATION_NO_MESSAGE.get()),
161
162  /** Timeout error in local purge historical. */
163  ERROR_LOCAL_PURGE_HISTORICAL_TIMEOUT(31,
164       ERR_REPLICATION_NO_MESSAGE.get()),
165
166  /** Generic error executing local purge historical. */
167  ERROR_LOCAL_PURGE_HISTORICAL_EXECUTING(32,
168      ERR_REPLICATION_NO_MESSAGE.get());
169
170
171  private LocalizableMessage message;
172  private int returnCode;
173
174  /** Private constructor. */
175  private ReplicationCliReturnCode(int returnCode, LocalizableMessage message)
176  {
177    this.returnCode = returnCode;
178    this.message = message;
179  }
180
181  /**
182   * Get the corresponding message.
183   *
184   * @return The corresponding message.
185   */
186  public LocalizableMessage getMessage()
187  {
188    return message;
189  }
190
191  /**
192   * Get the corresponding return code value.
193   *
194   * @return The corresponding return code value.
195   */
196  public int getReturnCode()
197  {
198    return returnCode;
199  }
200}