cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r438854 - in /incubator/cxf/trunk/tools: common/src/main/java/org/apache/cxf/tools/common/ common/src/test/java/org/apache/cxf/tools/common/ wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ wsdl2java/src/main/java/org/apach...
Date Thu, 31 Aug 2006 10:08:42 GMT
Author: jliu
Date: Thu Aug 31 03:08:32 2006
New Revision: 438854

URL: http://svn.apache.org/viewvc?rev=438854&view=rev
Log:
Refactor wsdltojava to support a pluggable code gen mechanism, which allows the generation of client, server and service stub codes for different profiles, such as JAXWS and SCA

Added:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/GeneratorPlugin.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Generator.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/PluginProfile.java   (with props)
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AbstractGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AbstractGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AntGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AntGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ClientGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ClientGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/FaultGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/FaultGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/HandlerConfigGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/HandlerConfigGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ImplGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ImplGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/JAXWSProfile.java   (with props)
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/Messages.properties
      - copied unchanged from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/Messages.properties
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/SEIGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/SEIGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServerGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServerGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServiceGenerator.java
      - copied, changed from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServiceGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/xmlbeans/
Removed:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Generator.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolWrapperGenerator.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/ToolWrapperGeneratorTest.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AbstractGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AntGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ClientGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/FaultGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/HandlerConfigGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ImplGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/Messages.properties
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/SEIGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServerGenerator.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServiceGenerator.java
Modified:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorEnvironment.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/Messages.properties
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
    incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java

