1 18 package org.apache.tools.ant.taskdefs.optional.ejb; 19 20 import java.io.File ; 21 import java.util.Hashtable ; 22 import org.apache.tools.ant.BuildException; 23 import org.apache.tools.ant.Project; 24 25 33 public class JbossDeploymentTool extends GenericDeploymentTool { 34 protected static final String JBOSS_DD = "jboss.xml"; 35 protected static final String JBOSS_CMP10D = "jaws.xml"; 36 protected static final String JBOSS_CMP20D = "jbosscmp-jdbc.xml"; 37 38 39 private String jarSuffix = ".jar"; 40 41 45 public void setSuffix(String inString) { 46 jarSuffix = inString; 47 } 48 49 55 protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { 56 File jbossDD = new File (getConfig().descriptorDir, ddPrefix + JBOSS_DD); 57 if (jbossDD.exists()) { 58 ejbFiles.put(META_DIR + JBOSS_DD, jbossDD); 59 } else { 60 log("Unable to locate jboss deployment descriptor. " 61 + "It was expected to be in " + jbossDD.getPath(), 62 Project.MSG_WARN); 63 return; 64 } 65 String descriptorFileName = JBOSS_CMP10D; 66 if (EjbJar.CMPVersion.CMP2_0.equals(getParent().getCmpversion())) { 67 descriptorFileName = JBOSS_CMP20D; 68 } 69 File jbossCMPD 70 = new File (getConfig().descriptorDir, ddPrefix + descriptorFileName); 71 72 if (jbossCMPD.exists()) { 73 ejbFiles.put(META_DIR + descriptorFileName, jbossCMPD); 74 } else { 75 log("Unable to locate jboss cmp descriptor. " 76 + "It was expected to be in " 77 + jbossCMPD.getPath(), Project.MSG_VERBOSE); 78 return; 79 } 80 } 81 82 86 File getVendorOutputJarFile(String baseName) { 87 if (getDestDir() == null && getParent().getDestdir() == null) { 88 throw new BuildException("DestDir not specified"); 89 } 90 if (getDestDir() == null) { 91 return new File (getParent().getDestdir(), baseName + jarSuffix); 92 } else { 93 return new File (getDestDir(), baseName + jarSuffix); 94 } 95 } 96 97 104 public void validateConfigured() throws BuildException { 105 } 106 107 private EjbJar getParent() { 108 return (EjbJar) this.getTask(); 109 } 110 } 111 | Popular Tags |