001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 // 021 // This source code implements specifications defined by the Java 022 // Community Process. In order to remain compliant with the specification 023 // DO NOT add / change / or delete method signatures! 024 // 025 026 package javax.enterprise.deploy.shared; 027 028 /** 029 * Defines enumerated values for the available deployment commands. 030 * 031 * @version $Rev: 467553 $ $Date: 2006-10-25 06:01:51 +0200 (Mi, 25. Okt 2006) $ 032 */ 033 public class CommandType { 034 /** 035 * The DeploymentManger action operation being processed is distribute. 036 */ 037 public static final CommandType DISTRIBUTE = new CommandType(0); 038 /** 039 * The DeploymentManger action operation being processed is start. 040 */ 041 public static final CommandType START = new CommandType(1); 042 /** 043 * The DeploymentManger action operation being processed is stop. 044 */ 045 public static final CommandType STOP = new CommandType(2); 046 /** 047 * The DeploymentManger action operation being processed is undeploy. 048 */ 049 public static final CommandType UNDEPLOY = new CommandType(3); 050 /** 051 * he DeploymentManger action operation being processed is redeploy. 052 */ 053 public static final CommandType REDEPLOY = new CommandType(4); 054 055 private static final CommandType[] enumValueTable = new CommandType[]{ 056 DISTRIBUTE, 057 START, 058 STOP, 059 UNDEPLOY, 060 REDEPLOY, 061 }; 062 063 private static final String[] stringTable = new String[]{ 064 "distribute", 065 "start", 066 "stop", 067 "undeploy", 068 "redeploy", 069 }; 070 071 private int value; 072 073 /** 074 * Construct a new enumeration value with the given integer value. 075 */ 076 protected CommandType(int value) { 077 this.value = value; 078 } 079 080 /** 081 * Returns this enumeration value's integer value. 082 */ 083 public int getValue() { 084 return value; 085 } 086 087 /** 088 * Returns the string table for class CommandType 089 */ 090 protected String[] getStringTable() { 091 return stringTable; 092 } 093 094 /** 095 * Returns the enumeration value table for class CommandType 096 */ 097 protected CommandType[] getEnumValueTable() { 098 return enumValueTable; 099 } 100 101 /** 102 * Return an object of the specified value. 103 * 104 * @param value a designator for the object. 105 */ 106 public static CommandType getCommandType(int value) { 107 return enumValueTable[value]; 108 } 109 110 /** 111 * Return the string name of this CommandType or the integer value if 112 * outside the bounds of the table 113 */ 114 public String toString() { 115 return (value >= 0 && value <= 4) ? stringTable[value] : String.valueOf(value); 116 } 117 118 /** 119 * Returns the lowest integer value used by this enumeration value's 120 * enumeration class. 121 * 122 * @return the offset of the lowest enumeration value. 123 */ 124 protected int getOffset() { 125 return 0; 126 } 127 }