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 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 downloading jar files from web start server.  This is specific
057   * to the web start installation.
058   */
059  public static final ReturnCode DOWNLOAD_ERROR = new ReturnCode(4);
060
061  /**
062   * Error during the configuration of the Directory Server.
063   */
064  public static final ReturnCode CONFIGURATION_ERROR = new ReturnCode(5);
065
066  /**
067   * Error during the import of data (base entry, from LDIF file or
068   * automatically generated data).
069   */
070
071  public static final ReturnCode IMPORT_ERROR = new ReturnCode(6);
072
073  /**
074   * Error starting the Open DS server.
075   */
076  public static final ReturnCode START_ERROR = new ReturnCode(7);
077
078  /**
079   * Error stopping the Open DS server.
080   */
081  public static final ReturnCode STOP_ERROR = new ReturnCode(8);
082
083  /**
084   * Error enabling the Windows service.
085   */
086  public static final ReturnCode WINDOWS_SERVICE_ERROR = new ReturnCode(9);
087
088  /**
089   * Application specific error.
090   */
091  public static final ReturnCode APPLICATION_ERROR = new ReturnCode(10);
092
093  /**
094   * Error invoking an OpenDS tool.
095   */
096  public static final ReturnCode TOOL_ERROR = new ReturnCode(11);
097
098  /**
099   * Return code: Bug.
100   */
101  public static final ReturnCode BUG = new ReturnCode(12);
102
103  /**
104   * Return code: java version non-compatible.
105   */
106  public static final ReturnCode JAVA_VERSION_INCOMPATIBLE = new ReturnCode(13);
107
108  /**
109   * Return code: user provided invalid input.
110   */
111  public static final ReturnCode USER_INPUT_ERROR = new ReturnCode(14);
112
113  /**
114   * Return code: Print Version.
115   */
116  public static final ReturnCode PRINT_VERSION = new ReturnCode(50);
117
118  /**
119   * Return code for errors that are non-specified.
120   */
121  public static final ReturnCode UNKNOWN = new ReturnCode(100);
122
123
124  private int code;
125
126  /**
127   * Creates a new parametrized instance.
128   *
129   * @param code to return
130   */
131  public ReturnCode(int code) {
132    this.code = code;
133  }
134
135  /**
136   * Gets the return code to return to the console.
137   *
138   * @return int code
139   */
140  public int getReturnCode() {
141    return code;
142  }
143
144}