cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r487441 [1/3] - in /incubator/cxf/trunk: ./ rt/core/src/main/java/org/apache/cxf/wsdl/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/core/src/test/java/org/apache/cxf/wsdl11/ tools/common/src/main/java/org/apache/cxf/tools/common/ tools/c...
Date Fri, 15 Dec 2006 03:40:17 GMT
Author: mmao
Date: Thu Dec 14 19:40:13 2006
New Revision: 487441

URL: http://svn.apache.org/viewvc?view=rev&rev=487441
Log:
CXF-222 Tooling refactoring

* Plugable framework for multiple frontends and multiple databindings in wsdlto* tools.
* Added jaxws frontend as the default frontend, and jaxb databinding as the default databinding
* Change the ToolContainer API to simplify the process of the ToolRunner and unify the exception handling.
* Separate the definition builder and service builder, added wsdldefintionbuilder for wsdl11, and in tools we can use the WSDLDefinitionBuilder to generate the generate
  definition and use the frontend specific builder to customize the definition
* Added three command line arguments wv as the wsdlversion, fe/frontend as frontend name db/dababinding as databinding name.

Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java   (with props)
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java   (with props)
    incubator/cxf/trunk/tools2/
    incubator/cxf/trunk/tools2/pom.xml
      - copied, changed from r483855, incubator/cxf/trunk/tools/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/core/
    incubator/cxf/trunk/tools2/wsdlto/core/pom.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/Messages.properties
      - copied unchanged from r485994, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/Messages.properties
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java
      - copied, changed from r485994, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/WSDLToJava.java
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/Messages.properties
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/PluginLoader.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/cxf-tools-plugin.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/namespace2package.cfg
      - copied unchanged from r487143, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/namespace2package.cfg
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/wsdlto.xml
      - copied, changed from r485994, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdl2java.xml
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/wsdltojavaexclude.cfg
      - copied unchanged from r487143, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavaexclude.cfg
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/wsdltojavalib.properties
      - copied unchanged from r487143, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/wsdltojavalib.properties
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/schemas/
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/resources/schemas/plugin.xsd   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaTest.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLVersionTest.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/core/plugin.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/databinding/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/pom.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/apache/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/apache/cxf/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/apache/cxf/tools/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/apache/cxf/tools/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/apache/cxf/tools/wsdlto/databinding/
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/test/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/
    incubator/cxf/trunk/tools2/wsdlto/frontend/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfile.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-plugin.xml   (with props)
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java   (with props)
    incubator/cxf/trunk/tools2/wsdlto/pom.xml
      - copied, changed from r483855, incubator/cxf/trunk/tools/wsdl2java/pom.xml
Modified:
    incubator/cxf/trunk/pom.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/Tool.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolContainer.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolRunner.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSupport.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Argument.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainerTest.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/DummyToolContainer.java
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/ToolSupportTest.java

Modified: incubator/cxf/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/pom.xml?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/pom.xml (original)
+++ incubator/cxf/trunk/pom.xml Thu Dec 14 19:40:13 2006
@@ -51,7 +51,7 @@
             <id>apache.incubating</id>
             <name>Apache Incubating Repository</name>
             <url>scp://people.apache.org/www/people.apache.org/repo/m2-incubating-repository</url>