Copied: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/GeneratorPlugin.java (from r438801, incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Generator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/GeneratorPlugin.java?p2=incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/GeneratorPlugin.java&p1=incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Generator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Generator.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/GeneratorPlugin.java Thu Aug 31 03:08:32 2006
@@ -19,16 +19,13 @@
 
 package org.apache.cxf.tools.common;
 
-import org.apache.cxf.configuration.CommandlineConfiguration;
-
 /**
  * Interface for code generators used by the tools
- * 
+ *
  * @author codea
  */
-public interface Generator {
+public interface GeneratorPlugin {
 
-    void setConfiguration(CommandlineConfiguration config);
-    void generate();
+    void generate(ProcessorEnvironment penv);
 }
 

Added: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/PluginProfile.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/PluginProfile.java?rev=438854&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/PluginProfile.java (added)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/PluginProfile.java Thu Aug 31 03:08:32 2006
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.tools.common;
+
+import java.util.List;
+
+public interface PluginProfile {
+    List<GeneratorPlugin> getPlugins();
+}

Propchange: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/PluginProfile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorEnvironment.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorEnvironment.java?rev=438854&r1=438853&r2=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorEnvironment.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorEnvironment.java Thu Aug 31 03:08:32 2006
@@ -23,19 +23,22 @@
 import java.util.*;
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.util.PropertyUtil;
 import org.apache.cxf.tools.util.URIParserUtil;
 
 public class ProcessorEnvironment {
 
+    protected JavaModel javaModel;
     private Map<String, Object> paramMap;
     private String packageName;
     private Map<String, String> namespacePackageMap = new HashMap<String, String>();
     private Map<String, String> excludeNamespacePackageMap = new HashMap<String, String>();
     private final Map<String, InputSource> jaxbBindingFiles = new HashMap<String, InputSource>();
+
     public ProcessorEnvironment() {
     }
-   
+
 
     public void loadDefaultNS2Pck(InputStream ins) {
         try {
@@ -57,6 +60,13 @@
         }
     }
 
+    public JavaModel getJavaModel() {
+        return javaModel;
+    }
+
+    public void setJavaModel(JavaModel jModel) {
+        this.javaModel = jModel;
+    }
 
     public void setParameters(Map<String, Object> map) {
         this.paramMap = map;

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AbstractGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AbstractGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AbstractGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AbstractGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AbstractGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AbstractGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AbstractGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.io.IOException;
 import java.io.Writer;
@@ -29,39 +29,35 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.tools.common.GeneratorPlugin;
 import org.apache.cxf.tools.common.ProcessorEnvironment;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
-import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.util.ClassCollector;
 import org.apache.cxf.tools.util.FileWriterUtil;
+import org.apache.cxf.tools.wsdl2java.generator.VelocityWriter;
 import org.apache.cxf.version.Version;
 
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
 
-public abstract class AbstractGenerator {
-   
+public abstract class AbstractGenerator implements GeneratorPlugin {
+
     public static final String TEMPLATE_BASE = "org/apache/cxf/tools/wsdl2java/generator/template";
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractGenerator.class);
     protected ProcessorEnvironment env;
-    protected JavaModel javaModel;
+    //protected JavaModel javaModel;
     protected Map<String, Object> attributes = new HashMap<String, Object>();
     protected String name;
-    protected ClassCollector collector;
-    public  AbstractGenerator() {
-        
-    }
-    public AbstractGenerator(JavaModel jmodel, ProcessorEnvironment penv) {
-        javaModel = jmodel;
-        this.env = penv;
-        collector = (ClassCollector)env.get(ToolConstants.GENERATED_CLASS_COLLECTOR);
+    //protected ClassCollector collector;
+
+    public AbstractGenerator() {
     }
 
     public abstract boolean passthrough();
 
-    public abstract void generate() throws ToolException;
+    public abstract void generate(ProcessorEnvironment penv) throws ToolException;
 
     protected void doWrite(String templateName, Writer outputs) throws ToolException {
         Template tmpl = null;
@@ -114,11 +110,11 @@
     }
 
     protected Writer parseOutputName(String packageName, String filename) throws ToolException {
-        // collector.
+        ClassCollector collector = (ClassCollector)env.get(ToolConstants.GENERATED_CLASS_COLLECTOR);
         if (ToolConstants.CLT_GENERATOR.equals(name)) {
             collector.addClientClassName(packageName , filename , packageName + "." + filename);
         }
-        
+
         if (ToolConstants.FAULT_GENERATOR.equals(name)) {
             collector.addExceptionClassName(packageName , filename , packageName + "." + filename);
         }
@@ -127,10 +123,10 @@
         }
         if (ToolConstants.SVR_GENERATOR.equals(name)) {
             collector.addServiceClassName(packageName , filename , packageName + "." + filename);
-            
+
         }
-        
-        
+
+
         return parseOutputName(packageName, filename, ".java");
     }
 

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AntGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AntGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AntGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AntGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AntGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/AntGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/AntGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import org.apache.cxf.tools.common.ProcessorEnvironment;
 import org.apache.cxf.tools.common.ToolConstants;
@@ -28,8 +28,7 @@
 
     private static final String ANT_TEMPLATE = TEMPLATE_BASE + "/build.vm";
 
-    public AntGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+    public AntGenerator() {
         this.name = ToolConstants.ANT_GENERATOR;
     }
 
@@ -41,7 +40,10 @@
         return true;
     }
 
-    public void generate() throws ToolException {
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
+
         if (passthrough()) {
             return;
         }

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ClientGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ClientGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ClientGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ClientGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ClientGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ClientGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ClientGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -33,23 +33,23 @@
 public class ClientGenerator extends AbstractGenerator {
 
     private static final String CLT_TEMPLATE = TEMPLATE_BASE + "/client.vm";
-    
-    public ClientGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+
+    public ClientGenerator() {
         this.name = ToolConstants.CLT_GENERATOR;
     }
 
-
     public boolean passthrough() {
-        if (env.optionSet(ToolConstants.CFG_CLIENT) 
+        if (env.optionSet(ToolConstants.CFG_CLIENT)
             || env.optionSet(ToolConstants.CFG_GEN_CLIENT) || env.optionSet(ToolConstants.CFG_ALL)) {
             return false;
         }
         return true;
     }
 
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
 
-    public void generate() throws ToolException {
         if (passthrough()) {
             return;
         }
@@ -71,7 +71,7 @@
                     jp = (JavaPort)i.next();
                     if (jp.getPortType().equals(interfaceName)) {
                         serviceName = js.getName();
-                        
+
                         break;
                     }
                 }
@@ -80,20 +80,20 @@
                 }
             }
 
-           
+
             String clientClassName = interfaceName + "Client";
             while (isCollision(intf.getPackageName(), clientClassName)) {
                 clientClassName = clientClassName + "_Client";
             }
-            
+
             clearAttributes();
             setAttributes("clientClassName", clientClassName);
             setAttributes("intf", intf);
             setAttributes("service", js);
             setAttributes("port", jp);
-            
+
             setCommonAttributes();
-           
+
             doWrite(CLT_TEMPLATE, parseOutputName(intf.getPackageName(),
                     clientClassName));
         }

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/FaultGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/FaultGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/FaultGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/FaultGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/FaultGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/FaultGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/FaultGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -34,21 +34,23 @@
 
     private static final String FAULT_TEMPLATE = TEMPLATE_BASE + "/fault.vm";
 
-    public FaultGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+    public FaultGenerator() {
         this.name = ToolConstants.FAULT_GENERATOR;
     }
 
 
     public boolean passthrough() {
-        if (env.optionSet(ToolConstants.CFG_GEN_CLIENT) 
+        if (env.optionSet(ToolConstants.CFG_GEN_CLIENT)
             || env.optionSet(ToolConstants.CFG_GEN_SERVER)) {
             return true;
         }
         return false;
     }
 
-    public void generate() throws ToolException {
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
+
         if (passthrough()) {
             return;
         }
@@ -58,7 +60,7 @@
         for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                 .hasNext();) {
             String expClassName = (String)iter.next();
-            JavaExceptionClass expClz = 
+            JavaExceptionClass expClz =
                 exceptionClasses.get(expClassName);
 
             clearAttributes();

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/HandlerConfigGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/HandlerConfigGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/HandlerConfigGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/HandlerConfigGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/HandlerConfigGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/HandlerConfigGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/HandlerConfigGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.io.Writer;
 
@@ -36,13 +36,10 @@
 
     private static final String HANDLER_CHAIN_NAME = "";
     private JavaInterface intf;
-    private JavaAnnotation handlerChainAnnotation; 
-  
-    public HandlerConfigGenerator(JavaInterface i, ProcessorEnvironment env) {
-        
+    private JavaAnnotation handlerChainAnnotation;
+
+    public HandlerConfigGenerator() {
         this.name = ToolConstants.HANDLER_GENERATOR;
-        this.intf = i;
-        super.setEnvironment(env);
     }
 
     public JavaAnnotation getHandlerAnnotation() {
@@ -55,8 +52,14 @@
         }
         return false;
     }
-    
-    public void generate() throws ToolException {
+
+    public void setJavaInterface(JavaInterface javaInterface) {
+        this.intf = javaInterface;
+    }
+
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+
         if (passthrough()) {
             return;
         }
@@ -76,7 +79,6 @@
     }
 
     private void generateHandlerChainFile(Element hChains, Writer writer) throws ToolException {
-        XMLUtils xmlUtils = new XMLUtils();
-        xmlUtils.generateXMLFile(hChains, writer);
+        XMLUtils.generateXMLFile(hChains, writer);
     }
 }

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ImplGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ImplGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ImplGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ImplGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ImplGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ImplGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ImplGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -34,9 +34,8 @@
 
     private static final String IMPL_TEMPLATE = TEMPLATE_BASE + "/impl.vm";
 
-   
-    public ImplGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+
+    public ImplGenerator() {
         this.name = ToolConstants.IMPL_GENERATOR;
     }
 
@@ -48,7 +47,10 @@
         return true;
     }
 
-    public void generate() throws ToolException {
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
+
         if (passthrough()) {
             return;
         }
@@ -71,14 +73,14 @@
 
             clearAttributes();
             setAttributes("intf", intf);
-           
+
             setAttributes("service", service);
             setAttributes("port", port);
-           
+
             setCommonAttributes();
 
             doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
-        }        
+        }
     }
 
 }

Added: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/JAXWSProfile.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/JAXWSProfile.java?rev=438854&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/JAXWSProfile.java (added)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/JAXWSProfile.java Thu Aug 31 03:08:32 2006
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.tools.common.GeneratorPlugin;
+import org.apache.cxf.tools.common.PluginProfile;
+
+/**
+ * Generates a service interface, service stub, and port accessor.
+ *
+ */
+public class JAXWSProfile implements PluginProfile {
+    public List<GeneratorPlugin> getPlugins() {
+        List<GeneratorPlugin> plugins = new ArrayList<GeneratorPlugin>();
+
+        plugins.add(new SEIGenerator());
+        plugins.add(new FaultGenerator());
+        plugins.add(new ServerGenerator());
+        plugins.add(new ImplGenerator());
+        plugins.add(new ClientGenerator());
+        plugins.add(new ServiceGenerator());
+        plugins.add(new AntGenerator());
+
+        return plugins;
+    }
+}

Propchange: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/JAXWSProfile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/SEIGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/SEIGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/SEIGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/SEIGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/SEIGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/SEIGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/SEIGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -31,9 +31,8 @@
 public class SEIGenerator extends AbstractGenerator {
 
     private static final String SEI_TEMPLATE = TEMPLATE_BASE + "/sei.vm";
-   
-    public SEIGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+
+    public SEIGenerator() {
         this.name = ToolConstants.SEI_GENERATOR;
     }
 
@@ -48,7 +47,10 @@
         return intf.getHandlerChains() != null;
     }
 
-    public void generate() throws ToolException {
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
+
         if (passthrough()) {
             return;
         }
@@ -59,8 +61,10 @@
             JavaInterface intf = interfaces.get(interfaceName);
 
             if (hasHandlerConfig(intf)) {
-                HandlerConfigGenerator handlerGen = new HandlerConfigGenerator(intf, getEnvironment());
-                handlerGen.generate();
+                HandlerConfigGenerator handlerGen = new HandlerConfigGenerator();
+                //REVISIT: find a better way to handle Handler gen, should not pass JavaInterface around.
+                handlerGen.setJavaInterface(intf);
+                handlerGen.generate(getEnvironment());
 
                 if (handlerGen.getHandlerAnnotation() != null) {
                     intf.addAnnotation(handlerGen.getHandlerAnnotation().toString());
@@ -74,4 +78,4 @@
             doWrite(SEI_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName()));
         }
     }
-}
+}
\ No newline at end of file

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServerGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServerGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServerGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServerGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServerGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServerGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServerGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -33,9 +33,8 @@
 public class ServerGenerator extends AbstractGenerator {
 
     private static final String SRV_TEMPLATE = TEMPLATE_BASE + "/server.vm";
-    
-    public ServerGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+
+    public ServerGenerator() {
         this.name = ToolConstants.SVR_GENERATOR;
     }
 
@@ -48,7 +47,10 @@
         return true;
     }
 
