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 SEIGenerator extends AbstractGenerator {
14:
15: private static final String SEI_TEMPLATE = TEMPLATE_BASE
16: + "/sei.vm";
17:
18: public SEIGenerator(JavaModel jmodel, ProcessorEnvironment env) {
19: super (jmodel, env);
20: this .name = ToolConstants.SEI_GENERATOR;
21: }
22:
23: public boolean passthrough() {
24: /* if (env.optionSet(ToolConstants.CFG_INTERFACE)
25: || env.optionSet(ToolConstants.CFG_ALL)) {
26: return false;
27: }
28: if (env.optionSet(ToolConstants.CFG_TYPES)) {
29: return true;
30: }*/
31: return false;
32: }
33:
34: private boolean hasHandlerConfig(JavaInterface intf) {
35: return intf.getHandlerChains() != null;
36: }
37:
38: public void generate() throws ToolException {
39: if (passthrough()) {
40: return;
41: }
42:
43: Map<String, JavaInterface> interfaces = javaModel
44: .getInterfaces();
45: for (Iterator iter = interfaces.keySet().iterator(); iter
46: .hasNext();) {
47: String interfaceName = (String) iter.next();
48: JavaInterface intf = interfaces.get(interfaceName);
49:
50: if (hasHandlerConfig(intf)) {
51: HandlerConfigGenerator handlerGen = new HandlerConfigGenerator(
52: intf, getEnvironment());
53: handlerGen.generate();
54:
55: if (handlerGen.getHandlerAnnotation() != null) {
56: intf.addAnnotation(handlerGen
57: .getHandlerAnnotation().toString());
58: intf.addImport("javax.jws.HandlerChain");
59: }
60: }
61: clearAttributes();
62: setAttributes("intf", intf);
63: setCommonAttributes();
64:
65: doWrite(SEI_TEMPLATE, parseOutputName(
66: intf.getPackageName(), intf.getName()));
67: }
68: }
69: }
|