1 25 26 package org.objectweb.jonas_ws.wsgen.modifier; 27 28 import java.io.File ; 29 import java.util.Iterator ; 30 import java.util.List ; 31 32 import org.w3c.dom.Document ; 33 import org.w3c.dom.Element ; 34 35 import org.objectweb.jonas_lib.genbase.GenBaseException; 36 import org.objectweb.jonas_lib.genbase.archive.Archive; 37 import org.objectweb.jonas_lib.genbase.archive.Client; 38 import org.objectweb.jonas_lib.genbase.modifier.ArchiveModifier; 39 40 import org.objectweb.jonas_ws.deployment.api.ServiceRefDesc; 41 import org.objectweb.jonas_ws.wsgen.ddmodifier.WsClientDDModifier; 42 import org.objectweb.jonas_ws.wsgen.generator.Generator; 43 import org.objectweb.jonas_ws.wsgen.generator.GeneratorFactory; 44 45 import org.objectweb.util.monolog.api.BasicLevel; 46 47 52 public class ClientModifier extends ArchiveModifier { 53 54 55 private Client client; 56 57 62 public ClientModifier(Client client) { 63 super(client); 64 this.client = client; 65 } 66 67 74 public Archive modify() throws GenBaseException { 75 76 getLogger().log(BasicLevel.INFO, "Processing Client " + client.getName()); 77 78 GeneratorFactory gf = GeneratorFactory.getInstance(); 79 Document jclient = client.getJonasClientDoc(); 80 81 List refs = client.getServiceRefDescs(); 82 for (Iterator i = refs.iterator(); i.hasNext();) { 83 ServiceRefDesc ref = (ServiceRefDesc) i.next(); 84 85 Element base = null; 87 if (jclient != null) { 88 base = jclient.getDocumentElement(); 89 } 90 WsClientDDModifier ddm = new WsClientDDModifier(ref.getServiceRefName(), jclient, base); 91 92 Generator g = gf.newGenerator(ref, ddm, client); 94 g.generate(); 95 g.compile(); 96 g.addFiles(client); 98 } 99 100 return save(gf.getConfiguration(), "clients" + File.separator + client.getRootFile().getName()); 101 } 102 } | Popular Tags |