|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ActionType.java | - | 78,6% | 57,1% | 71,4% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package javax.enterprise.deploy.shared;
|
|
| 8 |
|
|
| 9 |
import java.util.HashMap;
|
|
| 10 |
import java.util.Map;
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
/**
|
|
| 14 |
* Class ActionTypes defines enumeration values for the J2EE DeploymentStatus actions.
|
|
| 15 |
*
|
|
| 16 |
* @author Laurent Etiemble
|
|
| 17 |
* @version $Revision: 1.1 $
|
|
| 18 |
* @since 1.0
|
|
| 19 |
*/
|
|
| 20 |
public class ActionType |
|
| 21 |
{
|
|
| 22 |
/** Index value */
|
|
| 23 |
private Integer value;
|
|
| 24 |
|
|
| 25 |
/**
|
|
| 26 |
* A cancel operation is being preformed on the DeploymentManager action command.
|
|
| 27 |
*/
|
|
| 28 |
public final static ActionType CANCEL; |
|
| 29 |
/** The DeploymentManager action command is executing. */
|
|
| 30 |
public final static ActionType EXECUTE; |
|
| 31 |
/** A stop operation is being preformed on the DeploymentManager action command. */
|
|
| 32 |
public final static ActionType STOP; |
|
| 33 |
|
|
| 34 |
/** Internal table for string values */
|
|
| 35 |
private final static Map strings = new HashMap(); |
|
| 36 |
/** Internal table for values */
|
|
| 37 |
private final static Map values = new HashMap(); |
|
| 38 |
|
|
| 39 |
|
|
| 40 |
/**
|
|
| 41 |
* Construct a new enumeration value with the given integer value.
|
|
| 42 |
*
|
|
| 43 |
* @param value Integer value
|
|
| 44 |
*/
|
|
| 45 | 24 |
protected ActionType(int value) |
| 46 |
{
|
|
| 47 | 24 |
this.value = new Integer(value); |
| 48 | 24 |
values.put(this.value, this); |
| 49 |
} |
|
| 50 |
|
|
| 51 |
|
|
| 52 |
/**
|
|
| 53 |
* Returns this enumeration value's integer value.
|
|
| 54 |
*
|
|
| 55 |
* @return the value
|
|
| 56 |
*/
|
|
| 57 | 24 |
public int getValue() |
| 58 |
{
|
|
| 59 | 24 |
return this.value.intValue(); |
| 60 |
} |
|
| 61 |
|
|
| 62 |
|
|
| 63 |
/**
|
|
| 64 |
* Return the string name of this ActionType or the integer value if outside the
|
|
| 65 |
* bounds of the table.
|
|
| 66 |
*
|
|
| 67 |
* @return The String representation
|
|
| 68 |
*/
|
|
| 69 | 24 |
public String toString()
|
| 70 |
{
|
|
| 71 | 24 |
return (String) strings.get(this.value); |
| 72 |
} |
|
| 73 |
|
|
| 74 |
|
|
| 75 |
/**
|
|
| 76 |
* Returns the enumeration value table for class ActionType
|
|
| 77 |
*
|
|
| 78 |
* @return Enumeration table of the values
|
|
| 79 |
*/
|
|
| 80 | 0 |
protected ActionType[] getEnumValueTable()
|
| 81 |
{
|
|
| 82 | 0 |
return (ActionType[]) values.values().toArray(new ActionType[0]); |
| 83 |
} |
|
| 84 |
|
|
| 85 |
|
|
| 86 |
/**
|
|
| 87 |
* Returns the lowest integer value used by this enumeration value's enumeration
|
|
| 88 |
* class. <p>
|
|
| 89 |
*
|
|
| 90 |
* The default implementation returns 0.</p>
|
|
| 91 |
*
|
|
| 92 |
* @return the offset of the lowest enumeration value.
|
|
| 93 |
*/
|
|
| 94 | 0 |
protected int getOffset() |
| 95 |
{
|
|
| 96 | 0 |
return 0;
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
|
|
| 100 |
/**
|
|
| 101 |
* Returns the string table for class ActionType
|
|
| 102 |
*
|
|
| 103 |
* @return The String representation table values
|
|
| 104 |
*/
|
|
| 105 | 0 |
protected String[] getStringTable()
|
| 106 |
{
|
|
| 107 | 0 |
return (String[]) strings.values().toArray(new String[0]); |
| 108 |
} |
|
| 109 |
|
|
| 110 |
|
|
| 111 |
/**
|
|
| 112 |
* Return an object of the specified value.
|
|
| 113 |
*
|
|
| 114 |
* @param value a designator for the object.
|
|
| 115 |
* @return The corresponding ActionType
|
|
| 116 |
*/
|
|
| 117 | 24 |
public static ActionType getActionType(int value) |
| 118 |
{
|
|
| 119 | 24 |
return (ActionType) values.get(new Integer(value)); |
| 120 |
} |
|
| 121 |
|
|
| 122 |
/** Static block to initialize constants and to fill arrays. */
|
|
| 123 |
static
|
|
| 124 |
{
|
|
| 125 | 8 |
EXECUTE = new ActionType(0);
|
| 126 | 8 |
strings.put(new Integer(0), "execute"); |
| 127 |
|
|
| 128 | 8 |
CANCEL = new ActionType(1);
|
| 129 | 8 |
strings.put(new Integer(1), "cancel"); |
| 130 |
|
|
| 131 | 8 |
STOP = new ActionType(2);
|
| 132 | 8 |
strings.put(new Integer(2), "stop"); |
| 133 |
} |
|
| 134 |
} |
|
| 135 |
|
|
||||||||||