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