1 28 29 package com.caucho.j2ee.deployclient; 30 31 import javax.enterprise.deploy.shared.ActionType ; 32 import javax.enterprise.deploy.shared.CommandType ; 33 import javax.enterprise.deploy.shared.StateType ; 34 import javax.enterprise.deploy.spi.status.DeploymentStatus ; 35 import java.io.Serializable ; 36 37 40 public class DeploymentStatusImpl implements DeploymentStatus , Serializable { 41 public static final int RUNNING = 0; 42 public static final int COMPLETED = 1; 43 public static final int FAILED = 2; 44 public static final int RELEASED = 3; 45 46 private String _message; 47 private int _state = RUNNING; 48 49 52 public StateType getState() 53 { 54 switch (_state) { 55 case RUNNING: 56 return StateType.RUNNING; 57 case COMPLETED: 58 return StateType.COMPLETED; 59 case FAILED: 60 return StateType.FAILED; 61 case RELEASED: 62 return StateType.RELEASED; 63 default: 64 return StateType.FAILED; 65 } 66 } 67 68 public void setState(StateType stateType) 69 { 70 if (stateType == StateType.RUNNING) 71 _state = RUNNING; 72 else if (stateType == StateType.COMPLETED) 73 _state = COMPLETED; 74 else if (stateType == StateType.FAILED) 75 _state = FAILED; 76 else if (stateType == StateType.RELEASED) 77 _state = RELEASED; 78 else throw new AssertionError (stateType); 79 } 80 81 84 public CommandType getCommand() 85 { 86 return CommandType.DISTRIBUTE; 87 } 88 89 92 public ActionType getAction() 93 { 94 return ActionType.EXECUTE; 95 } 96 97 100 public String getMessage() 101 { 102 return _message; 103 } 104 105 108 public void setMessage(String message) 109 { 110 _message = message; 111 } 112 113 116 public boolean isCompleted() 117 { 118 return _state == COMPLETED; 119 } 120 121 124 public boolean isFailed() 125 { 126 return _state == FAILED; 127 } 128 129 132 public boolean isRunning() 133 { 134 return _state == RUNNING; 135 } 136 137 public String toString() 138 { 139 return "DeploymentStatusImpl[" + getState() + "," + getMessage() + "]"; 140 } 141 } 142 143 | Popular Tags |