01: package org.objectweb.celtix.tools.generators.wsdl2;
02:
03: import java.util.Iterator;
04: import java.util.Map;
05:
06: import org.objectweb.celtix.tools.common.ProcessorEnvironment;
07: import org.objectweb.celtix.tools.common.ToolConstants;
08: import org.objectweb.celtix.tools.common.ToolException;
09: 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
18: + "/fault.vm";
19:
20: public FaultGenerator(JavaModel jmodel, ProcessorEnvironment env) {
21: super (jmodel, env);
22: this .name = ToolConstants.FAULT_GENERATOR;
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
40: .get(expClassName);
41:
42: clearAttributes();
43: setAttributes("expClass", expClz);
44: for (JavaField jf : expClz.getFields()) {
45: setAttributes("paraName", ProcessorUtil
46: .mangleNameToVariableName(jf.getName()));
47: }
48: setCommonAttributes();
49: doWrite(FAULT_TEMPLATE, parseOutputName(expClz
50: .getPackageName(), expClz.getName()));
51: }
52: }
53: }
|