1 /* 2 * JBoss, Home of Professional Open Source 3 * Copyright 2005, 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 javax.enterprise.deploy.model; 23 24 import java.io.FileNotFoundException; 25 import java.io.InputStream; 26 import java.util.Enumeration; 27 28 import javax.enterprise.deploy.model.exceptions.DDBeanCreateException; 29 import javax.enterprise.deploy.shared.ModuleType; 30 31 /** 32 * A representation of a deployment module. It provides access to the 33 * deployment descriptor and class files. 34 * 35 * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a> 36 * @version $Revision: 37459 $ 37 */ 38 public interface DeployableObject 39 { 40 // Constants ----------------------------------------------------- 41 42 // Public -------------------------------------------------------- 43 44 /** 45 * Get the module type of this deployment module 46 * 47 * @return the module type 48 */ 49 ModuleType getType(); 50 51 /** 52 * Get the top level element of the deployment descriptor 53 * 54 * @return the root of the deployment descriptor 55 */ 56 DDBeanRoot getDDBeanRoot(); 57 58 /** 59 * Get the child elements with the specified xpath 60 * 61 * @param xpath the xpath of the children 62 * @return an array of children or null if there are none 63 */ 64 DDBean[] getChildBean(String xpath); 65 66 /** 67 * Get the text for the given xpath 68 * 69 * @param xpath the xpath 70 * @return an array of Strings for the xpath or null if there are none 71 */ 72 String[] getText(String xpath); 73 74 /** 75 * Retrieves the specified class from the deployment module 76 * 77 * @param className the name of the class 78 * @return the class 79 */ 80 Class getClassFromScope(String className); 81 82 83 /** 84 * Get the dtd version 85 * 86 * @deprecated use DDBeanRoot.getDDBeanRootVersion 87 * @return the dtd version 88 */ 89 String getModuleDTDVersion(); 90 91 /** 92 * Returns a DDBeanRoot for the xml document. This method should be used 93 * to return DDBeanRoot for non deployment descriptor xml documents such as WSDL files 94 * 95 * @param filename the file name of the document 96 * @return the root element 97 * @throws FileNotFoundException if the file is not found 98 * @throws DDBeanCreateException for other errors creating the object 99 */ 100 DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException, DDBeanCreateException; 101 102 /** 103 * Returns an enumeration of file names (as strings) for each file relative to the root 104 * of the module 105 * 106 * @return the enumeration 107 */ 108 Enumeration entries(); 109 110 /** 111 * Get an input stream to the module entry. 112 * 113 * @param name the name of the module entry 114 * @return the input stream to the module entry or null if it does not exist 115 */ 116 InputStream getEntry(String name); 117 }