|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CommandType.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 |
|
|
| 10 |
/**
|
|
| 11 |
* Class CommandTypes defines enumeration values for the DeploymentStatus object.
|
|
| 12 |
*
|
|
| 13 |
* @author Laurent Etiemble
|
|
| 14 |
* @version $Revision: 1.1 $
|
|
| 15 |
* @since 1.0
|
|
| 16 |
*/
|
|
| 17 |
public class CommandType |
|
| 18 |
{
|
|
| 19 |
/** Index value */
|
|
| 20 |
private int value; |
|
| 21 |
|
|
| 22 |
/** The DeploymentManger action operation being processed is distribute. */
|
|
| 23 |
public final static CommandType DISTRIBUTE; |
|
| 24 |
/** The DeploymentManger action operation being processed is redeploy. */
|
|
| 25 |
public final static CommandType REDEPLOY; |
|
| 26 |
/** The DeploymentManger action operation being processed is start. */
|
|
| 27 |
public final static CommandType START; |
|
| 28 |
/** The DeploymentManger action operation being processed is stop. */
|
|
| 29 |
public final static CommandType STOP; |
|
| 30 |
/** The DeploymentManger action operation being processed is undeploy. */
|
|
| 31 |
public final static CommandType UNDEPLOY; |
|
| 32 |
|
|
| 33 |
/** Internal table for string values */
|
|
| 34 |
private final static String[] stringTable; |
|
| 35 |
/** Internal table for values */
|
|
| 36 |
private final static CommandType[] valueTable; |
|
| 37 |
|
|
| 38 |
|
|
| 39 |
/**
|
|
| 40 |
* Construct a new enumeration value with the given integer value.
|
|
| 41 |
*
|
|
| 42 |
* @param value Integer value.
|
|
| 43 |
*/
|
|
| 44 | 40 |
protected CommandType(int value) |
| 45 |
{
|
|
| 46 | 40 |
this.value = value;
|
| 47 |
} |
|
| 48 |
|
|
| 49 |
|
|
| 50 |
/**
|
|
| 51 |
* Returns this enumeration value's integer value.
|
|
| 52 |
*
|
|
| 53 |
* @return the value
|
|
| 54 |
*/
|
|
| 55 | 40 |
public int getValue() |
| 56 |
{
|
|
| 57 | 40 |
return this.value; |
| 58 |
} |
|
| 59 |
|
|
| 60 |
|
|
| 61 |
/**
|
|
| 62 |
* Return the string name of this CommandType or the integer value if outside
|
|
| 63 |
* the bounds of the table.
|
|
| 64 |
*
|
|
| 65 |
* @return The String representation
|
|
| 66 |
*/
|
|
| 67 | 40 |
public String toString()
|
| 68 |
{
|
|
| 69 | 40 |
return stringTable[value];
|
| 70 |
} |
|
| 71 |
|
|
| 72 |
|
|
| 73 |
/**
|
|
| 74 |
* Returns the enumeration value table for class CommandType
|
|
| 75 |
*
|
|
| 76 |
* @return Enumeration table of the values
|
|
| 77 |
*/
|
|
| 78 | 0 |
protected CommandType[] getEnumValueTable()
|
| 79 |
{
|
|
| 80 | 0 |
return valueTable;
|
| 81 |
} |
|
| 82 |
|
|
| 83 |
|
|
| 84 |
/**
|
|
| 85 |
* Returns the lowest integer value used by this enumeration value's enumeration
|
|
| 86 |
* class. <p>
|
|
| 87 |
*
|
|
| 88 |
* The default implementation returns 0.</p>
|
|
| 89 |
*
|
|
| 90 |
* @return the offset of the lowest enumeration value.
|
|
| 91 |
*/
|
|
| 92 | 0 |
protected int getOffset() |
| 93 |
{
|
|
| 94 | 0 |
return 0;
|
| 95 |
} |
|
| 96 |
|
|
| 97 |
|
|
| 98 |
/**
|
|
| 99 |
* Returns the string table for class CommandType
|
|
| 100 |
*
|
|
| 101 |
* @return The String representation table values
|
|
| 102 |
*/
|
|
| 103 | 0 |
protected String[] getStringTable()
|
| 104 |
{
|
|
| 105 | 0 |
return stringTable;
|
| 106 |
} |
|
| 107 |
|
|
| 108 |
|
|
| 109 |
/**
|
|
| 110 |
* Return an object of the specified value.
|
|
| 111 |
*
|
|
| 112 |
* @param value a designator for the object.
|
|
| 113 |
* @return The corresponding CommandType
|
|
| 114 |
*/
|
|
| 115 | 40 |
public static CommandType getCommandType(int value) |
| 116 |
{
|
|
| 117 | 40 |
return valueTable[value];
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
/** Static block to initialize constants and to fill arrays. */
|
|
| 121 |
static
|
|
| 122 |
{
|
|
| 123 | 8 |
DISTRIBUTE = new CommandType(0);
|
| 124 | 8 |
START = new CommandType(1);
|
| 125 | 8 |
STOP = new CommandType(2);
|
| 126 | 8 |
UNDEPLOY = new CommandType(3);
|
| 127 | 8 |
REDEPLOY = new CommandType(4);
|
| 128 |
|
|
| 129 | 8 |
valueTable = (new CommandType[]{DISTRIBUTE, START, STOP, UNDEPLOY, REDEPLOY});
|
| 130 | 8 |
stringTable = new String[]{"distribute", "start", "stop", "undeploy", "redeploy"}; |
| 131 |
} |
|
| 132 |
} |
|
| 133 |
|
|
||||||||||