-    public void generate() throws ToolException {
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
+
         if (passthrough()) {
             return;
         }
@@ -74,20 +76,20 @@
                     break;
                 }
             }
-            
+
 
             String serverClassName = interfaceName + "Server";
-            
+
             while (isCollision(intf.getPackageName(), serverClassName)) {
                 serverClassName = serverClassName + "_Server";
             }
-           
+
             clearAttributes();
             setAttributes("serverClassName", serverClassName);
             setAttributes("intf", intf);
             setAttributes("address", address);
             setCommonAttributes();
-                       
+
             doWrite(SRV_TEMPLATE, parseOutputName(intf.getPackageName(), serverClassName));
         }
     }

Copied: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServiceGenerator.java (from r438801, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServiceGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServiceGenerator.java?p2=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServiceGenerator.java&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServiceGenerator.java&r1=438801&r2=438854&rev=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/ServiceGenerator.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/generator/jaxws/ServiceGenerator.java Thu Aug 31 03:08:32 2006
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java.generator;
+package org.apache.cxf.tools.wsdl2java.generator.jaxws;
 
 import java.net.URL;
 import java.util.Iterator;
@@ -37,31 +37,33 @@
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractGenerator.class);
     private static final String SERVICE_TEMPLATE = TEMPLATE_BASE + "/service.vm";
 
