1 20 package org.apache.cactus.integration.ant.deployment.application; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.InputStream ; 25 26 import javax.xml.parsers.ParserConfigurationException ; 27 28 import org.apache.cactus.integration.ant.deployment.DefaultJarArchive; 29 import org.apache.cactus.integration.ant.deployment.webapp.DefaultWarArchive; 30 import org.apache.cactus.integration.ant.deployment.webapp.WarArchive; 31 import org.xml.sax.SAXException ; 32 33 39 public class DefaultEarArchive extends DefaultJarArchive implements EarArchive 40 { 41 43 46 private ApplicationXml applicationXml; 47 48 50 56 public DefaultEarArchive(File theFile) 57 throws IOException 58 { 59 super(theFile); 60 } 61 62 69 public DefaultEarArchive(InputStream theInputStream) 70 throws IOException 71 { 72 super(theInputStream); 73 } 74 75 77 80 public final ApplicationXml getApplicationXml() 81 throws IOException , SAXException , ParserConfigurationException 82 { 83 if (this.applicationXml == null) 84 { 85 InputStream in = null; 86 try 87 { 88 in = getResource("META-INF/application.xml"); 89 this.applicationXml = 90 ApplicationXmlIo.parseApplicationXml(in, null); 91 } 92 finally 93 { 94 if (in != null) 95 { 96 in.close(); 97 } 98 } 99 } 100 return this.applicationXml; 101 } 102 103 106 public final WarArchive getWebModule(String theUri) 107 throws IOException 108 { 109 InputStream war = null; 110 try 111 { 112 war = getResource(theUri); 113 if (war != null) 114 { 115 return new DefaultWarArchive(war); 116 } 117 } 118 finally 119 { 120 if (war != null) 121 { 122 war.close(); 123 } 124 } 125 return null; 126 } 127 128 } 129 | Popular Tags |