KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployapi > DeploymentStatusImpl


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 com.sun.enterprise.deployapi;
25
26
27 import javax.enterprise.deploy.spi.status.DeploymentStatus JavaDoc;
28 import javax.enterprise.deploy.shared.StateType JavaDoc;
29 import javax.enterprise.deploy.shared.CommandType JavaDoc;
30 import javax.enterprise.deploy.shared.ActionType JavaDoc;
31 /**
32  *
33  * @author dochez
34  */

35 public class DeploymentStatusImpl implements DeploymentStatus JavaDoc {
36     
37     ProgressObjectImpl progressObject;
38     StateType JavaDoc stateType = null;
39     String JavaDoc lastMsg = null;
40     CommandType JavaDoc commandType = null;
41     
42     /** Creates a new instance of DeploymentStatusImpl */
43     public DeploymentStatusImpl(ProgressObjectImpl progressObject) {
44         this.progressObject = progressObject;
45     }
46
47     public DeploymentStatusImpl() {
48     }
49     
50     /** Retrieve the deployment ActionType for this event.
51      *
52      * @return the ActionType Object
53      */

54     public ActionType JavaDoc getAction() {
55         return ActionType.EXECUTE;
56     }
57     
58     /** Retrieve the deployment CommandType of this event.
59      *
60      * @return the CommandType Object
61      */

62     public CommandType JavaDoc getCommand() {
63         if (progressObject!=null) {
64             return progressObject.getCommandType();
65         } else {
66             return commandType;
67         }
68     }
69     
70     /** Retrieve any additional information about the
71      * status of this event.
72      *
73      * @return message text
74      */

75     public String JavaDoc getMessage() {
76         return lastMsg;
77     }
78     
79     /** Retrieve the StateType value.
80      *
81      * @return the StateType object
82      */

83     public StateType JavaDoc getState() {
84         return stateType;
85     }
86     
87     /** A convience method to report if the operation is
88      * in the completed state.
89      *
90      * @return true if this command has completed successfully
91      */

92     public boolean isCompleted() {
93         return StateType.COMPLETED.equals(stateType);
94     }
95     
96     /** A convience method to report if the operation is
97      * in the failed state.
98      *
99      * @return true if this command has failed
100      */

101     public boolean isFailed() {
102         return StateType.FAILED.equals(stateType);
103     }
104     
105     /** A convience method to report if the operation is
106      * in the running state.
107      *
108      * @return true if this command is still running
109      */

110     public boolean isRunning() {
111         return StateType.RUNNING.equals(stateType);
112     }
113     
114     public void setState(StateType JavaDoc stateType) {
115         this.stateType = stateType;
116     }
117     
118     public void setMessage(String JavaDoc message) {
119         lastMsg = message;
120     }
121     
122     public void setCommand(CommandType JavaDoc commandType) {
123         this.commandType = commandType;
124     }
125 }
126
Popular Tags