KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > tools > generators > wsdl2 > ImplGenerator


1 package org.objectweb.celtix.tools.generators.wsdl2;
2
3 import java.util.Iterator JavaDoc;
4 import java.util.Map JavaDoc;
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 ImplGenerator extends AbstractGenerator {
14
15     private static final String JavaDoc IMPL_TEMPLATE = TEMPLATE_BASE + "/impl.vm";
16
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 JavaDoc<String JavaDoc, JavaInterface> interfaces = javaModel.getInterfaces();
37         for (Iterator JavaDoc iter = interfaces.keySet().iterator(); iter.hasNext();) {
38             String JavaDoc interfaceName = (String JavaDoc)iter.next();
39             JavaInterface intf = interfaces.get(interfaceName);
40
41             clearAttributes();
42             setAttributes("intf", intf);
43            
44             setCommonAttributes();
45
46             doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
47         }
48     }
49
50 }
51
Popular Tags