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.JavaInterface;
10: import org.objectweb.celtix.tools.common.model.JavaModel;
11: import org.objectweb.celtix.tools.generators.AbstractGenerator;
12:
13: public class ImplGenerator extends AbstractGenerator {
14:
15: private static final String IMPL_TEMPLATE = TEMPLATE_BASE
16: + "/impl.vm";
17:
18: public ImplGenerator(JavaModel jmodel, ProcessorEnvironment env) {
19: super (jmodel, env);
20: this .name = ToolConstants.IMPL_GENERATOR;
21: }
22:
23: public boolean passthrough() {
24: if (env.optionSet(ToolConstants.CFG_IMPL)
25: || env.optionSet(ToolConstants.CFG_ALL)) {
26: return false;
27: }
28: return true;
29: }
30:
31: public void generate() throws ToolException {
32: if (passthrough()) {
33: return;
34: }
35:
36: Map<String, JavaInterface> interfaces = javaModel
37: .getInterfaces();
38: for (Iterator iter = interfaces.keySet().iterator(); iter
39: .hasNext();) {
40: String interfaceName = (String) iter.next();
41: JavaInterface intf = interfaces.get(interfaceName);
42:
43: clearAttributes();
44: setAttributes("intf", intf);
45:
46: setCommonAttributes();
47:
48: doWrite(IMPL_TEMPLATE, parseOutputName(intf
49: .getPackageName(), intf.getName() + "Impl"));
50: }
51: }
52:
53: }
|