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.JavaExceptionClass; 10 import org.objectweb.celtix.tools.common.model.JavaField; 11 import org.objectweb.celtix.tools.common.model.JavaModel; 12 import org.objectweb.celtix.tools.generators.AbstractGenerator; 13 import org.objectweb.celtix.tools.utils.ProcessorUtil; 14 15 public class FaultGenerator extends AbstractGenerator { 16 17 private static final String FAULT_TEMPLATE = TEMPLATE_BASE + "/fault.vm"; 18 19 public FaultGenerator(JavaModel jmodel, ProcessorEnvironment env) { 20 super(jmodel, env); 21 this.name = ToolConstants.FAULT_GENERATOR; 22 } 23 24 25 public boolean passthrough() { 26 return false; 27 } 28 29 public void generate() throws ToolException { 30 if (passthrough()) { 31 return; 32 } 33 34 Map <String , JavaExceptionClass> exceptionClasses = javaModel 35 .getExceptionClasses(); 36 for (Iterator iter = exceptionClasses.keySet().iterator(); iter 37 .hasNext();) { 38 String expClassName = (String )iter.next(); 39 JavaExceptionClass expClz = exceptionClasses.get(expClassName); 40 41 clearAttributes(); 42 setAttributes("expClass", expClz); 43 for (JavaField jf : expClz.getFields()) { 44 setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName())); 45 } 46 setCommonAttributes(); 47 doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(), 48 expClz.getName())); 49 } 50 } 51 } 52 | Popular Tags |