001 /*
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
005 *
006 * The contents of this file are subject to the terms of either the GNU
007 * General Public License Version 2 only ("GPL") or the Common Development
008 * and Distribution License("CDDL") (collectively, the "License"). You
009 * may not use this file except in compliance with the License. You can
010 * obtain a copy of the License at
011 * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
012 * or packager/legal/LICENSE.txt. See the License for the specific
013 * language governing permissions and limitations under the License.
014 *
015 * When distributing the software, include this License Header Notice in each
016 * file and include the License file at packager/legal/LICENSE.txt.
017 *
018 * GPL Classpath Exception:
019 * Oracle designates this particular file as subject to the "Classpath"
020 * exception as provided by Oracle in the GPL Version 2 section of the License
021 * file that accompanied this code.
022 *
023 * Modifications:
024 * If applicable, add the following below the License Header, with the fields
025 * enclosed by brackets [] replaced by your own identifying information:
026 * "Portions Copyright [year] [name of copyright owner]"
027 *
028 * Contributor(s):
029 * If you wish your version of this file to be governed by only the CDDL or
030 * only the GPL Version 2, indicate your decision by adding "[Contributor]
031 * elects to include this software in this distribution under the [CDDL or GPL
032 * Version 2] license." If you don't indicate a single choice of license, a
033 * recipient has the option to distribute your version of this file under
034 * either the CDDL, the GPL Version 2 or to extend the choice of license to
035 * its licensees as provided above. However, if you add GPL Version 2 code
036 * and therefore, elected the GPL Version 2 license, then the option applies
037 * only if the new code is made subject to such option by the copyright
038 * holder.
039 */
040
041 package com.sun.enterprise.admin.cli;
042
043 /**
044 * Constants for use in this package and "sub" packages
045 * @author bnevins
046 */
047 public class CLIConstants {
048 ////////////////////////////////////////////////////////////////////////////
049 /////// public /////////////////////////////////////
050 ////////////////////////////////////////////////////////////////////////////
051 public static final int DEFAULT_ADMIN_PORT = 4848;
052 public static final String DEFAULT_HOSTNAME = "localhost";
053 public static final String EOL = System.getProperty("line.separator");
054
055 // sent in as a System Property for restarts
056 public static final String RESTART_FLAG_PARENT_PID = "AS_RESTART";
057 public static final long WAIT_FOR_DAS_TIME_MS = 10 * 60 * 1000; // 10 minutes
058 public static final int RESTART_NORMAL = 10;
059 public static final int RESTART_DEBUG_ON = 11;
060 public static final int RESTART_DEBUG_OFF = 12;
061 public static final String WALL_CLOCK_START_PROP = "WALL_CLOCK_START";
062 public static final boolean debugMode;
063 public static final String CLI_RECORD_ALL_COMMANDS_PROP = "AS_LOGFILE";
064 public static final String MASTER_PASSWORD = "AS_ADMIN_MASTERPASSWORD";
065 public static final int SUCCESS = 0;
066 public static final int ERROR = 1;
067 public static final int WARNING = 4;
068 public static final long DEATH_TIMEOUT_MS = 1 * 60 * 1000;
069
070 public static final String K_ADMIN_PORT = "agent.adminPort";
071 public static final String K_ADMIN_HOST = "agent.adminHost";
072 public static final String K_AGENT_PROTOCOL = "agent.protocol";
073 public static final String K_CLIENT_HOST = "agent.client.host";
074 public static final String K_DAS_HOST = "agent.das.host";
075 public static final String K_DAS_PROTOCOL = "agent.das.protocol";
076 public static final String K_DAS_PORT = "agent.das.port";
077 public static final String K_DAS_IS_SECURE = "agent.das.isSecure";
078
079 public static final String K_MASTER_PASSWORD = "agent.masterpassword";
080 public static final String K_SAVE_MASTER_PASSWORD = "agent.saveMasterPassword";
081
082 public static final String AGENT_LISTEN_ADDRESS_NAME="listenaddress";
083 public static final String REMOTE_CLIENT_ADDRESS_NAME="remoteclientaddress";
084 public static final String AGENT_JMX_PROTOCOL_NAME="agentjmxprotocol";
085 public static final String DAS_JMX_PROTOCOL_NAME="dasjmxprotocol";
086 public static final String AGENT_DAS_IS_SECURE="isDASSecure";
087
088 public static final String NODEAGENT_DEFAULT_DAS_IS_SECURE = "false";
089 public static final String NODEAGENT_DEFAULT_DAS_PORT = String.valueOf(CLIConstants.DEFAULT_ADMIN_PORT);
090 public static final String NODEAGENT_DEFAULT_HOST_ADDRESS = "0.0.0.0";
091 public static final String NODEAGENT_JMX_DEFAULT_PROTOCOL = "rmi_jrmp";
092 public static final String HOST_NAME_PROPERTY = "com.sun.aas.hostName";
093 public static final int RESTART_CHECK_INTERVAL_MSEC = 300;
094
095 ////////////////////////////////////////////////////////////////////////////
096 /////// private ////////////////////////////////////
097 ////////////////////////////////////////////////////////////////////////////
098
099 private static final String CLI_DEBUG_MODE_PROP = "AS_DEBUG";
100
101 static {
102 debugMode = Boolean.parseBoolean(System.getenv(CLI_DEBUG_MODE_PROP)) ||
103 Boolean.getBoolean(CLI_DEBUG_MODE_PROP);
104 }
105
106 private CLIConstants() {
107 // no instances allowed!
108 }
109 public static final boolean debug() {
110 return debugMode;
111 }
112 }