-        </repository>
+	</repository>
     </distributionManagement>
 
     <inceptionYear>2006</inceptionYear>

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,24 @@
+/**
+ * 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.wsdl;
+
+public interface WSDLBuilder<T> {
+    T build(String wsdlURL);
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties Thu Dec 14 19:40:13 2006
@@ -26,3 +26,4 @@
 EXTENSION_ADD_FAILED_MSG = Failed to add extension element.
 SERVICE_CREATION_MSG = Failed to create service.
 NO_SUCH_SERVICE_EXC = Could not find definition for service {0}.
+FAIL_TO_CREATE_WSDL_DEFINITION = Fail to create wsdl definition {0}

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,93 @@
+/**
+ * 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.wsdl11;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.xml.sax.InputSource;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.resource.URIResolver;
+import org.apache.cxf.wsdl.WSDLBuilder;
+import org.apache.cxf.wsdl4jutils.WSDLResolver;
+
+public class WSDLDefinitionBuilder implements WSDLBuilder<Definition> {
+    protected static final Logger LOG = LogUtils.getL7dLogger(WSDLDefinitionBuilder.class);
+    protected WSDLFactory wsdlFactory;
+    protected WSDLReader wsdlReader;
+    protected Definition wsdlDefinition;
+    private List<Definition> importedDefinitions = new ArrayList<Definition>();
+    
+    public Definition build(String wsdlURL) {
+        parseWSDL(wsdlURL);
+        return wsdlDefinition;
+    }
+
+    protected void parseWSDL(String wsdlURL) {
+        try {
+            wsdlFactory = WSDLFactory.newInstance();
+            wsdlReader = wsdlFactory.newWSDLReader();
+            wsdlReader.setFeature("javax.wsdl.verbose", false);
+            // REVISIT: JAXWS/JMS/XML extensions, should be provided by the WSDLServiceBuilder
+            //          Do we need to expose the wsdlReader and wsdlFactory? 
+            //            WSDLExtensionRegister register = new WSDLExtensionRegister(wsdlFactory, wsdlReader);
+            //            register.registerExtensions();
+            URIResolver resolver = new URIResolver(wsdlURL);
+            InputSource insource = new InputSource(resolver.getInputStream());
+            wsdlURL = resolver.getURI().toString();
+            wsdlDefinition = wsdlReader.readWSDL(new WSDLResolver(wsdlURL, insource));
+
+            parseImports(wsdlDefinition);
+        } catch (Exception we) {
+            Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION",
+                                      LOG, 
+                                      wsdlURL);
+            throw new RuntimeException(msg.toString(), we);
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    private void parseImports(Definition def) {
+        List<Import> importList = new ArrayList<Import>();
+        Map imports = def.getImports();
+        for (Iterator iter = imports.keySet().iterator(); iter.hasNext();) {
+            String uri = (String)iter.next();
+            importList.addAll((List<Import>)imports.get(uri));
+        }
+        for (Import impt : importList) {
+            parseImports(impt.getDefinition());
+            importedDefinitions.add(impt.getDefinition());
+        }
+    }
+    
+    public List<Definition> getImportedDefinitions() {
+        return importedDefinitions;
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Thu Dec 14 19:40:13 2006
@@ -107,6 +107,16 @@
             }
         }
     }
+    
+    @SuppressWarnings("unchecked")
+    public List<ServiceInfo> buildService(Definition d) {
+        List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
+        for (java.util.Iterator<QName> ite = d.getServices().keySet().iterator(); ite.hasNext();) {
+            QName qn = ite.next();            
+            serviceList.add(buildService(d, qn));
+        }
+        return serviceList;
+    }
 
     public ServiceInfo buildService(Definition d, QName name) {
         Service service = d.getService(name);

Added: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java (added)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,53 @@
+/**
+ * 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.wsdl11;
+
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+public class WSDLDefinitionBuilderTest extends TestCase {
+
+    public void testBuildSimpleWSDL() throws Exception {
+        String qname = "http://apache.org/hello_world_soap_http";
+        String wsdlUrl = getClass().getResource("hello_world.wsdl").toString();
+        
+        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder();
+        Definition def = builder.build(wsdlUrl);
+        assertNotNull(def);
+        
+        Map services = def.getServices();
+        assertNotNull(services);
+        assertEquals(1, services.size());
+        Service service = (Service)services.get(new QName(qname, "SOAPService"));
+        assertNotNull(service);
+        
+        Map ports = service.getPorts();
+        assertNotNull(ports);
+        assertEquals(1, ports.size());
+        Port port = service.getPort("SoapPort");
+        assertNotNull(port);        
+    }
+}

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/AbstractCXFToolContainer.java Thu Dec 14 19:40:13 2006
@@ -60,15 +60,15 @@
         return instance;
     }
     public boolean hasInfoOption() throws ToolException {
-        boolean result = false;
         commandDocument = getCommandDocument();
         if ((commandDocument.hasParameter("help")) || (commandDocument.hasParameter("version"))) {
-            result = true;
+            return true;
         }
-        return result;
+        return false;
     }
 
     public void execute(boolean exitOnFinish) throws ToolException {
+        super.execute(exitOnFinish);
         if (hasInfoOption()) {
             outputInfo();
         } else {

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Thu Dec 14 19:40:13 2006
@@ -180,4 +180,15 @@
     public static final String IMPORTED_SERVICE = "importedService";
     public static final String BINDING_GENERATOR = "BindingGenerator";
 
+    // Tools framework
+    public static final String FRONTEND_PLUGIN = "frontend";
+    public static final String DATABINDING_PLUGIN = "databinding";
+    
+    public static final String CFG_WSDL_VERSION = "wsdlversion";
+    
+    public enum WSDLVersion {
+        WSDL11,
+        WSDL20,
+        UNKNOWN
+    };
 }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java Thu Dec 14 19:40:13 2006
@@ -73,6 +73,14 @@
         this.javaModel = jModel;
     }
 
+    public void addParameters(Map<String, Object> map) {
+        for (String key : map.keySet()) {
+            if (!optionSet(key)) {
+                put(key, map.get(key));
+            }
+        }
+    }
+    
     public void setParameters(Map<String, Object> map) {
         this.paramMap = map;
     }
@@ -92,6 +100,14 @@
             return get(key);
         }
     }
+
+    public <T> T get(Class<T> key) {
+        return key.cast(get(key.getName()));
+    }
+    
+    public <T> void put(Class<T> key, T value) {
+        put(key.getName(), value);
+    } 
 
     public boolean getBooleanValue(String key, String defaultValue) {
         return Boolean.valueOf((String)get(key, defaultValue)).booleanValue();

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java Thu Dec 14 19:40:13 2006
@@ -27,6 +27,7 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.toolspec.parser.BadUsageException;
 import org.apache.cxf.tools.common.toolspec.parser.CommandDocument;
@@ -37,12 +38,15 @@
     private static String arguments[];
 
     protected ToolSpec toolspec;
-
+    protected ToolContext context;
+    
     private boolean isQuiet;
     private CommandDocument commandDoc;
     private CommandLineParser parser;
     private OutputStream outOutputStream;
     private OutputStream errOutputStream;
+    
+    
 
     public class GenericOutputStream extends OutputStream {
         public void write(int b) throws IOException {
@@ -54,17 +58,19 @@
         toolspec = ts;
     }
 
-    public void setCommandLine(String[] args) throws BadUsageException {
+    public void setArguments(String[] args) {
         arguments = new String[args.length];
         System.arraycopy(args, 0, arguments, 0, args.length);
         setMode(args);
         if (isQuietMode()) {
             redirectOutput();
-        }
+        }        
+    }
+    
+    public void parseCommandLine() throws BadUsageException {
         if (toolspec != null) {
             parser = new CommandLineParser(toolspec);
-            commandDoc = parser.parseArguments(args);
-           
+            commandDoc = parser.parseArguments(arguments);           
         }
     }
 
@@ -128,7 +134,25 @@
     public OutputStream getErrOutputStream() {
         return errOutputStream;
     }
+    
+    public void setContext(ToolContext c) {
+        context = c;
+    }
+    
+    public ToolContext getContext() {
+        if (context == null) {
+            context = new ToolContext();
+        }
+        return context;
+    }
 
-    public abstract void execute(boolean exitOnFinish) throws ToolException;
+    public void execute(boolean exitOnFinish) throws ToolException {
+        init();
+        try {
+            parseCommandLine();
+        } catch (BadUsageException bue) {
+            throw new ToolException(bue);
+        }        
+    }
 
 }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/Tool.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/Tool.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/Tool.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/Tool.java Thu Dec 14 19:40:13 2006
@@ -25,8 +25,6 @@
 
     void init() throws ToolException;
 
-    void setContext(ToolContext ctx);
-
     /**
      * A tool has to be prepared to perform it's duty any number of times.
      */

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolContainer.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolContainer.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolContainer.java Thu Dec 14 19:40:13 2006
@@ -18,13 +18,12 @@
  */
 
 package org.apache.cxf.tools.common.toolspec;
