Methods Summary |
---|
public static DeploymentDescriptorFile | getDDFileFor(RootDeploymentDescriptor descriptor)Creates and return an appropriate DeploymentDescriptorFile
capable of handling the passed descriptor
if (descriptor instanceof Application) {
return new ApplicationDeploymentDescriptorFile();
}
if (descriptor instanceof EjbBundleDescriptor) {
return new EjbDeploymentDescriptorFile();
}
if (descriptor instanceof WebBundleDescriptor) {
return new WebDeploymentDescriptorFile();
}
if (descriptor instanceof ConnectorDescriptor) {
return new ConnectorDeploymentDescriptorFile();
}
if (descriptor instanceof ApplicationClientDescriptor) {
return new AppClientDeploymentDescriptorFile();
}
return null;
|
public static DeploymentDescriptorFile | getDDFileFor(javax.enterprise.deploy.shared.ModuleType type)Creates and return an appropriate DeploymentDescriptorFile
capable of handling the passed descriptor
if (type==null) {
return null;
}
if (type.equals(ModuleType.EAR)) {
return new ApplicationDeploymentDescriptorFile();
}
if (type.equals(ModuleType.EJB)) {
return new EjbDeploymentDescriptorFile();
}
if (type.equals(ModuleType.WAR)) {
return new WebDeploymentDescriptorFile();
}
if (type.equals(ModuleType.RAR)) {
return new ConnectorDeploymentDescriptorFile();
}
if (type.equals(ModuleType.CAR)) {
return new AppClientDeploymentDescriptorFile();
}
return null;
|
public static DeploymentDescriptorFile | getDDFileFor(java.io.File xmlFile)Creates and return the appropriate DeploymentDescriptorFile
depending on the XML file passed.
// this is higly unefficient but we read the xml file as a DOM
// tree, figure out the top xml element name and return the
// appropriate DeploymentDescriptorFile
// always use system default to parse DD
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
factory.setValidating(false);
DocumentBuilder docBuilder = factory.newDocumentBuilder();
docBuilder.setEntityResolver(SaxParserHandlerFactory.newInstance());
Document document = docBuilder.parse(xmlFile);
Element element = document.getDocumentElement();
if (element.getTagName().equals(ApplicationTagNames.APPLICATION)) {
return new ApplicationDeploymentDescriptorFile();
}
if (element.getTagName().equals(EjbTagNames.EJB_BUNDLE_TAG)) {
return new EjbDeploymentDescriptorFile();
}
if (element.getTagName().equals(WebTagNames.WEB_BUNDLE)) {
return new WebDeploymentDescriptorFile();
}
if (element.getTagName().equals(ConnectorTagNames.CONNECTOR)) {
return new ConnectorDeploymentDescriptorFile();
}
if (element.getTagName().equals(ApplicationClientTagNames.APPLICATION_CLIENT_TAG)) {
return new AppClientDeploymentDescriptorFile();
}
if (element.getTagName().equals(PersistenceTagNames.PERSISTENCE)) {
return new PersistenceDeploymentDescriptorFile();
}
return null;
|