KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > j2ee > deployclient > ProgressObjectImpl


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28 package com.caucho.j2ee.deployclient;
29
30 import javax.enterprise.deploy.shared.StateType JavaDoc;
31 import javax.enterprise.deploy.spi.TargetModuleID JavaDoc;
32 import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException JavaDoc;
33 import javax.enterprise.deploy.spi.status.ClientConfiguration JavaDoc;
34 import javax.enterprise.deploy.spi.status.DeploymentStatus JavaDoc;
35 import javax.enterprise.deploy.spi.status.ProgressListener JavaDoc;
36 import javax.enterprise.deploy.spi.status.ProgressObject JavaDoc;
37 import java.util.logging.Level JavaDoc;
38 import java.util.logging.Logger JavaDoc;
39
40 /**
41  * Status of the progress.
42  */

43 public class ProgressObjectImpl implements ProgressObject JavaDoc, java.io.Serializable JavaDoc {
44   private static final Logger JavaDoc log = Logger.getLogger(ProgressObjectImpl.class.getName());
45
46   private TargetModuleID JavaDoc []_targetModuleIDs;
47   private final DeploymentStatusImpl _status = new DeploymentStatusImpl();
48
49   ProgressObjectImpl()
50   {
51   }
52
53   public ProgressObjectImpl(TargetModuleID JavaDoc []targetModuleIDs)
54   {
55     _targetModuleIDs = targetModuleIDs;
56   }
57
58   /**
59    * Returns the status.
60    */

61   public DeploymentStatus JavaDoc getDeploymentStatus()
62   {
63     if (_status != null)
64       return _status;
65     else
66       return new DeploymentStatusImpl();
67   }
68
69   /**
70    * Returns the target ids.
71    */

72   public TargetModuleID JavaDoc []getResultTargetModuleIDs()
73   {
74     return _targetModuleIDs;
75   }
76
77   /**
78    * Returns the client configuration.
79    */

80   public ClientConfiguration JavaDoc getClientConfiguration(TargetModuleID JavaDoc id)
81   {
82     throw new UnsupportedOperationException JavaDoc();
83   }
84
85   /**
86    * Returns true if cancel is supported.
87    */

88   public boolean isCancelSupported()
89   {
90     return false;
91   }
92
93   /**
94    * Cancels the operation.
95    */

96   public void cancel()
97     throws OperationUnsupportedException JavaDoc
98   {
99     throw new UnsupportedOperationException JavaDoc();
100   }
101
102   /**
103    * Returns true if stop is supported.
104    */

105   public boolean isStopSupported()
106   {
107     return false;
108   }
109
110   /**
111    * Stops the operation.
112    */

113   public void stop()
114     throws OperationUnsupportedException JavaDoc
115   {
116     throw new UnsupportedOperationException JavaDoc();
117   }
118
119   /**
120    * Adds a listener.
121    */

122   public void addProgressListener(ProgressListener JavaDoc listener)
123   {
124   }
125
126   /**
127    * Removes a listener.
128    */

129   public void removeProgressListener(ProgressListener JavaDoc listener)
130   {
131   }
132
133   /**
134    * Change to the failed state.
135    */

136   public void failed(String JavaDoc message)
137   {
138     if (log.isLoggable(Level.FINEST))
139       log.log(Level.FINEST, "failed " + message);
140
141     _status.setState(StateType.FAILED);
142     _status.setMessage(message);
143   }
144
145   /**
146    * Change to the running state.
147    */

148   public void completed(String JavaDoc message)
149   {
150     _status.setState(StateType.COMPLETED);
151     _status.setMessage(message);
152   }
153
154   public String JavaDoc toString()
155   {
156     return "ProgressObjectImpl[" + _status + "]";
157   }
158 }
159
160
Popular Tags