-    public ServiceGenerator(JavaModel jmodel, ProcessorEnvironment env) {
-        super(jmodel, env);
+    public ServiceGenerator() {
         this.name = ToolConstants.SERVICE_GENERATOR;
     }
 
-    public boolean passthrough() {  
+    public boolean passthrough() {
         if (env.optionSet(ToolConstants.CFG_GEN_SERVER)) {
             return true;
         }
         return false;
     }
-    
-    public void generate() throws ToolException {
+
+    public void generate(ProcessorEnvironment penv) throws ToolException {
+        this.env = penv;
+        JavaModel javaModel = env.getJavaModel();
+
         if (passthrough()) {
             return;
         }
-        
+
         Map<String, JavaServiceClass> serviceClasses = javaModel.getServiceClasses();
-        
+
         Iterator ite = serviceClasses.values().iterator();
-        
+
         while (ite.hasNext()) {
-            
+
             JavaServiceClass js = (JavaServiceClass)ite.next();
-            
+
             String location = (String)env.get(ToolConstants.CFG_WSDLURL);
             URL url = null;
             try {
@@ -72,7 +74,7 @@
             }
 
             clearAttributes();
-            
+
             setAttributes("service", js);
             setAttributes("wsdlLocation", url.toString());
             setCommonAttributes();

Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/Messages.properties?rev=438854&r1=438853&r2=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/Messages.properties (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/Messages.properties Thu Aug 31 03:08:32 2006
@@ -24,6 +24,7 @@
 FAIL_TO_CREATE_SOAPBINDING = Fail to create soapbinding
 FAIL_TO_CREATE_XMLBINDING = Fail to create xml binding
 FAIl_TO_CREATE_SOAPADDRESS = Fail to create soap address
+FAIl_TO_CREATE_PLUGINPROFILE = Fail to create PluginProfile
 
 SKIP_OVERLOADED_OPERATION=Skipping overloaded operation: {0}
 NO_INPUT_MESSAGE=Problem outputting method for {0} as no input message was found for input named {1}

Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java?rev=438854&r1=438853&r2=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java Thu Aug 31 03:08:32 2006
@@ -38,19 +38,14 @@
 import com.sun.tools.xjc.api.S2JJAXBModel;
 
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.tools.common.PluginProfile;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.extensions.jaxws.CustomizationParser;
 import org.apache.cxf.tools.common.extensions.jaxws.JAXWSBinding;
 import org.apache.cxf.tools.common.model.JavaModel;
 import org.apache.cxf.tools.util.ClassCollector;
-import org.apache.cxf.tools.wsdl2java.generator.AntGenerator;
-import org.apache.cxf.tools.wsdl2java.generator.ClientGenerator;
-import org.apache.cxf.tools.wsdl2java.generator.FaultGenerator;
-import org.apache.cxf.tools.wsdl2java.generator.ImplGenerator;
-import org.apache.cxf.tools.wsdl2java.generator.SEIGenerator;
-import org.apache.cxf.tools.wsdl2java.generator.ServerGenerator;
-import org.apache.cxf.tools.wsdl2java.generator.ServiceGenerator;
+import org.apache.cxf.tools.wsdl2java.generator.jaxws.JAXWSProfile;
 import org.apache.cxf.tools.wsdl2java.processor.compiler.Compiler;
 import org.apache.cxf.tools.wsdl2java.processor.internal.PortTypeProcessor;
 import org.apache.cxf.tools.wsdl2java.processor.internal.SEIAnnotationProcessor;
@@ -59,31 +54,20 @@
 
 public class WSDLToJavaProcessor extends WSDLToProcessor {
 
-    protected void registerGenerators(JavaModel jmodel) {
-        addGenerator(ToolConstants.SEI_GENERATOR, new SEIGenerator(jmodel, getEnvironment()));
-        addGenerator(ToolConstants.FAULT_GENERATOR, new FaultGenerator(jmodel, getEnvironment()));
-        addGenerator(ToolConstants.SVR_GENERATOR, new ServerGenerator(jmodel, getEnvironment()));
-        addGenerator(ToolConstants.IMPL_GENERATOR, new ImplGenerator(jmodel, getEnvironment()));
-        addGenerator(ToolConstants.CLT_GENERATOR, new ClientGenerator(jmodel, getEnvironment()));
-        addGenerator(ToolConstants.SERVICE_GENERATOR, new ServiceGenerator(jmodel, getEnvironment()));
-        addGenerator(ToolConstants.ANT_GENERATOR, new AntGenerator(jmodel, getEnvironment()));
-    }
-
     public void process() throws ToolException {
         init();
+
+        //Generate type classes for specified databinding
         if (isSOAP12Binding(wsdlDefinition)) {
             Message msg = new Message("SOAP12_UNSUPPORTED", LOG);
             throw new ToolException(msg);
         }
         generateTypes();
 
-        JavaModel jmodel = wsdlDefinitionToJavaModel(getWSDLDefinition());
-        if (jmodel == null) {
-            Message msg = new Message("FAIL_TO_CREATE_JAVA_MODEL", LOG);
-            throw new ToolException(msg);
-        }
-        registerGenerators(jmodel);
+        //Generate client, server and service stub codeS for specified profile
+        registerGenerators();
         doGeneration();
+
         if (env.get(ToolConstants.CFG_COMPILE) != null) {
             compile();
         }
@@ -106,13 +90,10 @@
             throw new ToolException(msg);
         }
 
-        JavaModel jmodel = wsdlDefinitionToJavaModel(def);
-        if (jmodel == null) {
-            Message msg = new Message("FAIL_TO_CREATE_JAVA_MODEL", LOG);
-            throw new ToolException(msg);
-        }
-        registerGenerators(jmodel);
+        //Generate client, server and service stub code for specified profile
+        registerGenerators();
         doGeneration();
+
         try {
             if (env.isExcludeNamespaceEnabled()) {
                 removeExcludeFiles();
@@ -157,6 +138,32 @@
         }
     }
 
+    private void registerGenerators() {
+        //FIXME: Get profile name from input parameters
+        String profile = null;
+        if (profile == null) {
+            profile = JAXWSProfile.class.getName();
+        }
+
+        PluginProfile profileObj = null;
+        try {
+            profileObj = (PluginProfile) Class.forName(profile).newInstance();
+        } catch (Exception e) {
+            Message msg = new Message("FAIl_TO_CREATE_PLUGINPROFILE", LOG);
+            throw new ToolException(msg);
+        }
+
+        //Setup JavaModel for generators.
+        JavaModel jmodel = wsdlDefinitionToJavaModel(getWSDLDefinition());
+        if (jmodel == null) {
+            Message msg = new Message("FAIL_TO_CREATE_JAVA_MODEL", LOG);
+            throw new ToolException(msg);
+        }
+        getEnvironment().setJavaModel(jmodel);
+
+        generators =  profileObj.getPlugins();
+    }
+
     private void generateTypes() throws ToolException {
         if (env.optionSet(ToolConstants.CFG_GEN_CLIENT) || env.optionSet(ToolConstants.CFG_GEN_SERVER)) {
             return;
@@ -168,20 +175,20 @@
             String dir = (String)env.get(ToolConstants.CFG_OUTPUTDIR);
 
             TypesCodeWriter fileCodeWriter = new TypesCodeWriter(new File(dir), excludePkgList);
-             
+
             if (rawJaxbModelGenCode instanceof S2JJAXBModel  && !nestedJaxbBinding) {
                 S2JJAXBModel schem2JavaJaxbModel = (S2JJAXBModel)rawJaxbModelGenCode;
-            
+
                 JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);
                 jcodeModel.build(fileCodeWriter);
                 excludeGenFiles = fileCodeWriter.getExcludeFileList();
             }
-            
+
             if (rawJaxbModelGenCode instanceof S2JJAXBModel  && nestedJaxbBinding) {
                 model.codeModel.build(fileCodeWriter);
                 excludeGenFiles = fileCodeWriter.getExcludeFileList();
             }
-            
+
             return;
         } catch (IOException e) {
             Message msg = new Message("FAIL_TO_GENERATE_TYPES", LOG);
@@ -198,7 +205,7 @@
         javaModel.setJAXWSBinding(customizing(definition));
 
         Map<QName, PortType> portTypes = getPortTypes(definition);
- 
+
         for (Iterator iter = portTypes.keySet().iterator(); iter.hasNext();) {
             PortType portType = (PortType)portTypes.get(iter.next());
             PortTypeProcessor portTypeProcessor = new PortTypeProcessor(getEnvironment());

Modified: incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java?rev=438854&r1=438853&r2=438854&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToProcessor.java Thu Aug 31 03:08:32 2006
@@ -74,6 +74,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.WSDLHelper;
+import org.apache.cxf.tools.common.GeneratorPlugin;
 import org.apache.cxf.tools.common.Processor;
 import org.apache.cxf.tools.common.ProcessorEnvironment;
 import org.apache.cxf.tools.common.ToolConstants;
@@ -85,7 +86,6 @@
 import org.apache.cxf.tools.util.URIParserUtil;
 import org.apache.cxf.tools.util.WSDLExtensionRegister;
 import org.apache.cxf.tools.validator.internal.WSDL11Validator;
-import org.apache.cxf.tools.wsdl2java.generator.AbstractGenerator;
 import org.apache.cxf.tools.wsdl2java.processor.internal.ClassNameAllocatorImpl;
 import org.apache.cxf.tools.wsdl2java.processor.internal.JAXBBindingMerger;
 
@@ -107,17 +107,16 @@
     protected List<String> excludeGenFiles;
     protected Map<QName, Service> importedServices = new java.util.HashMap<QName, Service>();
     protected Map<QName, PortType> importedPortTypes = new java.util.HashMap<QName, PortType>();
+    protected List<GeneratorPlugin> generators;
 
     //  For process nestedJaxbBinding
     protected boolean nestedJaxbBinding;
     protected Model model;
 
-    
     protected List<Schema> schemaList = new ArrayList<Schema>();
-    private final Map<String, AbstractGenerator> generators = new HashMap<String, AbstractGenerator>();
     private List<Definition> importedDefinitions = new ArrayList<Definition>();
     private List<String> schemaTargetNamespaces = new ArrayList<String>();
-    
+
     protected Writer getOutputWriter(String newNameExt) throws ToolException {
         Writer writer = null;
         String newName = null;
@@ -153,7 +152,7 @@
         try {
             writer = fw.getWriter("", newName);
         } catch (IOException ioe) {
-            org.apache.cxf.common.i18n.Message msg = 
+            org.apache.cxf.common.i18n.Message msg =
                 new org.apache.cxf.common.i18n.Message("FAIL_TO_WRITE_FILE",
                                                               LOG,
                                                               env.get(ToolConstants.CFG_OUTPUTDIR)
@@ -175,8 +174,8 @@
             parseImports(wsdlDefinition);
             buildImportedMaps();
         } catch (WSDLException we) {
-            org.apache.cxf.common.i18n.Message msg = 
-                new org.apache.cxf.common.i18n.Message("FAIL_TO_CREATE_WSDL_DEFINITION", 
+            org.apache.cxf.common.i18n.Message msg =
+                new org.apache.cxf.common.i18n.Message("FAIL_TO_CREATE_WSDL_DEFINITION",
                                                              LOG);
             throw new ToolException(msg, we);
         }
@@ -237,7 +236,7 @@
 
             Velocity.init(props);
         } catch (Exception e) {
-            org.apache.cxf.common.i18n.Message msg = 
+            org.apache.cxf.common.i18n.Message msg =
                 new org.apache.cxf.common.i18n.Message("FAIL_TO_INITIALIZE_VELOCITY_ENGINE",
                                                              LOG);
             LOG.log(Level.SEVERE, msg.toString());
@@ -277,7 +276,7 @@
         try {
             buildJaxbModel();
         } catch (Exception e) {
-            org.apache.cxf.common.i18n.Message msg = 
+            org.apache.cxf.common.i18n.Message msg =
                 new org.apache.cxf.common.i18n.Message("FAIL_TO_CREATE_JAXB_MODEL",
                                                              LOG);
             LOG.log(Level.SEVERE, msg.toString());
@@ -341,8 +340,8 @@
                 insource.setSystemId(systemid);
                 opt.setSchemaLanguage(Language.XMLSCHEMA);
                 opt.addGrammar(file);
-               
-            } 
+
+            }
 
         }
 
@@ -364,7 +363,7 @@
             model = ModelLoader.load(opt, new JCodeModel(), new JAXBErrorReceiver());
             model.generateCode(opt, new JAXBErrorReceiver());
         }
-       
+
     }
 
     @SuppressWarnings("unchecked")
@@ -496,10 +495,6 @@
         return this.wsdlDefinition;
     }
 
-    public void addGenerator(String name, AbstractGenerator gen) {
-        generators.put(name, gen);
-    }
-
     public void process() throws ToolException {
     }
 
@@ -511,9 +506,8 @@
     }
 
     protected void doGeneration() throws ToolException {
-        for (String genName : generators.keySet()) {
-            AbstractGenerator gen = generators.get(genName);
-            gen.generate();
+        for (GeneratorPlugin plugin : generators) {
+            plugin.generate(env);
         }
     }
 
@@ -555,14 +549,14 @@
 
     public void checkSupported(Definition def) throws ToolException {
         if (isSOAP12Binding(wsdlDefinition)) {
-            org.apache.cxf.common.i18n.Message msg = 
+            org.apache.cxf.common.i18n.Message msg =
                 new org.apache.cxf.common.i18n.Message("SOAP12_UNSUPPORTED",
                                                              LOG);
             throw new ToolException(msg);
         }
 
         if (isRPCEncoded(wsdlDefinition)) {
-            org.apache.cxf.common.i18n.Message msg = 
+            org.apache.cxf.common.i18n.Message msg =
                 new org.apache.cxf.common.i18n.Message("UNSUPPORTED_RPC_ENCODED",
                                                              LOG);
             throw new ToolException(msg);
@@ -623,7 +617,7 @@
         }
     }
 
-    private static enum Mode {       
+    private static enum Mode {
         CODE,
         BGM,
         SIGNATURE,
@@ -637,17 +631,17 @@
             if (env.isVerbose()) {
                 saxEx.printStackTrace();
             } else {
-                System.err.println("Use jaxb customization binding file to generate types warring " 
+                System.err.println("Use jaxb customization binding file to generate types warring "
                                    + saxEx.getMessage());
             }
-            
+
         }
 
         public void error(org.xml.sax.SAXParseException saxEx) throws com.sun.tools.xjc.AbortException {
             if (env.isVerbose()) {
                 saxEx.printStackTrace();
             } else {
-                System.err.println("Use jaxb customization binding file to generate types error " 
+                System.err.println("Use jaxb customization binding file to generate types error "
                                    + saxEx.getMessage());
             }
         }
@@ -655,14 +649,14 @@
         public void info(org.xml.sax.SAXParseException saxEx) {
             if (env.isVerbose()) {
                 saxEx.printStackTrace();
-            } 
+            }
         }
 
         public void fatalError(org.xml.sax.SAXParseException saxEx) throws com.sun.tools.xjc.AbortException {
             if (env.isVerbose()) {
                 saxEx.printStackTrace();
             } else {
-                System.err.println("Use jaxb customization binding file to generate types fatal error " 
+                System.err.println("Use jaxb customization binding file to generate types fatal error "
                                    + saxEx.getMessage());
             }
         }



Mime
View raw message