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 enumeration values for the various states of a deployment action. 030 * 031 * @version $Rev: 467553 $ $Date: 2006-10-25 06:01:51 +0200 (Mi, 25. Okt 2006) $ 032 */ 033 public class StateType { 034 /** 035 * The action operation is running normally. 036 */ 037 public static final StateType RUNNING = new StateType(0); 038 /** 039 * The action operation has completed normally. 040 */ 041 public static final StateType COMPLETED = new StateType(1); 042 /** 043 * The action operation has failed. 044 */ 045 public static final StateType FAILED = new StateType(2); 046 /** 047 * The DeploymentManager is running in disconnected mode. 048 */ 049 public static final StateType RELEASED = new StateType(3); 050 051 private static final StateType[] enumValueTable = { 052 RUNNING, 053 COMPLETED, 054 FAILED, 055 RELEASED, 056 }; 057 058 private static final String[] stringTable = { 059 "running", 060 "completed", 061 "failed", 062 "released", 063 }; 064 065 private int value; 066 067 /** 068 * Construct a new enumeration value with the given integer value. 069 */ 070 protected StateType(int value) { 071 this.value = value; 072 } 073 074 /** 075 * Returns this enumeration value's integer value. 076 */ 077 public int getValue() { 078 return value; 079 } 080 081 /** 082 * Returns the string table for class StateType 083 */ 084 protected String[] getStringTable() { 085 return stringTable; 086 } 087 088 /** 089 * Returns the enumeration value table for class StateType 090 */ 091 protected StateType[] getEnumValueTable() { 092 return enumValueTable; 093 } 094 095 /** 096 * Return an object of the specified value. 097 * 098 * @param value a designator for the object. 099 */ 100 public static StateType getStateType(int value) { 101 return enumValueTable[value]; 102 } 103 104 /** 105 * Return the string name of this StateType or the integer value if 106 * outside the bounds of the table 107 */ 108 public String toString() { 109 return (value >= 0 && value <= 3) ? stringTable[value] : String.valueOf(value); 110 } 111 112 /** 113 * Returns the lowest integer value used by this enumeration value's 114 * enumeration class. 115 * 116 * @return the offset of the lowest enumeration value. 117 */ 118 protected int getOffset() { 119 return 0; 120 } 121 }