KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > enterprise > deploy > shared > ActionType


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.enterprise.deploy.shared;
25
26 /**
27  * Class ActionTypes defines enumeration values for the J2EE
28  * DeploymentStatus actions.
29  *
30  * @author rsearls
31  */

32 public class ActionType
33 {
34     private int value; // This enumeration value's int value
35

36     /**
37      * The DeploymentManager action command is executing.
38      */

39     public static final ActionType JavaDoc EXECUTE = new ActionType JavaDoc(0);
40     /**
41      * A cancel operation is being preformed on the DeploymentManager
42      * action command.
43      */

44     public static final ActionType JavaDoc CANCEL = new ActionType JavaDoc(1);
45     /**
46      * A stop operation is being preformed on the DeploymentManager
47      * action command.
48      */

49     public static final ActionType JavaDoc STOP = new ActionType JavaDoc(2);
50
51
52     private static final String JavaDoc[] stringTable = {
53     "execute",
54     "cancel",
55     "stop",
56     };
57
58     private static final ActionType JavaDoc[] enumValueTable = {
59     EXECUTE,
60     CANCEL,
61     STOP,
62     };
63
64
65     /**
66      * Construct a new enumeration value with the given integer value.
67      *
68      * @param value Integer value.
69      */

70     protected ActionType(int value)
71     { this.value = value;
72     }
73
74     /**
75      * Returns this enumeration value's integer value.
76      * @return the value
77      */

78     public int getValue()
79     { return value;
80     }
81
82        
83     /**
84      * Returns the string table for class ActionType
85      */

86     protected String JavaDoc[] getStringTable()
87     {
88         return stringTable;
89     }
90
91     /**
92      * Returns the enumeration value table for class ActionType
93      */

94     protected ActionType JavaDoc[] getEnumValueTable()
95     {
96         return enumValueTable;
97     }
98
99     /**
100      * Return an object of the specified value.
101      * @param value a designator for the object.
102      */

103     public static ActionType JavaDoc getActionType(int value)
104     { return enumValueTable[value];
105     }
106
107     /**
108      * Return the string name of this ActionType or the
109      * integer value if outside the bounds of the table
110      */

111     public String JavaDoc toString()
112     {
113         String JavaDoc[] strTable = getStringTable();
114         int index = value - getOffset();
115         if (strTable != null && index >= 0 && index < strTable.length)
116             return strTable[index];
117         else
118             return Integer.toString (value);
119     }
120
121     /**
122      * Returns the lowest integer value used by this enumeration value's
123      * enumeration class.
124      * <P>
125      * The default implementation returns 0.
126      * @return the offset of the lowest enumeration value.
127      */

128     protected int getOffset()
129     { return 0;
130     }
131 }
132
Popular Tags