1 /**
2 *
3 * Copyright 2003-2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
19
20
21
22
23
24 package javax.enterprise.deploy.model;
25
26 import java.io.FileNotFoundException;
27 import java.io.InputStream;
28 import java.util.Enumeration;
29 import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
30 import javax.enterprise.deploy.shared.ModuleType;
31
32 /**
33 * The DeployableObject interface is an abstract representation of a J2EE deployable
34 * module (JAR, WAR, RAR, EAR). A DeployableObject provides access to the module's
35 * deployment descriptor and class files.
36 *
37 * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
38 */
39 public interface DeployableObject {
40 /**
41 * Return the ModuleType of deployment descriptor (i.e., EAR, JAR, WAR, RAR)
42 * this deployable object represents. Values are found in DeploymentManager.
43 *
44 * @return The ModuleType of deployable object
45 */
46 public ModuleType getType();
47
48 /**
49 * Return the top level standard bean representing the root of the deployment descriptor.
50 *
51 * @return A standard bean representing the deployment descriptor.
52 */
53 public DDBeanRoot getDDBeanRoot();
54
55 /**
56 * Return an array of standard beans representing the XML content returned based upon the XPath.
57 *
58 * @param xpath AAn XPath string identifying the data to be extracted from the deployment descriptor.
59 *
60 * @return an array of DDBeans or <code>null</code> if no matching data is found.
61 */
62 public DDBean[] getChildBean(String xpath);
63
64 /**
65 *
66 * @param xpath An xpath string referring to a location in the deployment descriptor
67 *
68 * @return a list XML content or <code>null</code> if no matching data is found.
69 */
70 public String[] getText(String xpath);
71
72 /**
73 * Retrieve the specified class from this deployable module.
74 * <p>One use: to get all finder methods from an EJB. If the tool is attempting to package a
75 * module and retrieve a class from the package, the class request may fail. The class may
76 * not yet be available. The tool should respect the manifest Class-Path entries.</p>
77 *
78 * @param className Class to retrieve.
79 *
80 * @return Class representation of the class
81 */
82 public Class getClassFromScope(String className);
83
84 /**
85 * A convenience method to return the deployment descriptor
86 * document version number of the primary deployment descriptor
87 * for the module (e.g. web.xml, ejb-jar.xml, ra.xml, application.xml,
88 * and application-client.xml.) The version number for documents
89 * webservices.xml , webservicesclient.xml and the like are not returned
90 * by this method. DDBeanRoot.getDDBeanRootVersion should be used
91 * instead.
92 *
93 * This method is being deprecated. DDBeanRoot.getDDBeanRootVersion
94 * should be used instead.
95 *
96 * @deprecated As of version 1.1, replace by DDBeanRoot.getDDBeanRootVersion()
97 *
98 * @return a string that is the version number of the XML instance document.
99 * Null is returned if no version number can be found.
100 */
101 public String getModuleDTDVersion();
102
103 /**
104 * Returns a DDBeanRoot object for the XML instance document named.
105 * This method should be used to return DDBeanRoot objects for non deployment
106 * descriptor XML instance documents such as WSDL files.
107 *
108 * @since 1.1
109 *
110 * @param filename the full path name from the root of the module of the xml
111 * instance document for which a DDBeanRoot object is to be returned.
112 *
113 * @return a DDBeanRoot object for the XML data.
114 *
115 * @throws java.io.FileNotFoundException if the named file can not be found
116 * @throws javax.enterprise.deploy.model.exceptions.DDBeanCreateException
117 * if an error is encountered creating the DDBeanRoot object.
118 */
119 public DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException, DDBeanCreateException;
120
121 /**
122 * Returns an enumeration of the module file entries. All elements in the
123 * enumeration are of type String. Each String represents a file name relative
124 * to the root of the module.
125 *
126 * @since 1.1
127 *
128 * @return an enumeration of the archive file entries.
129 */
130 public Enumeration entries();
131
132 /**
133 * Returns the InputStream for the given entry name.
134 * The file name must be relative to the root of the module.
135 *
136 * @since 1.1
137 *
138 * @param name the file name relative to the root of the module.
139 *
140 * @return the InputStream for the given entry name or null if not found.
141 */
142 public InputStream getEntry(String name);
143 }