KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > deployers > spi > structure > DeploymentContext


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.deployers.spi.structure;
23
24 import java.util.List JavaDoc;
25 import java.util.Set JavaDoc;
26
27 import org.jboss.deployers.spi.DeploymentException;
28 import org.jboss.deployers.spi.attachments.Attachments;
29 import org.jboss.deployers.spi.classloader.ClassLoaderFactory;
30 import org.jboss.deployers.spi.deployer.DeploymentUnit;
31 import org.jboss.virtual.VirtualFile;
32
33 /**
34  * DeploymentContext.
35  *
36  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
37  * @version $Revision: 1.1 $
38  */

39 public interface DeploymentContext
40 {
41    /**
42     * Get the deployment name
43     *
44     * @return the name
45     */

46    String JavaDoc getName();
47
48    /**
49     * Get the simple vfs name of the deployment unit. This is the simple
50     * name of the virtual file .
51     *
52     * vfs path ------------------- relative path
53     * deploy/some.ear "some.ear"
54     * deploy/some.ear/x.ejb "x.ejb"
55     * deploy/some.ear/y.sar "y.sar"
56     * deploy/some.ear/y.sar/z.rar "z.rar"
57     * @return the deployment unit simple path
58     */

59    public String JavaDoc getSimpleName();
60
61    /**
62     * Get the path of this deployment relative to the top of the
63     * deployment based on the vfs paths. For example, an ear:
64     *
65     * vfs path ------------------- relative path
66     * deploy/some.ear ""
67     * deploy/some.ear/x.ejb "/x.ejb"
68     * deploy/some.ear/y.sar "/y.sar"
69     * deploy/some.ear/y.sar/z.rar "/y.sar/z.rar"
70     *
71     * @return the top-level deployment relative path
72     */

73    public String JavaDoc getRelativePath();
74
75    /**
76     * Whether the structure is determined
77     *
78     * @return true when the structure is determined
79     */

80    StructureDetermined getStructureDetermined();
81    
82    /**
83     * Set whether the structure is determined
84     *
85     * @param determined true when it is determined
86     */

87    void setStructureDetermined(StructureDetermined determined);
88    
89    /**
90     * Whether this deployment context is a candidate deployment context
91     *
92     * @return true when it is only a candidate
93     */

94    boolean isCandidate();
95    
96    /**
97     * Get the deployment state
98     *
99     * @return the state
100     */

101    DeploymentState getState();
102    
103    /**
104     * Set the deployment state
105     *
106     * @param state the state
107     */

108    void setState(DeploymentState state);
109
110    /**
111     * Get the deployment unit
112     *
113     * @return the deployment
114     */

115    DeploymentUnit getDeploymentUnit();
116
117    /**
118     * Set the deployment unit
119     *
120     * @param unit the deployment unit
121     */

122    void setDeploymentUnit(DeploymentUnit unit);
123
124    /**
125     * Get the root file
126     *
127     * @return the root
128     */

129    VirtualFile getRoot();
130
131    /**
132     * Set the meta data path relative to the root
133     *
134     * @param path the path
135     */

136    void setMetaDataPath(String JavaDoc path);
137
138    /**
139     * Get the meta data location
140     *
141     * @return the meta data location
142     */

143    VirtualFile getMetaDataLocation();
144    
145    /**
146     * Set the meta data location
147     *
148     * @param location the meta data location
149     */

150    void setMetaDataLocation(VirtualFile location);
151    
152    /**
153     * Gets a metadata file
154     *
155     * @param name the name to exactly match
156     * @return the virtual file or null if not found
157     * @throws IllegalArgumentException for a null name
158     */

159    VirtualFile getMetaDataFile(String JavaDoc name);
160
161    /**
162     * Gets metadata files for this deployment
163     *
164     * @param name the name to exactly match
165     * @param suffix the suffix to partially match
166     * @return the virtual files that match
167     * @throws IllegalArgumentException if both the name and suffix are null
168     */

169    List JavaDoc<VirtualFile> getMetaDataFiles(String JavaDoc name, String JavaDoc suffix);
170
171    /**
172     * Gets the classloader for this deployment unit
173     *
174     * @return the classloader
175     */

176    ClassLoader JavaDoc getClassLoader();
177    
178    /**
179     * Set the class loader
180     *
181     * @param classLoader the new classloader
182     */

183    void setClassLoader(ClassLoader JavaDoc classLoader);
184
185    /**
186     * Create a classloader
187     *
188     * @param factory the factory
189     * @return false if there is already is a classloader
190     * @throws DeploymentException for any error
191     */

192    boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException;
193
194    /**
195     * Remove the classloader created by the factory
196     */

197    void removeClassLoader();
198
199    /**
200     * Get the class path
201     *
202     * @return the class path
203     */

204    List JavaDoc<VirtualFile> getClassPath();
205    
206    /**
207     * Set the class path
208     *
209     * @param paths the paths
210     */

211    void setClassPath(List JavaDoc<VirtualFile> paths);
212
213    /**
214     * Whether this is a top level deployment
215     *
216     * @return true when top level
217     */

218    boolean isTopLevel();
219    
220    /**
221     * Get the top level deployment
222     *
223     * @return the top level deployment
224     */

225    DeploymentContext getTopLevel();
226    
227    /**
228     * The parent
229     *
230     * @return the parent
231     */

232    DeploymentContext getParent();
233    
234    /**
235     * Set the parent
236     *
237     * @param parent the parent
238     */

239    void setParent(DeploymentContext parent);
240    
241    /**
242     * The children
243     *
244     * @return the children
245     */

246    Set JavaDoc<DeploymentContext> getChildren();
247
248    /**
249     * Add a child
250     *
251     * @param child the child to add
252     */

253    void addChild(DeploymentContext child);
254
255    /**
256     * Remove a child
257     *
258     * @param child the child to remove
259     * @return whether it was removed
260     */

261    boolean removeChild(DeploymentContext child);
262    
263    /**
264     * Whether this is a component
265     *
266     * @return true when a component
267     */

268    boolean isComponent();
269    
270    /**
271     * The components
272     *
273     * @return the components
274     */

275    Set JavaDoc<DeploymentContext> getComponents();
276
277    /**
278     * Add a component
279     *
280     * @param component the componnet to add
281     */

282    void addComponent(DeploymentContext component);
283
284    /**
285     * Remove a component
286     *
287     * @param component the component to remove
288     * @return whether it was removed
289     */

290    boolean removeComponent(DeploymentContext component);
291
292    /**
293     * Visit the context and the children
294     *
295     * @param visitor the visitor
296     * @throws DeploymentException for any error in the visitor
297     * @throws IllegalArgumentException for a null visitor
298     */

299    void visit(DeploymentContextVisitor visitor) throws DeploymentException;
300    
301    /**
302     * Get the predetermined managed objects
303     *
304     * @return the predetermined managed objects
305     */

306    Attachments getPredeterminedManagedObjects();
307
308    /**
309     * Get the managed objects
310     *
311     * @return the managed objects
312     */

313    Attachments getTransientManagedObjects();
314
315    /**
316     * Get the transient attachments
317     *
318     * @return the attachments
319     */

320    Attachments getTransientAttachments();
321
322    /**
323     * Whether the deployment was processed
324     *
325     * @return true when processed
326     */

327    boolean isDeployed();
328
329    /**
330     * Touch the context to say it is deployed
331     */

332    void deployed();
333    
334    /**
335     * Get the problem for this context
336     *
337     * @return the problem
338     */

339    Throwable JavaDoc getProblem();
340
341    /**
342     * Set the problem for this context
343     *
344     * @param problem the problem
345     */

346    void setProblem(Throwable JavaDoc problem);
347    
348    /**
349     * Reset a deployment context that is about to be deployed
350     */

351    void reset();
352 }
353
Popular Tags