+
+import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
-import org.apache.cxf.tools.common.toolspec.parser.BadUsageException;
 
 public interface ToolContainer {
-
-    void setCommandLine(String[] args) throws BadUsageException;
-    void init() throws ToolException;
     void execute(boolean exitOnFinish) throws ToolException;
-
+    void setContext(ToolContext context);    
+    void setArguments(String[] args);
 }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolRunner.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolRunner.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolRunner.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolRunner.java Thu Dec 14 19:40:13 2006
@@ -26,6 +26,7 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 public final class ToolRunner {
     private static final Logger LOG = LogUtils.getL7dLogger(ToolRunner.class);
@@ -38,11 +39,25 @@
         runTool(clz, toolspecStream, validate, args, true);
     }
 
+    public static void runTool(Class clz, InputStream toolspecStream,
+                               boolean validate, String[] args, ToolContext context) throws Exception {
+        runTool(clz, toolspecStream, validate, args, true, context);
+    }
+
     public static void runTool(Class clz,
                                InputStream toolspecStream,
                                boolean validate,
                                String[] args,
                                boolean exitOnFinish) throws Exception {
+        runTool(clz, toolspecStream, validate, args, true, null);
+    }
+    
+    public static void runTool(Class clz,
+                               InputStream toolspecStream,
+                               boolean validate,
+                               String[] args,
+                               boolean exitOnFinish,
+                               ToolContext context) throws Exception {
 
         if (ToolContainer.class.isAssignableFrom(clz)) {
 
@@ -64,8 +79,8 @@
             }
 
             try {
-                container.setCommandLine(args);
-                container.init();
+                container.setArguments(args);
+                container.setContext(context);
                 container.execute(exitOnFinish);
             } catch (Exception ex) {
                 throw ex;

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSupport.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSupport.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSupport.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSupport.java Thu Dec 14 19:40:13 2006
@@ -27,23 +27,12 @@
 public class ToolSupport implements Tool {
 
     private static final Logger LOG = LogUtils.getL7dLogger(ToolSupport.class);
-    private ToolContext ctx;
+    //private ToolContext ctx;
 
     public void init() throws ToolException {
         if (LOG.isLoggable(Level.INFO)) {
             LOG.info("Initializing " + this);
         }
-    }
-
-    public void setContext(ToolContext c) {
-        if (LOG.isLoggable(Level.INFO)) {
-            LOG.info("Setting context to " + c);
-        }
-        this.ctx = c;
-    }
-
-    public ToolContext getContext() {
-        return ctx;
     }
 
     public void performFunction() throws ToolException {

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Argument.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Argument.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Argument.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/Argument.java Thu Dec 14 19:40:13 2006
@@ -111,21 +111,19 @@
     }
 
     public boolean isSatisfied(ErrorVisitor errors) {
-        boolean result = true;
-
         if (errors.getErrors().size() > 0) {
-            result = false;
+            return false;
         }
-        if (result && !isAtleastMinimum()) {
+        if (!isAtleastMinimum()) {
             errors.add(new ErrorVisitor.MissingArgument(getName()));
-            result = false;
+            return false;
         }
-        if (result && !isNoGreaterThanMaximum()) {
+        if (!isNoGreaterThanMaximum()) {
             errors.add(new ErrorVisitor.DuplicateArgument(getName()));
-            result = false;
+            return false;
         }
 
-        return result;
+        return true;
     }
 
     public void setToolSpec(ToolSpec toolSpec) {

Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainerTest.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainerTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainerTest.java Thu Dec 14 19:40:13 2006
@@ -37,7 +37,8 @@
     public void testQuietMode() {
         // catch all exception in here.
         try {
-            dummyTool.setCommandLine(new String[] {"-q"});
+            dummyTool.setArguments(new String[] {"-q"});
+            dummyTool.parseCommandLine();
         } catch (Exception e) {
             // caught expected exception
         }

Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/DummyToolContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/DummyToolContainer.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/DummyToolContainer.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/DummyToolContainer.java Thu Dec 14 19:40:13 2006
@@ -28,7 +28,7 @@
     }
 
     public void execute(boolean exitOnFinish) throws ToolException {
-
+        super.execute(exitOnFinish);
     }
 
 }

Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/ToolSupportTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/ToolSupportTest.java?view=diff&rev=487441&r1=487440&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/ToolSupportTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/toolspec/ToolSupportTest.java Thu Dec 14 19:40:13 2006
@@ -29,7 +29,6 @@
         
         toolSupport.performFunction();
         toolSupport.destroy();
-        assertTrue(toolSupport.getContext() == null);
     }
 
 }

Copied: incubator/cxf/trunk/tools2/pom.xml (from r483855, incubator/cxf/trunk/tools/pom.xml)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/pom.xml?view=diff&rev=487441&p1=incubator/cxf/trunk/tools/pom.xml&r1=483855&p2=incubator/cxf/trunk/tools2/pom.xml&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/pom.xml (original)
+++ incubator/cxf/trunk/tools2/pom.xml Thu Dec 14 19:40:13 2006
@@ -19,10 +19,10 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.cxf</groupId>
-    <artifactId>cxf-tools</artifactId>
+    <artifactId>cxf-tools2</artifactId>
     <packaging>pom</packaging>
     <version>2.0-incubator-RC-SNAPSHOT</version>
-    <name>Apache CXF Command Line Tools</name>
+    <name>Apache CXF Command Line Tools2</name>
     <url>http://cwiki.apache.org/confluence/display/CXF/Index</url>
 
     <parent>
@@ -36,11 +36,6 @@
     </properties>
     
     <modules>
-            <module>common</module>
-            <module>validator</module>
-            <module>wsdl2java</module>
-            <module>java2wsdl</module>
-            <module>misctools</module>            
-            <module>xjc</module>
+	<module>wsdlto</module>
     </modules>
 </project>

Added: incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/pom.xml?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/pom.xml (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/pom.xml Thu Dec 14 19:40:13 2006
@@ -0,0 +1,157 @@
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf</groupId>
+    <artifactId>cxf-tools2-wsdlto-core</artifactId>
+    <packaging>jar</packaging>
+    <version>2.0-incubator-RC-SNAPSHOT</version>
+    <name>Apache CXF Command Line Tools2 WSDLTo</name>
+    <url>http://cwiki.apache.org/confluence/display/CXF/Index</url>
+
+    <parent>
+	<groupId>org.apache.cxf</groupId>
+	<artifactId>cxf-tools2-wsdlto</artifactId>
+	<version>2.0-incubator-RC-SNAPSHOT</version>
+    </parent>
+
+    <properties>
+	<topDirectoryLocation>../../</topDirectoryLocation>
+    </properties>
+
+    <dependencies>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-tools-common</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-common-schemas</artifactId>
+	    <version>${project.version}</version>
+	    <scope>test</scope>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-tools-validator</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-rt-core</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-api</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+
+	<dependency>
+	    <groupId>junit</groupId>
+	    <artifactId>junit</artifactId>
+	    <scope>test</scope>
+	</dependency>
+	<dependency>
+	    <groupId>org.easymock</groupId>
+	    <artifactId>easymockclassextension</artifactId>
+	    <scope>test</scope>
+	</dependency>
+	<dependency>
+	    <groupId>asm</groupId>
+	    <artifactId>asm</artifactId>
+	    <scope>test</scope>
+	</dependency>
+
+	<dependency>
+	    <groupId>velocity</groupId>
+	    <artifactId>velocity</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>wsdl4j</groupId>
+	    <artifactId>wsdl4j</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>com.sun.xml.bind</groupId>
+	    <artifactId>jaxb-xjc</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>com.sun.xml.bind</groupId>
+	    <artifactId>jaxb-impl</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>javax.xml.ws</groupId>
+	    <artifactId>jaxws-api</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>javax.xml.soap</groupId>
+	    <artifactId>saaj-api</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>woodstox</groupId>
+	    <artifactId>wstx-asl</artifactId>
+	    <scope>runtime</scope>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-common-utilities</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-common-schemas</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+<!--
+	<dependency>
+	    <groupId>org.codehaus.castor</groupId>
+	    <artifactId>castor</artifactId>
+	    <version>1.0.4</version>
+	</dependency>
+-->
+    </dependencies>
+
+    <build>
+	<plugins>
+	    <plugin>
+		<groupId>org.apache.cxf</groupId>
+		<artifactId>cxf-common-xsd</artifactId>
+		<version>${project.version}</version>
+		<executions>
+		    <execution>
+			<id>generate-sources</id>
+			<phase>generate-sources</phase>
+			<configuration>
+			    <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+			    <xsdOptions>
+				<xsdOption>
+				    <xsd>${basedir}/src/main/resources/schemas/plugin.xsd</xsd>
+				</xsdOption>
+			    </xsdOptions>
+			</configuration>
+			<goals>
+			    <goal>xsdtojava</goal>
+			</goals>
+		    </execution>
+		</executions>
+	    </plugin>
+	</plugins>
+    </build>
+</project>

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java (from r485994, incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/WSDLToJava.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java?view=diff&rev=487441&p1=incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/WSDLToJava.java&r1=485994&p2=incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java&r2=487441
==============================================================================
--- incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/WSDLToJava.java (original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJava.java Thu Dec 14 19:40:13 2006
@@ -17,231 +17,144 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdl2java;
+package org.apache.cxf.tools.wsdlto;
 
-import java.io.File;
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
+import java.io.*;
+import java.util.*;
 
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.tools.common.AbstractCXFToolContainer;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.toolspec.ToolRunner;
-import org.apache.cxf.tools.common.toolspec.ToolSpec;
-import org.apache.cxf.tools.common.toolspec.parser.BadUsageException;
-import org.apache.cxf.tools.common.toolspec.parser.CommandDocument;
-import org.apache.cxf.tools.common.toolspec.parser.ErrorVisitor;
-import org.apache.cxf.tools.wsdl2java.processor.WSDLToJavaProcessor;
+import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
+import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
+import org.apache.cxf.tools.wsdlto.core.PluginLoader;
 
-public class WSDLToJava extends AbstractCXFToolContainer {
-    
-    private static final String TOOL_NAME = "wsdl2java";
-    private static final String DEFAULT_NS2PACKAGE = "http://www.w3.org/2005/08/addressing";
-    private static String[] args;
-
-    public WSDLToJava(ToolSpec toolspec) throws Exception {
-        super(TOOL_NAME, toolspec);
-    }
+public class WSDLToJava {
 
-    private Set getArrayKeys() {
-        Set<String> set = new HashSet<String>();
-        set.add(ToolConstants.CFG_BINDING);
-        set.add(ToolConstants.CFG_PACKAGENAME);
-        set.add(ToolConstants.CFG_NEXCLUDE);
-        return set;
-    }
+    private static String[] args;
+    private static final String DEFAULT_FRONTEND_NAME = "jaxws";
+    private static final String DEFAULT_DATABINDING_NAME = "jaxb";
     
-    public void execute(boolean exitOnFinish) {
-        WSDLToJavaProcessor processor = new WSDLToJavaProcessor();
-        try {
-            super.execute(exitOnFinish);
-            if (!hasInfoOption()) {
-                ToolContext env = new ToolContext();
-                env.setParameters(getParametersMap(getArrayKeys()));
-                if (env.get(ToolConstants.CFG_OUTPUTDIR) == null) {
-                    env.put(ToolConstants.CFG_OUTPUTDIR, ".");
-                }
-
-                if (env.containsKey(ToolConstants.CFG_ANT)) {
-                    setAntProperties(env);
-                    setLibraryReferences(env);
-                }
-
-                if (isVerboseOn()) {
-                    env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
-                }
-                env.put(ToolConstants.CFG_CMD_ARG, args);
-
-                validate(env);
-                setExcludePackageAndNamespaces(env);
-                loadDefaultNSPackageMapping(env);
-                setPackageAndNamespaces(env);
-                processor.setEnvironment(env);
-                processor.process();
-            }
-        } catch (ToolException ex) {
-            System.err.println("Error : " + ex.getMessage());
-            if (ex.getCause() instanceof BadUsageException) {
-                getInstance().printUsageException(TOOL_NAME, (BadUsageException)ex.getCause());
-            }
-            System.err.println();
-            if (isVerboseOn()) {
-                ex.printStackTrace();
-            }
-        } catch (Exception ex) {
-            System.err.println("Error : " + ex.getMessage());
-            System.err.println();
-            if (isVerboseOn()) {
-                ex.printStackTrace();
-            }
+    private PluginLoader pluginLoader = PluginLoader.getInstance();
+
+    private FrontEndProfile loadFrontEnd(String name) {
+        if (StringUtils.isEmpty(name)) {
+            name = DEFAULT_FRONTEND_NAME;
+        }
+        if (isVerbose()) {
+            System.out.println("Loading FrontEnd " + name + " ...");
         }
+        return pluginLoader.getFrontEndProfile(name);
     }
 
-    private void loadDefaultNSPackageMapping(ToolContext env) {
-        if (!env.hasExcludeNamespace(DEFAULT_NS2PACKAGE) 
-            && env.getBooleanValue(ToolConstants.CFG_DEFAULT_NS, "true")) {
-            env.loadDefaultNS2Pck(getResourceAsStream("namespace2package.cfg"));
-        }
-        if (env.getBooleanValue(ToolConstants.CFG_DEFAULT_EX, "true")) {
-            env.loadDefaultExcludes(getResourceAsStream("wsdltojavaexclude.cfg"));
+    private DataBindingProfile loadDataBinding(String name) {
+        if (StringUtils.isEmpty(name)) {
+            name = DEFAULT_DATABINDING_NAME;
+        }
+        if (isVerbose()) {
+            System.out.println("Loading DataBinding " + name + " ...");
         }
+        return pluginLoader.getDataBindingProfile(name);
     }
+    
+    protected void run(ToolContext context) throws Exception {
+        context.put(ToolConstants.CFG_CMD_ARG, args);
+        
+        FrontEndProfile frontend = loadFrontEnd(getFrontEndName(args));
+        context.put(FrontEndProfile.class, frontend);
+        
+        DataBindingProfile databinding = loadDataBinding(getDataBindingName(args));
+        context.put(DataBindingProfile.class, databinding);
+        
+        Class containerClass = frontend.getContainerClass();
 
-
-    private void setExcludePackageAndNamespaces(ToolContext env) {
-        if (env.get(ToolConstants.CFG_NEXCLUDE) != null) {
-            String[] pns = (String[])env.get(ToolConstants.CFG_NEXCLUDE);
-            for (int j = 0; j < pns.length; j++) {
-                int pos = pns[j].indexOf("=");
-                String excludePackagename = pns[j];
-                if (pos != -1) {
-                    String ns = pns[j].substring(0, pos);
-                    excludePackagename = pns[j].substring(pos + 1);
-                    env.addExcludeNamespacePackageMap(ns, excludePackagename);
-                } else {
-                    env.addExcludeNamespacePackageMap(pns[j], null);
-                }
-            }
-        }
+        InputStream toolspecStream = getResourceAsStream(containerClass, frontend.getToolspec());
+        
+        ToolRunner.runTool(containerClass,
+                           toolspecStream,
+                           false,
+                           args,
+                           context);
+    }
+        
+    protected static boolean isVerbose() {
+        return isSet(new String[]{"-V", "-verbose"});
     }
     
-    private void setPackageAndNamespaces(ToolContext env) {
-        if (env.get(ToolConstants.CFG_PACKAGENAME) != null) {
-            String[] pns = (String[])env.get(ToolConstants.CFG_PACKAGENAME);
-            for (int j = 0; j < pns.length; j++) {
-                int pos = pns[j].indexOf("=");
-                String packagename = pns[j];
-                if (pos != -1) {
-                    String ns = pns[j].substring(0, pos);
-                    packagename = pns[j].substring(pos + 1);
-                    env.addNamespacePackageMap(ns, packagename);
-                } else {
-                    env.setPackageName(packagename);
-                }
+    private static boolean isSet(String[] keys) {
+        List<String> pargs = Arrays.asList(args);
+        
+        for (String key : keys) {
+            if (pargs.contains(key)) {
+                return true;
             }
         }
+        return false;
     }
 
-    private void validate(ToolContext env) throws ToolException {
-        String outdir = (String)env.get(ToolConstants.CFG_OUTPUTDIR);
-        if (outdir != null) {
-            File dir = new File(outdir);
-            if (!dir.exists()) {
-                Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, outdir);
-                throw new ToolException(msg);
-            }
-            if (!dir.isDirectory()) {
-                Message msg = new Message("NOT_A_DIRECTORY", LOG, outdir);
-                throw new ToolException(msg);
-            }
+    private String parseArguments(String[] pargs, String key) {
+        if (pargs == null) {
+            return null;
         }
+        List<String> largs = Arrays.asList(pargs);
 
-        if (env.containsKey(ToolConstants.CFG_BINDING)) {
-            String[] bindings = (String[])env.get(ToolConstants.CFG_BINDING);
-            for (int i = 0; i < bindings.length; i++) {
-                File binding = new File(bindings[i]);
-                if (!binding.exists()) {
-                    Message msg = new Message("FILE_NOT_EXIST", LOG, binding);
-                    throw new ToolException(msg);
-                } else if (binding.isDirectory()) {
-                    Message msg = new Message("NOT_A_FILE", LOG, binding);
-                    throw new ToolException(msg);
-                }
+        int index = 0;
+        if (largs.contains(key)) {
+            index = largs.indexOf(key);
+            if (index + 1 < largs.size()) {
+                return largs.get(index + 1);
             }
         }
-        
-        if (!env.optionSet(ToolConstants.CFG_EXTRA_SOAPHEADER)) {
-            env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "false");
-        }
-        
-        if (env.optionSet(ToolConstants.CFG_COMPILE)) {
-            String clsdir = (String)env.get(ToolConstants.CFG_CLASSDIR);
-            if (clsdir != null) {
-                File dir = new File(clsdir);
-                if (!dir.exists()) {
-                    Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, clsdir);
-                    throw new ToolException(msg);
-                }
+        return null;
+    }
+
+    private String getOptionValue(String[] pargs, String[] keys) {
+        for (String key : keys) {
+            String value = parseArguments(pargs, key);
+            if (!StringUtils.isEmpty(value)) {
+                return value.trim();
             }
         }
+        return null;
+    }
+    
+    protected String getFrontEndName(String[] pargs) {
+        return getOptionValue(pargs, new String[]{"-frontend", "-fe"});
     }
 
-    protected void setAntProperties(ToolContext env) {
-        String installDir = System.getProperty("install.dir");
-        if (installDir != null) {
-            env.put(ToolConstants.CFG_INSTALL_DIR, installDir);
-        } else {
-            env.put(ToolConstants.CFG_INSTALL_DIR, ".");
-        }
+    protected String getDataBindingName(String[] pargs) {
+        return getOptionValue(pargs, new String[]{"-databinding", "-db"});
     }
 
-    protected void setLibraryReferences(ToolContext env) {
-        Properties props = loadProperties(getResourceAsStream("wsdltojavalib.properties"));
-        if (props != null) {
-            for (Iterator keys = props.keySet().iterator(); keys.hasNext();) {
-                String key = (String)keys.next();
-                env.put(key, props.get(key));
-            }
-        }
-        env.put(ToolConstants.CFG_ANT_PROP, props);
+    public void setArguments(String[] pargs) {
+        this.args = pargs;
     }
 
     public static void main(String[] pargs) {
         args = pargs;
 
         try {
-            ToolRunner.runTool(WSDLToJava.class,
-                               getResourceAsStream("wsdl2java.xml"),
-                               false,
-                               args);
-        } catch (BadUsageException ex) {
-            getInstance().printUsageException(TOOL_NAME, ex);
+            
+            new WSDLToJava().run(new ToolContext());
+            
+        } catch (ToolException ex) {
+            System.err.println("Error : " + ex.getMessage());
+            System.err.println();
+            if (isVerbose()) {
+                ex.printStackTrace();
+            }
         } catch (Exception ex) {
             System.err.println("Error : " + ex.getMessage());
             System.err.println();
-            ex.printStackTrace();
+            if (isVerbose()) {
+                ex.printStackTrace();
+            }
         }
     }
 
-    public void checkParams(ErrorVisitor errors) throws ToolException {
-        CommandDocument doc = super.getCommandDocument();
-
-        if (!doc.hasParameter("wsdlurl")) {
-            errors.add(new ErrorVisitor.UserError("WSDL/SCHEMA URL has to be specified"));
-        }
-        if (errors.getErrors().size() > 0) {
-            Message msg = new Message("PARAMETER_MISSING", LOG);
-            throw new ToolException(msg, new BadUsageException(getUsage(), errors));
-        }
+    private static InputStream getResourceAsStream(Class clz, String file) {
+        return clz.getResourceAsStream(file);
     }
-    
-    private static InputStream getResourceAsStream(String file) {
-        return WSDLToJava.class.getResourceAsStream(file);
-    }
-    
 }

Added: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,256 @@
+/**
+ * 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.wsdlto;
+
+import java.io.*;
+import java.util.*;
+import javax.wsdl.Definition;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.common.i18n.Message;
+//import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.AbstractCXFToolContainer;
+import org.apache.cxf.tools.common.Processor;
+import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.ToolException;
+import org.apache.cxf.tools.common.toolspec.ToolSpec;
+import org.apache.cxf.tools.common.toolspec.parser.BadUsageException;
+import org.apache.cxf.tools.common.toolspec.parser.CommandDocument;
+import org.apache.cxf.tools.common.toolspec.parser.ErrorVisitor;
+import org.apache.cxf.tools.wsdlto.core.AbstractWSDLBuilder;
+import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
+
+public class WSDLToJavaContainer extends AbstractCXFToolContainer {
+
+    private static final String DEFAULT_NS2PACKAGE = "http://www.w3.org/2005/08/addressing";
+    String toolName;
+
+    public WSDLToJavaContainer(String name, ToolSpec toolspec) throws Exception {        
+        super(name, toolspec);
+        this.toolName = name;
+    }
+
+    protected Set<String> getArrayKeys() {
+        Set<String> set = new HashSet<String>();
+        set.add(ToolConstants.CFG_PACKAGENAME);
+        set.add(ToolConstants.CFG_NEXCLUDE);
+        return set;
+    }
+
+    private ToolConstants.WSDLVersion getWSDLVersion() {
+        String version = (String) context.get(ToolConstants.CFG_WSDL_VERSION);
+        return WSDLVersion.getVersion(version);
+    }
+
+    private Bus getBus() {
+        return BusFactoryHelper.newInstance().getDefaultBus();
+    }
+    
+    public void execute(boolean exitOnFinish) throws ToolException {
+        try {
+            super.execute(exitOnFinish);
+            if (!hasInfoOption()) {
+                buildToolContext();
+                validate(context);
+                
+                FrontEndProfile frontend = context.get(FrontEndProfile.class);
+                
+                Processor processor = frontend.getProcessor();
+
+                AbstractWSDLBuilder builder = frontend.getWSDLBuilder();
+                
+                ToolConstants.WSDLVersion version = getWSDLVersion();
+
+                //List<ServiceInfo> services;
+                String wsdlURL = (String)context.get(ToolConstants.CFG_WSDLURL);
+                if (version == ToolConstants.WSDLVersion.WSDL11) {
+                    Definition definition = (Definition) builder.build(wsdlURL);
+                    
+                    if (context.optionSet(ToolConstants.CFG_BINDING)) {
+                        builder.setContext(context);
+                        builder.customize(definition);
+                    }
+                    WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
+                    //services = 
+                    serviceBuilder.buildService(definition);
+                } else {
+                    // TODO: wsdl2.0 support
+                }
+                
+                processor.setEnvironment(context);
+                // TODO: replace the wsdl4j with service model
+                //processor.setServiceModel(services);
+                processor.process();
+            }
+        } catch (ToolException ex) {
+            if (ex.getCause() instanceof BadUsageException) {
+                getInstance().printUsageException(toolName, (BadUsageException)ex.getCause());
+            }
+            System.err.println();
+            if (isVerboseOn()) {
+                ex.printStackTrace();
+            }
+        } catch (Exception ex) {
+            System.err.println("Error : " + ex.getMessage());
+            System.err.println();
+            if (isVerboseOn()) {
+                ex.printStackTrace();
+            }
+        }
+    }
+    
+    private void loadDefaultNSPackageMapping(ToolContext env) {
+        if (!env.hasExcludeNamespace(DEFAULT_NS2PACKAGE) 
+            && env.getBooleanValue(ToolConstants.CFG_DEFAULT_NS, "true")) {
+            env.loadDefaultNS2Pck(getResourceAsStream("namespace2package.cfg"));
+        }
+        if (env.getBooleanValue(ToolConstants.CFG_DEFAULT_EX, "true")) {
+            env.loadDefaultExcludes(getResourceAsStream("wsdltojavaexclude.cfg"));
+        }
+    }
+
+
+    private void setExcludePackageAndNamespaces(ToolContext env) {
+        if (env.get(ToolConstants.CFG_NEXCLUDE) != null) {
+            String[] pns = (String[])env.get(ToolConstants.CFG_NEXCLUDE);
+            for (int j = 0; j < pns.length; j++) {
+                int pos = pns[j].indexOf("=");
+                String excludePackagename = pns[j];
+                if (pos != -1) {
+                    String ns = pns[j].substring(0, pos);
+                    excludePackagename = pns[j].substring(pos + 1);
+                    env.addExcludeNamespacePackageMap(ns, excludePackagename);
+                } else {
+                    env.addExcludeNamespacePackageMap(pns[j], null);
+                }
+            }
+        }
+    }
+    
+    private void setPackageAndNamespaces(ToolContext env) {
+        if (env.get(ToolConstants.CFG_PACKAGENAME) != null) {
+            String[] pns = (String[])env.get(ToolConstants.CFG_PACKAGENAME);
+            for (int j = 0; j < pns.length; j++) {
+                int pos = pns[j].indexOf("=");
+                String packagename = pns[j];
+                if (pos != -1) {
+                    String ns = pns[j].substring(0, pos);
+                    packagename = pns[j].substring(pos + 1);
+                    env.addNamespacePackageMap(ns, packagename);
+                } else {
+                    env.setPackageName(packagename);
+                }
+            }
+        }
+    }
+
+    public void validate(ToolContext env) throws ToolException {
+        String outdir = (String)env.get(ToolConstants.CFG_OUTPUTDIR);
+        if (outdir != null) {
+            File dir = new File(outdir);
+            if (!dir.exists()) {
+                Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, outdir);
+                throw new ToolException(msg);
+            }
+            if (!dir.isDirectory()) {
+                Message msg = new Message("NOT_A_DIRECTORY", LOG, outdir);
+                throw new ToolException(msg);
+            }
+        }
+
+        if (!env.optionSet(ToolConstants.CFG_EXTRA_SOAPHEADER)) {
+            env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "false");
+        }
+        
+        if (env.optionSet(ToolConstants.CFG_COMPILE)) {
+            String clsdir = (String)env.get(ToolConstants.CFG_CLASSDIR);
+            if (clsdir != null) {
+                File dir = new File(clsdir);
+                if (!dir.exists()) {
+                    Message msg = new Message("DIRECTORY_NOT_EXIST", LOG, clsdir);
+                    throw new ToolException(msg);
+                }
+            }
+        }
+    }
+
+    protected void setAntProperties(ToolContext env) {
+        String installDir = System.getProperty("install.dir");
+        if (installDir != null) {
+            env.put(ToolConstants.CFG_INSTALL_DIR, installDir);
+        } else {
+            env.put(ToolConstants.CFG_INSTALL_DIR, ".");
+        }
+    }
+
+    protected void setLibraryReferences(ToolContext env) {
+        Properties props = loadProperties(getResourceAsStream("wsdltojavalib.properties"));
+        if (props != null) {
+            for (Iterator keys = props.keySet().iterator(); keys.hasNext();) {
+                String key = (String)keys.next();
+                env.put(key, props.get(key));
+            }
+        }
+        env.put(ToolConstants.CFG_ANT_PROP, props);
+    }
+
+    private void buildToolContext() {
+        context = getContext();
+        context.addParameters(getParametersMap(getArrayKeys()));
+
+        if (context.get(ToolConstants.CFG_OUTPUTDIR) == null) {
+            context.put(ToolConstants.CFG_OUTPUTDIR, ".");
+        }
+        
+        if (context.containsKey(ToolConstants.CFG_ANT)) {
+            setAntProperties(context);
+            setLibraryReferences(context);
+        }
+        
+        if (isVerboseOn()) {
+            context.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
+        }
+
+        //validate(env);
+        setExcludePackageAndNamespaces(context);
+        loadDefaultNSPackageMapping(context);
+        setPackageAndNamespaces(context);
+    }
+
+    private static InputStream getResourceAsStream(String file) {
+        return WSDLToJavaContainer.class.getResourceAsStream(file);
+    }
+
+    public void checkParams(ErrorVisitor errors) throws ToolException {
+        CommandDocument doc = super.getCommandDocument();
+
+        if (!doc.hasParameter("wsdlurl")) {
+            errors.add(new ErrorVisitor.UserError("WSDL/SCHEMA URL has to be specified"));
+        }
+        if (errors.getErrors().size() > 0) {
+            Message msg = new Message("PARAMETER_MISSING", LOG);
+            throw new ToolException(msg, new BadUsageException(getUsage(), errors));
+        }
+    }    
+    
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,41 @@
+/**
+ * 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.wsdlto;
+
+import org.apache.cxf.tools.common.ToolConstants;
+
+public final class WSDLVersion {
+
+    private static final String WSDL11 = "1.1";
+    private static final String WSDL20 = "2.0";
+
+    private WSDLVersion() {
+    }
+    
+    public static ToolConstants.WSDLVersion getVersion(String version) {
+        if (WSDL11.equals(version)) {
+            return ToolConstants.WSDLVersion.WSDL11;
+        }
+        if (WSDL20.equals(version)) {
+            return ToolConstants.WSDLVersion.WSDL20;
+        }
+        return ToolConstants.WSDLVersion.UNKNOWN;
+    }
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLVersion.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,33 @@
+/**
+ * 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.wsdlto.core;
+
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.wsdl.WSDLBuilder;
+
+public abstract class AbstractWSDLBuilder<T> implements WSDLBuilder<T> {
+    protected ToolContext context;
+    
+    public void setContext(ToolContext c) {
+        this.context = c;
+    }
+    
+    public abstract void customize(T t);
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,37 @@
+/**
+ * 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.wsdlto.core;
+
+import java.util.List;
+
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import com.sun.tools.xjc.api.Property;
+import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.ToolException;
+
+public interface DataBindingProfile {
+    void initialize(ToolContext context) throws ToolException;
+    void generate() throws ToolException;
+    String getType(QName qn, boolean fullName);
+    String getJavaType(QName qn, boolean boxify);
+    List<? extends Property> getBlock(Part part);
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java Thu Dec 14 19:40:13 2006
@@ -0,0 +1,74 @@
+/**
+ * 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.wsdlto.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.cxf.tools.common.FrontEndGenerator;
+import org.apache.cxf.tools.common.Processor;
+
+public class FrontEndProfile {
+    List<FrontEndGenerator> generators = new ArrayList<FrontEndGenerator>();
+    Processor processor;
+    Class containerClz;
+    String toolspec;
+    AbstractWSDLBuilder builder;
+
+    public void setContainerClass(Class c) {
+        this.containerClz = c;
+    }
+
+    public Class getContainerClass() {
+        return this.containerClz;
+    }
+
+    public void setToolspec(String ts) {
+        this.toolspec = ts;
+    }
+
+    public String getToolspec() {
+        return this.toolspec;
+    }
+    
+    public List<FrontEndGenerator> getGenerators() {
+        return generators;
+    }
+    
+    public void registerGenerator(FrontEndGenerator generator) {
+        generators.add(generator);
+    }
+
+    public Processor getProcessor() {
+        return this.processor;
+    }
+
+    public void setProcessor(Processor prs) {
+        this.processor = prs;
+    }
+
+    public void setWSDLBuilder(AbstractWSDLBuilder b) {
+        this.builder = b;
+    }
+
+    public AbstractWSDLBuilder getWSDLBuilder() {
+        return builder;
+    }
+
+}

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/FrontEndProfile.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/Messages.properties?view=auto&rev=487441
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/Messages.properties (added)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/Messages.properties Thu Dec 14 19:40:13 2006
@@ -0,0 +1,17 @@
+DATABINDING_PROFILE_LOAD_FAIL = Tools can not load the databinding plugin class {0}
+FRONTEND_PROFILE_LOAD_FAIL = Tools can not load the frontend plugin class {0}
+PLUGIN_LOAD_FAIL = Tools plugin {0} load failed
+JAXB_CONTEXT_INIT_FAIL = Tools plugin provider jaxb context init failed
+PLUGIN_MISSING = Plugin {0} missing
+PLUGIN_LOADING = Loading plugin {0}
+FRONTEND_MISSING = Can not find {0} frontend in the system
+DATABINDING_MISSING = Can not find {0} databinding in the system
+LOAD_PROCESSOR_FAILED = Can not load processor {0}
+
+FOUND_FRONTENDS =  Found {1} frontends in <{0}> plugin.
+LOADING_FRONTEND = Loading <{0}> frontend from <{1}> plugin.
+FRONTEND_MISSING_NAME = FrontEnd must have a name, can not load THIS frontend from <{0}> plugin.
+
+FOUND_DATABINDINGS =  Found {1} databindings in <{0}> plugin.
+LOADING_DATABINDING = Loading <{0}> databinding from <{1}> plugin.
+DATABINDING_MISSING_NAME = Databinding must have a name, can not load THIS databinding from <{0}> plugin.



Mime
View raw message