1 25 26 package org.objectweb.jonas_lib.genclientstub.modifier; 27 28 import java.io.File ; 29 import java.util.Iterator ; 30 import java.util.List ; 31 32 import org.objectweb.jonas_lib.deployment.api.EjbRefDesc; 33 import org.objectweb.jonas_lib.genbase.GenBaseException; 34 import org.objectweb.jonas_lib.genbase.archive.Archive; 35 import org.objectweb.jonas_lib.genbase.archive.Ejb; 36 import org.objectweb.jonas_lib.genbase.archive.EjbJar; 37 import org.objectweb.jonas_lib.genclientstub.ClientStubGenException; 38 import org.objectweb.jonas_lib.genclientstub.generator.Generator; 39 import org.objectweb.jonas_lib.genclientstub.generator.GeneratorFactory; 40 41 import org.objectweb.util.monolog.api.BasicLevel; 42 43 47 public class EjbJarModifier extends AbsArchiveModifier { 48 49 52 private EjbJar ejbjar = null; 53 54 58 public EjbJarModifier(EjbJar ejbjar) { 59 super(ejbjar); 60 this.ejbjar = ejbjar; 61 } 62 63 73 public Archive modify() throws GenBaseException, ClientStubGenException { 74 75 getLogger().log(BasicLevel.INFO, "Processing EjbJar " + ejbjar.getName()); 76 77 GeneratorFactory gf = GeneratorFactory.getInstance(); 78 79 generateFoundStubs(gf.getConfiguration(), ejbjar); 81 82 List ejbs = ejbjar.getEjbs(); 84 for (Iterator i = ejbs.iterator(); i.hasNext();) { 85 Ejb ejb = (Ejb) i.next(); 86 List ejbRefs = ejb.getEjbRefDescs(); 87 for (Iterator j = ejbRefs.iterator(); j.hasNext();) { 88 EjbRefDesc ejbRef = (EjbRefDesc) j.next(); 89 90 Generator g = new Generator(gf.getConfiguration(), ejbRef, null, ejbjar); 92 g.generate(); 93 g.compile(); 94 g.addFiles(ejbjar); 96 } 97 } 98 99 return save(gf.getConfiguration(), "ejbjars" + File.separator + ejbjar.getRootFile().getName()); 100 101 } 102 } | Popular Tags |