cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r492895 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/helpers/ tools2/common/ tools2/wsdlto/core/ tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/ tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/ws...
Date Fri, 05 Jan 2007 04:11:34 GMT
Author: mmao
Date: Thu Jan  4 20:11:33 2007
New Revision: 492895

URL: http://svn.apache.org/viewvc?view=rev&rev=492895
Log:
Copy tools-common to tools2-common and Re-organize the code structure.

* Simplify the interface of databindingprofile, 
    remove the init method
* Move the main controller logic from jaxws to core, so that other container can reuse the
same procedure.
* Use the FileUtils to delete the tmp file due to a Windows bug
* Add getWSDLModel into AbstractWSDLBuilder to get the customized wsdl definition for wsdl11
or wsdl description for wsdl20


Added:
    incubator/cxf/trunk/tools2/common/
      - copied from r492465, incubator/cxf/trunk/tools/common/
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/FileUtils.java
    incubator/cxf/trunk/tools2/common/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
    incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java
    incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
    incubator/cxf/trunk/tools2/wsdlto/test/pom.xml

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/FileUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/FileUtils.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/FileUtils.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/FileUtils.java
Thu Jan  4 20:11:33 2007
@@ -83,7 +83,7 @@
         delete(d);
     }
 
-    private static void delete(File f) {
+    public static void delete(File f) {
         if (!f.delete()) {
             if (isWindows()) {
                 System.gc();

Modified: incubator/cxf/trunk/tools2/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/common/pom.xml?view=diff&rev=492895&r1=492465&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/common/pom.xml (original)
+++ incubator/cxf/trunk/tools2/common/pom.xml Thu Jan  4 20:11:33 2007
@@ -19,15 +19,15 @@
 <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-common</artifactId>
+    <artifactId>cxf-tools2-common</artifactId>
     <packaging>jar</packaging>
     <version>2.0-incubator-RC-SNAPSHOT</version>
-    <name>Apache CXF Command Line Tools Common</name>
+    <name>Apache CXF Command Line Tools2 Common</name>
     <url>http://cwiki.apache.org/confluence/display/CXF/Index</url>
 
     <parent>
         <groupId>org.apache.cxf</groupId>
-        <artifactId>cxf-tools</artifactId>
+        <artifactId>cxf-tools2</artifactId>
         <version>2.0-incubator-RC-SNAPSHOT</version>
     </parent>
 

Modified: incubator/cxf/trunk/tools2/wsdlto/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/core/pom.xml?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/pom.xml (original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/pom.xml Thu Jan  4 20:11:33 2007
@@ -38,7 +38,7 @@
     <dependencies>
 	<dependency>
 	    <groupId>org.apache.cxf</groupId>
-	    <artifactId>cxf-tools-common</artifactId>
+	    <artifactId>cxf-tools2-common</artifactId>
 	    <version>${project.version}</version>
 	</dependency>
 	<dependency>

Modified: 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=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Thu Jan  4 20:11:33 2007
@@ -22,12 +22,13 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
-
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 
@@ -35,7 +36,11 @@
 import org.apache.cxf.BusFactoryHelper;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.AbstractCXFToolContainer;
+import org.apache.cxf.tools.common.ClassUtils;
+import org.apache.cxf.tools.common.FrontEndGenerator;
+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;
@@ -43,7 +48,10 @@
 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.DataBindingProfile;
+import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
 public class WSDLToJavaContainer extends AbstractCXFToolContainer {
 
@@ -75,7 +83,7 @@
     public void execute(boolean exitOnFinish) throws ToolException {
         try {
             super.execute(exitOnFinish);
-            /*if (!hasInfoOption()) {
+            if (!hasInfoOption()) {
                 buildToolContext();
                 validate(context);
                 
@@ -91,19 +99,13 @@
                     AbstractWSDLBuilder<Definition> builder =
                         (AbstractWSDLBuilder<Definition>) frontend.getWSDLBuilder();
                     Definition definition = builder.build(wsdlURL);
+                    builder.setContext(context);
+                    builder.customize();
 
-                    context.put(Definition.class, definition);
+                    context.put(Definition.class, builder.getWSDLModel());
                     if (context.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) {
                         builder.validate(definition);
                     }
-                    
-                    
-                    //to do .., We need to customized the definition
-                    
-                    if (context.optionSet(ToolConstants.CFG_BINDING)) {
-                        builder.setContext(context);
-                        builder.customize();
-                    }
 
                     WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
                     service = serviceBuilder.buildService(definition, getServiceQName(definition));
@@ -135,7 +137,6 @@
                     removeExcludeFiles();
                 }
             }
-            */
         } catch (ToolException ex) {
             if (ex.getCause() instanceof BadUsageException) {
                 getInstance().printUsageException(toolName, (BadUsageException)ex.getCause());
@@ -153,7 +154,7 @@
         }
     }
 
-    @SuppressWarnings("unchecked")    
+    @SuppressWarnings("unchecked")
     public QName getServiceQName(Definition definition) {
         QName qname = context.getQName(ToolConstants.CFG_SERVICENAME);
         if (qname == null) {
@@ -244,6 +245,28 @@
                 }
             }
         }
+
+        String wsdl = (String)env.get(ToolConstants.CFG_WSDLURL);
+        
+        File wsdlFile = null;
+        try {
+            URI wsdlURI = new URI(wsdl);
+            if (!wsdlURI.isAbsolute()) {
+                File tmpfile = new File("");
+                wsdlURI = tmpfile.toURI().resolve(wsdlURI);
+            }
+            wsdlFile = new File(wsdlURI);
+        } catch (URISyntaxException e) {
+            wsdlFile = new File(wsdl);
+        }
+        if (!wsdlFile.exists()) {
+            Message msg = new Message("FILE_NOT_EXIST", LOG, wsdl);
+            throw new ToolException(msg);
+        } else if (wsdlFile.isDirectory()) {
+            Message msg = new Message("NOT_A_FILE", LOG, wsdl);
+            throw new ToolException(msg);
+        }
+        env.put(ToolConstants.CFG_WSDLURL, wsdlFile.toURI().toString());        
     }
 
     public void setAntProperties(ToolContext env) {
@@ -287,7 +310,6 @@
             context.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
         }
 
-        //validate(env);
         setExcludePackageAndNamespaces(context);
         loadDefaultNSPackageMapping(context);
         setPackageAndNamespaces(context);
@@ -331,7 +353,7 @@
                 String classDir = context.get(ToolConstants.CFG_CLASSDIR) == null
                     ? outPutDir : (String)context.get(ToolConstants.CFG_CLASSDIR);
                 File classFile = new File(classDir, excludeFile.substring(0, excludeFile.indexOf(".java"))
-                                                    + ".class");
+                                          + ".class");
                 classFile.delete();
                 File tmpClzFile = classFile.getParentFile();
                 while (tmpClzFile != null && !tmpClzFile.getCanonicalPath().equalsIgnoreCase(outPutDir))
{
@@ -364,6 +386,6 @@
         if (passthrough()) {
             return;
         }
-        context.get(DataBindingProfile.class).generate();
+        context.get(DataBindingProfile.class).generate(context);
     }
 }

Modified: 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=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractWSDLBuilder.java
Thu Jan  4 20:11:33 2007
@@ -33,4 +33,6 @@
     public abstract void customize();
 
     public abstract boolean validate(T t) throws ToolException;
+
+    public abstract T getWSDLModel();
 }

Modified: 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=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/DataBindingProfile.java
Thu Jan  4 20:11:33 2007
@@ -27,11 +27,6 @@
 
 public interface DataBindingProfile {
     
-    void initialize(ToolContext context);
-      
-    void generate() throws ToolException;
-
+    void generate(ToolContext context) throws ToolException;
     String getType(QName qn);
-    //String getJavaType(QName qn, boolean boxify);
-    //List<? extends Property> getBlock(MessagePartInfo part);
 }

Modified: incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/pom.xml?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/pom.xml (original)
+++ incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/pom.xml Thu Jan  4 20:11:33 2007
@@ -1,20 +1,20 @@
 <!--
-  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.
+    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>
@@ -26,73 +26,73 @@
     <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>
+	<groupId>org.apache.cxf</groupId>
+	<artifactId>cxf-tools2-wsdlto</artifactId>
+	<version>2.0-incubator-RC-SNAPSHOT</version>
     </parent>
 
     <properties>
-        <topDirectoryLocation>../../../</topDirectoryLocation>
+	<topDirectoryLocation>../../../</topDirectoryLocation>
     </properties>
     
     <dependencies>
-     <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>junit</groupId>
-     	    <artifactId>junit</artifactId>
-     	    <scope>test</scope>
-     	</dependency>
-     	<dependency>
-     	    <groupId>org.apache.cxf</groupId>
-     	    <artifactId>cxf-tools-common</artifactId>
-     	    <version>${project.version}</version>
-     	</dependency>
-     
-     	<dependency>
-     	    <groupId>org.apache.cxf</groupId>
-     	    <artifactId>cxf-tools-wsdl2java</artifactId>
-     	    <version>${project.version}</version>
-     	</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-rt-bindings-xml</artifactId>
-                 <version>${project.version}</version>
-             </dependency>
-     
-     	<dependency>
-     	    <groupId>org.apache.cxf</groupId>
-     	    <artifactId>cxf-rt-transports-jms</artifactId>
-                 <version>${project.version}</version>
-             </dependency>
-     
-     	<dependency>
-     	    <groupId>org.apache.cxf</groupId>
-     	    <artifactId>cxf-tools2-wsdlto-core</artifactId>
-     	    <version>${project.version}</version>
+	<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>junit</groupId>
+	    <artifactId>junit</artifactId>
+	    <scope>test</scope>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-tools2-common</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+	
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-tools-wsdl2java</artifactId>
+	    <version>${project.version}</version>
+	</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-rt-bindings-xml</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+	
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-rt-transports-jms</artifactId>
+	    <version>${project.version}</version>
+	</dependency>
+	
+	<dependency>
+	    <groupId>org.apache.cxf</groupId>
+	    <artifactId>cxf-tools2-wsdlto-core</artifactId>
+	    <version>${project.version}</version>
 	</dependency>
-        
-        
+	
+	
     </dependencies>
 
 </project>

Modified: incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Thu Jan  4 20:11:33 2007
@@ -53,15 +53,14 @@
 public class JAXBDataBinding implements DataBindingProfile {
     private static final Logger LOG = LogUtils.getL7dLogger(JAXBDataBinding.class);
     protected S2JJAXBModel rawJaxbModelGenCode;
-    //private Model model;
     private ToolContext env;
     private ServiceInfo serviceInfo;
     private Definition def;
 
     @SuppressWarnings("unchecked")
-    public void initialize(ToolContext penv) throws ToolException {
+    private void initialize(ToolContext penv) throws ToolException {
         env = penv;
-        serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
+        serviceInfo = env.get(ServiceInfo.class);
         def = (Definition)env.get(Definition.class);
         
         Set<InputSource> jaxbBindings = (Set<InputSource>)env.get(ToolConstants.NS_JAXB_BINDINGS);
@@ -128,7 +127,8 @@
 
    
     
-    public void generate() throws ToolException {
+    public void generate(ToolContext context) throws ToolException {
+        initialize(context);
         if (rawJaxbModelGenCode == null) {
             return;
         }

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml (original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/pom.xml Thu Jan  4 20:11:33 2007
@@ -43,7 +43,7 @@
 	</dependency>
 	<dependency>
 	    <groupId>org.apache.cxf</groupId>
-	    <artifactId>cxf-tools-common</artifactId>
+	    <artifactId>cxf-tools2-common</artifactId>
 	    <version>${project.version}</version>
 	</dependency>
 

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
Thu Jan  4 20:11:33 2007
@@ -24,24 +24,12 @@
 import java.net.URISyntaxException;
 import java.util.Set;
 
-import javax.wsdl.Definition;
-
 import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.ClassUtils;
-import org.apache.cxf.tools.common.FrontEndGenerator;
-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.util.ClassCollector;
 import org.apache.cxf.tools.wsdlto.WSDLToJavaContainer;
-import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
-import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
-import org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder;
-import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
 public class JAXWSContainer extends WSDLToJavaContainer {
     
@@ -65,7 +53,6 @@
             for (int i = 0; i < bindings.length; i++) {               
                 
                 File bindingFile = null;
-                //= new File(bindings[i]);
                 try {
                     URI bindingURI = new URI(bindings[i]);
                     if (!bindingURI.isAbsolute()) {
@@ -85,116 +72,7 @@
                 }
             }
             env.put(ToolConstants.CFG_BINDING, bindings);
-        }
-        
-        String wsdl = (String)env.get(ToolConstants.CFG_WSDLURL);
-        
-        File wsdlFile = null;
-        try {
-            URI wsdlURI = new URI(wsdl);
-            if (!wsdlURI.isAbsolute()) {
-                wsdlURI = tmpfile.toURI().resolve(wsdlURI);
-            }
-            wsdlFile = new File(wsdlURI);
-        } catch (URISyntaxException e) {
-            wsdlFile = new File(wsdl);
-        }
-        if (!wsdlFile.exists()) {
-            Message msg = new Message("FILE_NOT_EXIST", LOG, wsdl);
-            throw new ToolException(msg);
-        } else if (wsdlFile.isDirectory()) {
-            Message msg = new Message("NOT_A_FILE", LOG, wsdl);
-            throw new ToolException(msg);
-        }
-        env.put(ToolConstants.CFG_WSDLURL, wsdlFile.toURI().toString());        
+        }        
     }
-    
-    public void execute(boolean exitOnFinish) throws ToolException {
-        try {           
-            super.execute(exitOnFinish);
-            if (!hasInfoOption()) {
-                
-                buildToolContext();
-                validate(context);
-                
-                context.put(ClassCollector.class, new ClassCollector());
-                
-                FrontEndProfile frontend = context.get(FrontEndProfile.class);
-                
-                Processor processor = frontend.getProcessor();
-                
-                ToolConstants.WSDLVersion version = getWSDLVersion();
-                System.out.println("---version ---- " + version);
-                
-                ServiceInfo service = null;
-                    
-                // Build the ServiceModel from the WSDLModel
-                if (version == ToolConstants.WSDLVersion.WSDL11) {
-                   
-                    JAXWSDefinitionBuilder  builder = 
-                        (JAXWSDefinitionBuilder)frontend.getWSDLBuilder();
-                    builder.setContext(context);
-                    builder.build();
-                    builder.customize();
-                    context.put(ToolConstants.NS_JAXB_BINDINGS, 
-                                builder.getJaxbBindings());                     
-                    context.put(ToolConstants.HANDLER_CHAIN, builder.getHandlerChain());
-                    //get the definition after customized
-                    Definition definition = builder.getDefinition();
-                    builder.validate(definition);
-                    context.put(Definition.class, definition);
-                    
-                    
-                    //get serviceInfo
-                    WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
-                    service = serviceBuilder.buildService(definition, getServiceQName(definition));
-                    context.put(ServiceInfo.class, service);
-                    
-                } else {
-                    // TODO: wsdl2.0 support
-                }
-                
-                
-                //initialize databinding
-                DataBindingProfile databinding = (DataBindingProfile)context.get(DataBindingProfile.class);
-                databinding.initialize(context);
-                                
-                generateTypes();                
-                // Build the JavaModel from the ServiceModel
-                processor.setEnvironment(context);
-                processor.process();
-
-                // Generate artifacts
-                for (FrontEndGenerator generator : frontend.getGenerators()) {
-                    generator.generate(context);
-                }
-
-                // Build projects: compile classes and copy resources etc.
-                if (context.optionSet(ToolConstants.CFG_COMPILE)) {
-                    new ClassUtils().compile(context);
-                }
-
-                if (context.isExcludeNamespaceEnabled()) {
-                    removeExcludeFiles();
-                }
-            }
-        } catch (ToolException ex) {
-            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();
-            }
-        }
-    }
-
-    
     
 }

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
Thu Jan  4 20:11:33 2007
@@ -20,12 +20,7 @@
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor;
 
 
-import java.util.Collection;
-import javax.xml.transform.TransformerException;
-
 import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.model.JavaInterface;
@@ -41,22 +36,8 @@
 
     public void process() throws ToolException {
         super.process();
-        ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
-
-        Collection<SchemaInfo> schemas = serviceInfo.getTypeInfo().getSchemas();
-        for (SchemaInfo schema : schemas) {
-            try {
-                System.out.println("----Schema -----");
-                DOMUtils.writeXml(schema.getElement(), System.out);
-                System.out.println("---------------");
-            } catch (TransformerException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            }
-        }
 
-        //serviceInfo.getTypeInfo().getSchemas().size();
-        JavaModel jmodel = wsdlDefinitionToJavaModel(serviceInfo);
+        JavaModel jmodel = wsdlDefinitionToJavaModel(context.get(ServiceInfo.class));
 
         if (jmodel == null) {
             Message msg = new Message("FAIL_TO_CREATE_JAVA_MODEL", LOG);
@@ -68,9 +49,6 @@
         JavaModel javaModel = new JavaModel();
         context.put(JavaModel.class, javaModel);
 
-
-        //javaModel.setJAXWSBinding(customizing(definition));
-
         // TODO refactroing the internal processors to use the service model
 
         PortTypeProcessor portTypeProcessor = new PortTypeProcessor(context);
@@ -78,7 +56,6 @@
 
         ServiceProcessor serviceProcessor = new ServiceProcessor(context);
         serviceProcessor.process(serviceInfo);
-
 
         //         SEIAnnotationProcessor seiAnnotationProcessor = new SEIAnnotationProcessor(context);
         //         seiAnnotationProcessor.process(serviceInfo);

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
Thu Jan  4 20:11:33 2007
@@ -136,36 +136,6 @@
         }
     }
 
-    // TODO: Add customizing
-//     private JAXWSBinding customizing(JavaInterface intf, Operation operation) {
-//         JAXWSBinding binding = null;
-//         List extElements = operation.getExtensibilityElements();
-//         if (extElements.size() > 0) {
-//             Iterator iterator = extElements.iterator();
-//             while (iterator.hasNext()) {
-//                 Object obj = iterator.next();
-//                 if (obj instanceof JAXWSBinding) {
-//                     binding = (JAXWSBinding)obj;
-//                 }
-//             }
-//         } else {
-//             String portTypeName = intf.getWebServiceName();
-//             String operationName = operation.getName();
-//             binding = CustomizationParser.getInstance().getPortTypeOperationExtension(portTypeName,
-//                                                                                      
operationName);
-//         }
-
-//         if (binding == null) {
-//             binding = new JAXWSBinding();
-//         }
-//         if (!binding.isSetAsyncMapping()
-//             && (intf.getJavaModel().getJAXWSBinding().isEnableAsyncMapping() ||
intf.getJAXWSBinding()
-//                 .isEnableAsyncMapping())) {
-//             binding.setEnableAsyncMapping(true);
-//         }
-//         return binding;
-//     }
-
     private void addAsyncMethod(JavaMethod method) throws ToolException {
         addPollingMethod(method);
         addCallbackMethod(method);

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Thu Jan  4 20:11:33 2007
@@ -209,7 +209,6 @@
         
         if (inputPart != null) {
             inputWrapElement = ProcessorUtil.getWrappedElement(context, inputPart.getElementQName());

-                //dataBinding.getBlock(inputPart);
         }       
         
         if (outputPart != null) {

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Thu Jan  4 20:11:33 2007
@@ -46,6 +46,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.SOAPBindingUtil;
@@ -84,7 +85,6 @@
 
     public Definition build(String wsdlURL) {
         wsdlDefinition = builder.build(wsdlURL);
-        context.put(ToolConstants.WSDL_DEFINITION, wsdlDefinition);
         context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
         checkSupported(wsdlDefinition);        
         return wsdlDefinition;
@@ -105,10 +105,25 @@
     }
 
     public void customize() {
+        if (!context.containsKey(ToolConstants.CFG_BINDING)) {
+            return;
+        }
         cusParser = CustomizationParser.getInstance();
         cusParser.parse(context);
         jaxbBindings = cusParser.getJaxbBindings();
         handlerChain = cusParser.getHandlerChains();
+
+        context.put(ToolConstants.NS_JAXB_BINDINGS, jaxbBindings);
+        context.put(ToolConstants.HANDLER_CHAIN, handlerChain);
+
+        try {
+            this.wsdlDefinition = buildCustomizedDefinition();
+        } catch (Exception e) {
+            Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION",
+                                      LOG,
+                                      cusParser.getCustomizedWSDLElement().getBaseURI());
+            throw new RuntimeException(msg.toString(), e);
+        }
     }
 
     private void checkSupported(Definition def) throws ToolException {
@@ -154,31 +169,26 @@
     private CustomizationParser getCustomizationParer() {
         return cusParser;
     }
-    
-    public Definition getDefinition() {
-        try {
-            if (this.wsdlDefinition == null) {
-                this.build();                
-            }
-           
-            if (!context.containsKey(ToolConstants.CFG_BINDING)) {
-                return this.wsdlDefinition;
-            }
-                       
-            File file = File.createTempFile("customzied", ".wsdl");
-            OutputStream outs = new FileOutputStream(file);
-            DOMUtils.writeXml(getCustomizationParer().getCustomizedWSDLElement(), outs);
-            InputStream ins = new FileInputStream(new File(file.toURI()));
-            Document wsdlDoc = DOMUtils.readXml(ins);
-            Definition def =  wsdlReader.readWSDL(this.wsdlDefinition.getDocumentBaseURI(),

-                                                 wsdlDoc);
-            file.delete();
-            return def;
-        } catch (Exception we) {
-            Message msg = new Message("FAIL_TO_CREATE_WSDL_DEFINITION", LOG, cusParser
-                .getCustomizedWSDLElement().getBaseURI());
-            throw new RuntimeException(msg.toString(), we);
+
+    private Definition buildCustomizedDefinition() throws Exception {
+        File tmpFile = File.createTempFile("customzied", ".wsdl");
+        OutputStream outs = new FileOutputStream(tmpFile);
+        DOMUtils.writeXml(getCustomizationParer().getCustomizedWSDLElement(), outs);
+        InputStream ins = new FileInputStream(new File(tmpFile.toURI()));
+        Document wsdlDoc = DOMUtils.readXml(ins);
+        Definition def =  wsdlReader.readWSDL(this.wsdlDefinition.getDocumentBaseURI(), 
+                                              wsdlDoc);
+        FileUtils.delete(tmpFile);
+        return def;
+    }
+
+    public Definition getWSDLModel() {
+        if (this.wsdlDefinition == null) {
+            this.build();
+            this.customize();
         }
+        
+        return this.wsdlDefinition;
     }
     public WSDLReader getWSDLReader() {
         return wsdlReader;
@@ -187,13 +197,5 @@
 
     public boolean validate(Definition def) throws ToolException {
         return new WSDL11Validator(def, context).isValid();
-    }
-    
-    public Set<InputSource> getJaxbBindings() {
-        return this.jaxbBindings;
-    }
-    
-    public Element getHandlerChain() {
-        return this.handlerChain;
     }
 }

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/DummyDataBinding.java
Thu Jan  4 20:11:33 2007
@@ -19,34 +19,16 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws;
 
-import java.util.List;
-
 import javax.xml.namespace.QName;
 
-import com.sun.tools.xjc.api.Property;
-import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 
 public class DummyDataBinding implements org.apache.cxf.tools.wsdlto.core.DataBindingProfile
{
-    public void initialize(ToolContext context) {
-
+    public void generate(ToolContext context) throws ToolException {
     }
     
-    public void generate() throws ToolException {
-     
-    }
-
-    
     public String getType(QName qn) {
-        return null;
-    }
-    
-    public String getJavaType(QName qn, boolean boxify) {
-        return null;
-    }
-    
-    public List<? extends Property> getBlock(MessagePartInfo part) {
         return null;
     }
 }

Modified: incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
(original)
+++ incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilderTest.java
Thu Jan  4 20:11:33 2007
@@ -119,9 +119,10 @@
         env.put(ToolConstants.CFG_BINDING, getClass().getResource("./binding2.xml").toString());
         JAXWSDefinitionBuilder builder = new JAXWSDefinitionBuilder();
         builder.setContext(env);
+        builder.build();
         builder.customize();
 
-        Definition customizedDef = builder.getDefinition();
+        Definition customizedDef = builder.getWSDLModel();
         List defExtensionList = customizedDef.getExtensibilityElements();
         Iterator ite = defExtensionList.iterator();
 

Modified: incubator/cxf/trunk/tools2/wsdlto/test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/test/pom.xml?view=diff&rev=492895&r1=492894&r2=492895
==============================================================================
--- incubator/cxf/trunk/tools2/wsdlto/test/pom.xml (original)
+++ incubator/cxf/trunk/tools2/wsdlto/test/pom.xml Thu Jan  4 20:11:33 2007
@@ -38,7 +38,7 @@
     <dependencies>
 	<dependency>
 	    <groupId>org.apache.cxf</groupId>
-	    <artifactId>cxf-tools-common</artifactId>
+	    <artifactId>cxf-tools2-common</artifactId>
 	    <version>${project.version}</version>
 	</dependency>
 	<dependency>



Mime
View raw message