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 2008-2009 Sun Microsystems, Inc. 025 * Portions Copyright 2013-2015 ForgeRock AS. 026 */ 027 028package org.opends.quicksetup; 029 030/** 031 * This class defines enumeration of application return code. 032 */ 033public class ReturnCode { 034 035 /** 036 * Return code: Application successful. 037 */ 038 public static final ReturnCode SUCCESSFUL = new ReturnCode(0); 039 040 /** 041 * Return code: User Cancelled operation. 042 */ 043 public static final ReturnCode CANCELED = new ReturnCode(0); 044 045 /** 046 * Return code: User provided invalid data. 047 */ 048 public static final ReturnCode USER_DATA_ERROR = new ReturnCode(2); 049 050 /** 051 * Return code: Error accessing file system (reading/writing). 052 */ 053 public static final ReturnCode FILE_SYSTEM_ACCESS_ERROR = new ReturnCode(3); 054 055 /** 056 * Error during the configuration of the Directory Server. 057 */ 058 public static final ReturnCode CONFIGURATION_ERROR = new ReturnCode(5); 059 060 /** 061 * Error during the import of data (base entry, from LDIF file or 062 * automatically generated data). 063 */ 064 065 public static final ReturnCode IMPORT_ERROR = new ReturnCode(6); 066 067 /** 068 * Error starting the Open DS server. 069 */ 070 public static final ReturnCode START_ERROR = new ReturnCode(7); 071 072 /** 073 * Error stopping the Open DS server. 074 */ 075 public static final ReturnCode STOP_ERROR = new ReturnCode(8); 076 077 /** 078 * Error enabling the Windows service. 079 */ 080 public static final ReturnCode WINDOWS_SERVICE_ERROR = new ReturnCode(9); 081 082 /** 083 * Application specific error. 084 */ 085 public static final ReturnCode APPLICATION_ERROR = new ReturnCode(10); 086 087 /** 088 * Error invoking an OpenDS tool. 089 */ 090 public static final ReturnCode TOOL_ERROR = new ReturnCode(11); 091 092 /** 093 * Return code: Bug. 094 */ 095 public static final ReturnCode BUG = new ReturnCode(12); 096 097 /** 098 * Return code: java version non-compatible. 099 */ 100 public static final ReturnCode JAVA_VERSION_INCOMPATIBLE = new ReturnCode(13); 101 102 /** 103 * Return code: user provided invalid input. 104 */ 105 public static final ReturnCode USER_INPUT_ERROR = new ReturnCode(14); 106 107 /** 108 * Return code: Print Version. 109 */ 110 public static final ReturnCode PRINT_VERSION = new ReturnCode(50); 111 112 /** 113 * Return code for errors that are non-specified. 114 */ 115 public static final ReturnCode UNKNOWN = new ReturnCode(100); 116 117 118 private int code; 119 120 /** 121 * Creates a new parametrized instance. 122 * 123 * @param code to return 124 */ 125 public ReturnCode(int code) { 126 this.code = code; 127 } 128 129 /** 130 * Gets the return code to return to the console. 131 * 132 * @return int code 133 */ 134 public int getReturnCode() { 135 return code; 136 } 137 138}