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