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