001 /**
002 *
003 * Copyright 2003-2004 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 //
019 // This source code implements specifications defined by the Java
020 // Community Process. In order to remain compliant with the specification
021 // DO NOT add / change / or delete method signatures!
022 //
023
024 package javax.enterprise.deploy.model;
025
026 import java.io.FileNotFoundException;
027 import java.io.InputStream;
028 import java.util.Enumeration;
029 import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
030 import javax.enterprise.deploy.shared.ModuleType;
031
032 /**
033 * The DeployableObject interface is an abstract representation of a J2EE deployable
034 * module (JAR, WAR, RAR, EAR). A DeployableObject provides access to the module's
035 * deployment descriptor and class files.
036 *
037 * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
038 */
039 public interface DeployableObject {
040 /**
041 * Return the ModuleType of deployment descriptor (i.e., EAR, JAR, WAR, RAR)
042 * this deployable object represents. Values are found in DeploymentManager.
043 *
044 * @return The ModuleType of deployable object
045 */
046 public ModuleType getType();
047
048 /**
049 * Return the top level standard bean representing the root of the deployment descriptor.
050 *
051 * @return A standard bean representing the deployment descriptor.
052 */
053 public DDBeanRoot getDDBeanRoot();
054
055 /**
056 * Return an array of standard beans representing the XML content returned based upon the XPath.
057 *
058 * @param xpath AAn XPath string identifying the data to be extracted from the deployment descriptor.
059 *
060 * @return an array of DDBeans or <code>null</code> if no matching data is found.
061 */
062 public DDBean[] getChildBean(String xpath);
063
064 /**
065 *
066 * @param xpath An xpath string referring to a location in the deployment descriptor
067 *
068 * @return a list XML content or <code>null</code> if no matching data is found.
069 */
070 public String[] getText(String xpath);
071
072 /**
073 * Retrieve the specified class from this deployable module.
074 * <p>One use: to get all finder methods from an EJB. If the tool is attempting to package a
075 * module and retrieve a class from the package, the class request may fail. The class may
076 * not yet be available. The tool should respect the manifest Class-Path entries.</p>
077 *
078 * @param className Class to retrieve.
079 *
080 * @return Class representation of the class
081 */
082 public Class getClassFromScope(String className);
083
084 /**
085 * A convenience method to return the deployment descriptor
086 * document version number of the primary deployment descriptor
087 * for the module (e.g. web.xml, ejb-jar.xml, ra.xml, application.xml,
088 * and application-client.xml.) The version number for documents
089 * webservices.xml , webservicesclient.xml and the like are not returned
090 * by this method. DDBeanRoot.getDDBeanRootVersion should be used
091 * instead.
092 *
093 * This method is being deprecated. DDBeanRoot.getDDBeanRootVersion
094 * should be used instead.
095 *
096 * @deprecated As of version 1.1, replace by DDBeanRoot.getDDBeanRootVersion()
097 *
098 * @return a string that is the version number of the XML instance document.
099 * 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 }