cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1516536 - in /cxf/trunk: core/src/main/java/org/apache/cxf/common/util/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ systests/databinding/ systests/uncategorized/ systests/...
Date Thu, 22 Aug 2013 18:33:14 GMT
Author: dkulp
Date: Thu Aug 22 18:33:13 2013
New Revision: 1516536

URL: http://svn.apache.org/r1516536
Log:
Add a "cxf" frontend to the code generator.

Added:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/CXFService.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/CXFJAXWSContainer.java
      - copied, changed from r1516458, cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/JAXWS21ServiceGenerator.java
Removed:
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/JAXWS21ServiceGenerator.java
Modified:
    cxf/trunk/core/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
    cxf/trunk/systests/databinding/pom.xml
    cxf/trunk/systests/uncategorized/pom.xml
    cxf/trunk/systests/ws-specs/pom.xml
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWS21Container.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java

Modified: cxf/trunk/core/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/core/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java (original)
+++ cxf/trunk/core/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java Thu Aug 22
18:33:13 2013
@@ -48,6 +48,7 @@ public final class ReflectionUtil {
     public static <T> T accessDeclaredField(final Field f, final Object o, final Class<T>
responseClass) {
         return AccessController.doPrivileged(new PrivilegedAction<T>() {
             public T run() {
+                boolean b = f.isAccessible();
                 try {
                     f.setAccessible(true);
                     return responseClass.cast(f.get(o));
@@ -56,7 +57,28 @@ public final class ReflectionUtil {
                 } catch (IllegalAccessException e) {
                     return null;
                 } finally {
-                    f.setAccessible(false);
+                    f.setAccessible(b);
+                }
+            }
+        });
+    }
+    public static <T> T accessDeclaredField(final String fieldName,
+                                            final Class<?> cls,
+                                            final Object o, 
+                                            final Class<T> responseClass) {
+        return AccessController.doPrivileged(new PrivilegedAction<T>() {
+            public T run() {
+                Field f = getDeclaredField(cls, fieldName);
+                boolean b = f.isAccessible();
+                try {
+                    f.setAccessible(true);
+                    return responseClass.cast(f.get(o));
+                } catch (SecurityException e) {
+                    return null;
+                } catch (IllegalAccessException e) {
+                    return null;
+                } finally {
+                    f.setAccessible(b);
                 }
             }
         });

Added: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/CXFService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/CXFService.java?rev=1516536&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/CXFService.java (added)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/CXFService.java Thu Aug
22 18:33:13 2013
@@ -0,0 +1,69 @@
+/**
+ * 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.jaxws;
+
+import java.lang.reflect.Field;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.spi.ServiceDelegate;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.util.ReflectionUtil;
+
+/**
+ * 
+ */
+public abstract class CXFService extends Service {
+    ServiceImpl impl;
+    
+    protected CXFService(URL wsdlURL, QName serviceName) {
+        super(wsdlURL, serviceName);
+        impl = findDelegate();
+        impl.initialize(null, wsdlURL);
+    } 
+    protected CXFService(Bus b, URL wsdlURL, QName serviceName) {
+        super(wsdlURL, serviceName);
+        impl = findDelegate();
+        impl.initialize(b, wsdlURL);
+    } 
+    protected CXFService(URL wsdlURL, QName serviceName, WebServiceFeature ... f) {
+        super(wsdlURL, serviceName);
+        impl = findDelegate();
+        impl.initialize(null, wsdlURL, f);
+    } 
+    protected CXFService(Bus b, URL wsdlURL, QName serviceName, WebServiceFeature ... f)
{
+        super(wsdlURL, serviceName);
+        impl = findDelegate();
+        impl.initialize(b, wsdlURL, f);
+    } 
+    
+    private ServiceImpl findDelegate() {
+        for (Field f : ReflectionUtil.getDeclaredFields(Service.class)) {
+            if (ServiceDelegate.class.equals(f.getType())) { 
+                return ReflectionUtil.accessDeclaredField(f, this, ServiceImpl.class);
+            }
+        }
+        throw null;
+    }
+
+}

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Thu Aug
22 18:33:13 2013
@@ -119,23 +119,34 @@ public class ServiceImpl extends Service
     private WebServiceFeature serviceFeatures[];
 
     public ServiceImpl(Bus b, URL url, QName name, Class<?> cls, WebServiceFeature
... f) {
-        bus = b;
-        this.serviceName = name;
         clazz = cls;
-        serviceFeatures = f;
+        this.serviceName = name;
         
-        handlerResolver = new HandlerResolverImpl(bus, name, clazz);
+        //If the class is a CXFService, then it will call initialize directly later
+        //when the bus is determined
+        if (cls == null || !CXFService.class.isAssignableFrom(cls)) {
+            initialize(b, url, f);
+        }
+    }
+    
+    void initialize(Bus b, URL url, WebServiceFeature ... f) {
+        if (b == null) {
+            b = BusFactory.getThreadDefaultBus(true);
+        }
+        serviceFeatures = f;
+        bus = b;
+        handlerResolver = new HandlerResolverImpl(bus, serviceName, clazz);
         
         if (null == url && null != bus) {
             ServiceContractResolverRegistry registry = 
                 bus.getExtension(ServiceContractResolverRegistry.class);
             if (null != registry) {
-                URI uri = registry.getContractLocation(name);
+                URI uri = registry.getContractLocation(serviceName);
                 if (null != uri) {
                     try {
                         url = uri.toURL();
                     } catch (MalformedURLException e) {
-                        LOG.log(Level.FINE, "resolve qname failed", name);
+                        LOG.log(Level.FINE, "resolve qname failed", serviceName);
                         throw new WebServiceException(e);
                     }
                 }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java Thu
Aug 22 18:33:13 2013
@@ -96,21 +96,19 @@ public class ProviderImpl extends javax.
     @Override
     public ServiceDelegate createServiceDelegate(URL url, QName qname,
                                                  @SuppressWarnings("rawtypes") Class cls)
{
-        Bus bus = BusFactory.getThreadDefaultBus();
-        return new ServiceImpl(bus, url, qname, cls);
+        return new ServiceImpl(null, url, qname, cls);
     }
     //new in 2.2
     public ServiceDelegate createServiceDelegate(URL wsdlDocumentLocation,
                                                  QName serviceName,
                                                  @SuppressWarnings("rawtypes") Class serviceClass,
                                                  WebServiceFeature ... features) {
-        Bus bus = BusFactory.getThreadDefaultBus();
         for (WebServiceFeature f : features) {
             if (!f.getClass().getName().startsWith("javax.xml.ws")) {
                 throw new WebServiceException("Unknown feature error: " + f.getClass().getName());
             }
         }
-        return new ServiceImpl(bus, wsdlDocumentLocation,
+        return new ServiceImpl(null, wsdlDocumentLocation,
                                serviceName, serviceClass, features);
         
     }

Modified: cxf/trunk/systests/databinding/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/pom.xml?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/systests/databinding/pom.xml (original)
+++ cxf/trunk/systests/databinding/pom.xml Thu Aug 22 18:33:13 2013
@@ -88,45 +88,33 @@
                             <wsdlOptions>
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_databinding/xmlbeans/hello_world.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-db</extraarg>
-                                        <extraarg>xmlbeans</extraarg>
-                                    </extraargs>
+                                    <frontEnd>cxf</frontEnd>
+                                    <dataBinding>xmlbeans</dataBinding>
                                 </wsdlOption>
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_databinding/xmlbeans/doc_lit_bare.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-db</extraarg>
-                                        <extraarg>xmlbeans</extraarg>
-                                    </extraargs>
+                                    <frontEnd>cxf</frontEnd>
+                                    <dataBinding>xmlbeans</dataBinding>
                                 </wsdlOption>
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_databinding/jibx/hello_world.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-db</extraarg>
-                                        <extraarg>jibx</extraarg>
-                                    </extraargs>
+                                    <frontEnd>cxf</frontEnd>
+                                    <dataBinding>jibx</dataBinding>
                                 </wsdlOption>
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_databinding/jibx/doc_lit_bare.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-db</extraarg>
-                                        <extraarg>jibx</extraarg>
-                                    </extraargs>
+                                    <frontEnd>cxf</frontEnd>
+                                    <dataBinding>jibx</dataBinding>
                                 </wsdlOption>
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_databinding/source/hello_world.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-db</extraarg>
-                                        <extraarg>domsource</extraarg>
-                                    </extraargs>
+                                    <frontEnd>cxf</frontEnd>
+                                    <dataBinding>domsource</dataBinding>
                                 </wsdlOption>
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/test/resources/wsdl_systest_databinding/source/doc_lit_bare.wsdl</wsdl>
-                                    <extraargs>
-                                        <extraarg>-db</extraarg>
-                                        <extraarg>domsource</extraarg>
-                                    </extraargs>
+                                    <frontEnd>cxf</frontEnd>
+                                    <dataBinding>domsource</dataBinding>
                                 </wsdlOption>
                             </wsdlOptions>
                         </configuration>

Modified: cxf/trunk/systests/uncategorized/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/pom.xml?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/systests/uncategorized/pom.xml (original)
+++ cxf/trunk/systests/uncategorized/pom.xml Thu Aug 22 18:33:13 2013
@@ -47,6 +47,7 @@
                             <defaultOptions>
                                 <markGenerated>true</markGenerated>
                                 <faultSerialVersionUID>1</faultSerialVersionUID>
+                                <frontEnd>cxf</frontEnd>
                              </defaultOptions>
 
                             <wsdlOptions>

Modified: cxf/trunk/systests/ws-specs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/pom.xml?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/pom.xml (original)
+++ cxf/trunk/systests/ws-specs/pom.xml Thu Aug 22 18:33:13 2013
@@ -52,6 +52,7 @@
                             <defaultOptions>
                                 <markGenerated>true</markGenerated>
                                 <faultSerialVersionUID>1</faultSerialVersionUID>
+                                <frontEnd>cxf</frontEnd>
                             </defaultOptions>
                         </configuration>
                         <goals>

Copied: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/CXFJAXWSContainer.java
(from r1516458, cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/JAXWS21ServiceGenerator.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/CXFJAXWSContainer.java?p2=cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/CXFJAXWSContainer.java&p1=cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/JAXWS21ServiceGenerator.java&r1=1516458&r2=1516536&rev=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/JAXWS21ServiceGenerator.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/CXFJAXWSContainer.java
Thu Aug 22 18:33:13 2013
@@ -17,13 +17,23 @@
  * under the License.
  */
 
-package org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
+package org.apache.cxf.tools.wsdlto.frontend.jaxws;
+
+
+import org.apache.cxf.tools.common.toolspec.ToolSpec;
 
 /**
  * 
  */
-public class JAXWS21ServiceGenerator extends ServiceGenerator {
-    public boolean isJaxws22() {
-        return false;
+public class CXFJAXWSContainer extends JAXWSContainer {
+    public CXFJAXWSContainer(ToolSpec toolspec) throws Exception {
+        super(toolspec);
+    }
+    public String getServiceSuperclass() {
+        return "org.apache.cxf.jaxws.CXFService";
+    }
+
+    public String getServiceTarget() {
+        return "cxf";
     }
 }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWS21Container.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWS21Container.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWS21Container.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWS21Container.java
Thu Aug 22 18:33:13 2013
@@ -31,6 +31,9 @@ public class JAXWS21Container extends JA
     public JAXWS21Container(ToolSpec toolspec) throws Exception {
         super(toolspec);
     }
+    public String getServiceTarget() {
+        return "jaxws21";
+    }
     public void validate(ToolContext env) throws ToolException {
         super.validate(env);
         Object o = env.get(ToolConstants.CFG_XJC_ARGS);

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
Thu Aug 22 18:33:13 2013
@@ -25,6 +25,8 @@ import java.util.List;
 import java.util.Set;
 import java.util.StringTokenizer;
 
+import javax.xml.ws.Service;
+
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.resource.URIResolver;
 import org.apache.cxf.tools.common.ToolConstants;
@@ -51,7 +53,19 @@ public class JAXWSContainer extends WSDL
         return set;
     }
 
+    public String getServiceSuperclass() {
+        return Service.class.getName();
+    }
+    public String getServiceTarget() {
+        return isJaxws22() ? "jaxws22" : "jaxws21";
+    }
+    public boolean isJaxws22() {
+        return Service.class.getDeclaredConstructors().length == 2;
+    }
+    
     public void validate(ToolContext env) throws ToolException {
+        env.put("service.target", getServiceTarget());
+        env.put("service.superclass", getServiceSuperclass());
         super.validate(env);
         if (env.containsKey(ToolConstants.CFG_BINDING)) {
             String[] bindings = (String[])env.get(ToolConstants.CFG_BINDING);

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
Thu Aug 22 18:33:13 2013
@@ -25,7 +25,6 @@ import java.util.Map;
 
 import javax.jws.HandlerChain;
 import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.helpers.CastUtils;
@@ -123,10 +122,12 @@ public class ServiceGenerator extends Ab
                     location = url;
                 }
                 
-                String serviceSuperclass = "Service";
+                String serviceSuperclass = (String)env.get("service.superclass");
+                String simpleServiceName = serviceSuperclass.substring(serviceSuperclass.lastIndexOf('.')
+ 1);
                 for (String s : collector.getGeneratedFileInfo()) {
-                    if (s.equals(js.getPackageName() + ".Service")) {
-                        serviceSuperclass = "javax.xml.ws.Service";
+                    if (s.equals(js.getPackageName() + "." + simpleServiceName)) {
+                        simpleServiceName = serviceSuperclass;
+                        break;
                     }
                 }
                 clearAttributes();
@@ -142,14 +143,16 @@ public class ServiceGenerator extends Ab
                 setAttributes("service", js);
                 setAttributes("wsdlLocation", location);
                 setAttributes("useGetResource", useGetResource);
-                setAttributes("serviceSuperclass", serviceSuperclass);
-                if ("Service".equals(serviceSuperclass)) {
-                    js.addImport("javax.xml.ws.Service");
+                setAttributes("serviceSuperclass", simpleServiceName);
+                if (!simpleServiceName.equals(serviceSuperclass)) {
+                    js.addImport(serviceSuperclass);
                 }
                 setAttributes("wsdlUrl", url);
                 setCommonAttributes();
-                
-                if (isJaxws22()) {
+
+                String target = (String)env.get("service.target");
+                setAttributes("service-target", target);
+                if ("jaxws22".equals(target)) {
                     setAttributes("jaxws22", true);
                 }
     
@@ -159,10 +162,6 @@ public class ServiceGenerator extends Ab
         }
     }
     
-    public boolean isJaxws22() {
-        return Service.class.getDeclaredConstructors().length == 2;
-    }
-
     public void register(final ClassCollector collector, String packageName, String fileName)
{
         collector.addServiceClassName(packageName , fileName , packageName + "." + fileName);
     }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
Thu Aug 22 18:33:13 2013
@@ -35,6 +35,10 @@ import javax.xml.ws.WebServiceFeature;
 #foreach ($import in ${service.Imports}) 
 import ${import};
 #end
+#if ($service-target == "cxf")
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+#end
 
 /**
 #if ($service.classJavaDoc != "")
@@ -87,7 +91,11 @@ public class ${service.Name} extends ${s
         }
 #end     
         if (url == null) {
+#if ($service-target == "cxf")
+            LogUtils.getL7dLogger(${service.Name}.class)
+#else
             java.util.logging.Logger.getLogger(${service.Name}.class.getName())
+#end
                 .log(java.util.logging.Level.INFO, 
                      "Can not initialize the default wsdl from {0}", "$wsdlLocation");
         }       
@@ -98,7 +106,11 @@ public class ${service.Name} extends ${s
             url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation");
         } 
         if (url == null) {
+#if ($service-target == "cxf")
+            LogUtils.getL7dLogger(${service.Name}.class)
+#else
             java.util.logging.Logger.getLogger(${service.Name}.class.getName())
+#end
                 .log(java.util.logging.Level.INFO, 
                      "Can not initialize the default wsdl from {0}", "$wsdlLocation");
         }       
@@ -108,7 +120,11 @@ public class ${service.Name} extends ${s
         try {
             url = new URL("$wsdlLocation");
         } catch (MalformedURLException e) {
+#if ($service-target == "cxf")
+            LogUtils.getL7dLogger(${service.Name}.class)
+#else
             java.util.logging.Logger.getLogger(${service.Name}.class.getName())
+#end
                 .log(java.util.logging.Level.INFO, 
                      "Can not initialize the default wsdl from {0}", "$wsdlLocation");
         }
@@ -116,6 +132,28 @@ public class ${service.Name} extends ${s
 #end
     }
 
+#if ($service-target == "cxf")
+#if ($mark-generated == "true")
+    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
+#end
+    public ${service.Name}(Bus bus, WebServiceFeature ... features) {
+        super(bus, WSDL_LOCATION, SERVICE, features);
+    }
+
+#if ($mark-generated == "true")
+    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
+#end
+    public ${service.Name}(Bus bus, URL wsdlLocation, WebServiceFeature ... features) {
+        super(bus, wsdlLocation, SERVICE, features);
+    }
+
+#if ($mark-generated == "true")
+    @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
+#end
+    public ${service.Name}(Bus bus, URL wsdlLocation, QName serviceName, WebServiceFeature
... features) {
+        super(bus, wsdlLocation, serviceName, features);
+    }    
+#else
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
@@ -136,11 +174,14 @@ public class ${service.Name} extends ${s
     public ${service.Name}() {
         super(WSDL_LOCATION, SERVICE);
     }
+#end 
     
+#if ($jaxws22 || $service-target == "cxf")
 #if ($jaxws22)
     //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
     //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
     //compliant code instead.
+#end    
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
@@ -148,9 +189,11 @@ public class ${service.Name} extends ${s
         super(WSDL_LOCATION, SERVICE, features);
     }
 
+#if ($jaxws22)
     //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
     //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
     //compliant code instead.
+#end
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
@@ -158,15 +201,17 @@ public class ${service.Name} extends ${s
         super(wsdlLocation, SERVICE, features);
     }
 
+#if ($jaxws22)
     //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
     //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
     //compliant code instead.
+#end
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
     public ${service.Name}(URL wsdlLocation, QName serviceName, WebServiceFeature ... features)
{
         super(wsdlLocation, serviceName, features);
-    }
+    }    
 #end
 
 #foreach ($port in $service.Ports)

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml (original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/resources/META-INF/tools-plugin.xml Thu
Aug 22 18:33:13 2013
@@ -44,7 +44,21 @@ under the License.
            <generator name="ImplGenerator"/>
            <generator name="SEIGenerator"/>
            <generator name="ServerGenerator"/>
-           <generator name="JAXWS21ServiceGenerator"/>
+           <generator name="ServiceGenerator"/>
        </generators>
     </frontend>
+    <frontend name="cxf" package="org.apache.cxf.tools.wsdlto.frontend.jaxws" profile="JAXWSProfile">
+	   <container name="CXFJAXWSContainer" toolspec="jaxws-toolspec.xml"/>
+	   <processor name="WSDLToJavaProcessor" package="org.apache.cxf.tools.wsdlto.frontend.jaxws.processor"/>
+	   <builder name="JAXWSDefinitionBuilder" package="org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11"/>
+	   <generators package="org.apache.cxf.tools.wsdlto.frontend.jaxws.generators">
+	       <generator name="AntGenerator"/>
+	       <generator name="ClientGenerator"/>
+	       <generator name="FaultGenerator"/>
+	       <generator name="ImplGenerator"/>
+	       <generator name="SEIGenerator"/>
+	       <generator name="ServerGenerator"/>
+	       <generator name="ServiceGenerator"/>
+	   </generators>
+    </frontend>
 </plugin>
\ No newline at end of file

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSProfileTest.java
Thu Aug 22 18:33:13 2013
@@ -19,8 +19,10 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws;
 
+import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.tools.common.FrontEndGenerator;
 import org.apache.cxf.tools.common.Processor;
 import org.apache.cxf.tools.plugin.FrontEnd;
 import org.apache.cxf.tools.plugin.Generator;
@@ -28,8 +30,11 @@ import org.apache.cxf.tools.plugin.Plugi
 import org.apache.cxf.tools.wsdlto.core.AbstractWSDLBuilder;
 import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
 import org.apache.cxf.tools.wsdlto.core.PluginLoader;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.AntGenerator;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.generators.ImplGenerator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -57,7 +62,7 @@ public class JAXWSProfileTest extends As
 
         Map<String, FrontEnd> frontends = loader.getFrontEnds();
         assertNotNull(frontends);
-        assertEquals(2, frontends.size());
+        assertEquals(3, frontends.size());
 
         FrontEnd frontend = getFrontEnd(frontends, 0);
         assertEquals("jaxws", frontend.getName());
@@ -71,13 +76,11 @@ public class JAXWSProfileTest extends As
 
         FrontEndProfile profile = loader.getFrontEndProfile("jaxws");
         assertNotNull(profile);
-        //TODO: After generator completed ,umcomment these linses
-        /*List<FrontEndGenerator> generators = profile.getGenerators();
+        List<FrontEndGenerator> generators = profile.getGenerators();
         assertNotNull(generators);
         assertEquals(2, generators.size());
         assertTrue(generators.get(0) instanceof AntGenerator);
         assertTrue(generators.get(1) instanceof ImplGenerator);
-        */
         Processor processor = profile.getProcessor();
         assertNotNull(processor);
         assertTrue(processor instanceof WSDLToJavaProcessor);

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java?rev=1516536&r1=1516535&r2=1516536&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/core/PluginLoaderTest.java
Thu Aug 22 18:33:13 2013
@@ -41,7 +41,7 @@ public class PluginLoaderTest extends As
         
         Map<String, FrontEnd> frontends = loader.getFrontEnds();
         assertNotNull(frontends);
-        assertEquals(2, frontends.size());
+        assertEquals(3, frontends.size());
 
         FrontEnd frontend = getFrontEnd(frontends, 0);
         assertEquals("jaxws", frontend.getName());



Mime
View raw message