1 2 24 package org.enhydra.tool.archive; 25 26 29 import org.enhydra.tool.common.ResUtil; 31 import org.enhydra.tool.archive.xml.EjbDescriptorHandler; 32 33 import java.io.IOException ; 35 import java.io.File ; 36 import java.util.ResourceBundle ; 37 import java.util.jar.Attributes ; 38 import java.util.jar.Manifest ; 39 40 public class EjbBuilder extends JarBuilder { 42 43 public EjbBuilder() { 45 super(); 46 } 47 48 protected Manifest buildManifest(Manifest m) { 50 Manifest manifest = super.buildManifest(m); 51 Boolean b = null; 52 53 b = new Boolean (getEjbPlan().isCreateClient()); 54 manifest.getMainAttributes().put(new Attributes.Name (CREATE_CLIENT), 55 b.toString()); 56 return manifest; 57 } 58 59 60 public EjbPlan getEjbPlan() { 61 EjbPlan ep = null; 62 63 if (getPlan() instanceof EjbPlan) { 64 ep = (EjbPlan) getPlan(); 65 } 66 return ep; 67 } 68 69 public File buildArchive() throws ArchiveException { 70 File jar = null; 71 String root = null; 72 File [] files = new File [0]; 73 Descriptor[] dd = new Descriptor[0]; 74 75 jar = openJarStream(getEjbPlan().getArchivePath()); 76 root = getEjbPlan().getClassRoot(); 77 dd = getEjbPlan().getDescriptors(); 78 files = getEjbPlan().getClassFileArray(); 79 addJarClasses(); 80 for (int i = 0; i < dd.length; i++) { 81 addDescriptor(dd[i], root, files); 82 } 83 closeJarStream(); 84 if (getEjbPlan().isCreateClient()) { 85 createClient(jar.getAbsolutePath()); 86 } 87 return jar; 88 } 89 90 private void createClient(String path) { 91 String [] args = new String [1]; 92 93 args[0] = path; 94 } 100 101 } 102 | Popular Tags |