1 package org.objectweb.celtix.tools.generators.wsdl2; 2 3 import java.util.Iterator ; 4 import java.util.Map ; 5 6 import org.objectweb.celtix.tools.common.ProcessorEnvironment; 7 import org.objectweb.celtix.tools.common.ToolConstants; 8 import org.objectweb.celtix.tools.common.ToolException; 9 import org.objectweb.celtix.tools.common.model.JavaInterface; 10 import org.objectweb.celtix.tools.common.model.JavaModel; 11 import org.objectweb.celtix.tools.generators.AbstractGenerator; 12 13 public class SEIGenerator extends AbstractGenerator { 14 15 private static final String SEI_TEMPLATE = TEMPLATE_BASE + "/sei.vm"; 16 17 public SEIGenerator(JavaModel jmodel, ProcessorEnvironment env) { 18 super(jmodel, env); 19 this.name = ToolConstants.SEI_GENERATOR; 20 } 21 22 public boolean passthrough() { 23 30 return false; 31 } 32 33 private boolean hasHandlerConfig(JavaInterface intf) { 34 return intf.getHandlerChains() != null; 35 } 36 37 public void generate() throws ToolException { 38 if (passthrough()) { 39 return; 40 } 41 42 Map <String , JavaInterface> interfaces = javaModel.getInterfaces(); 43 for (Iterator iter = interfaces.keySet().iterator(); iter.hasNext();) { 44 String interfaceName = (String )iter.next(); 45 JavaInterface intf = interfaces.get(interfaceName); 46 47 if (hasHandlerConfig(intf)) { 48 HandlerConfigGenerator handlerGen = new HandlerConfigGenerator(intf, getEnvironment()); 49 handlerGen.generate(); 50 51 if (handlerGen.getHandlerAnnotation() != null) { 52 intf.addAnnotation(handlerGen.getHandlerAnnotation().toString()); 53 intf.addImport("javax.jws.HandlerChain"); 54 } 55 } 56 clearAttributes(); 57 setAttributes("intf", intf); 58 setCommonAttributes(); 59 60 doWrite(SEI_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName())); 61 } 62 } 63 } 64 | Popular Tags |