cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r551110 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ tools/javato/core/src/main/java/org/apache/cxf/tool...
Date Wed, 27 Jun 2007 09:57:54 GMT
Author: mmao
Date: Wed Jun 27 02:57:53 2007
New Revision: 551110

URL: http://svn.apache.org/viewvc?view=rev&rev=551110
Log:
Java2Wsdl validate the service class before generating the artifacts
* In jaxws case, it will fail if the srevice class extends/implement from the java.rmi.Remote


Added:
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/Hello.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/ServiceBuilder.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsServiceBuilder.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
    incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java
    incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/ServiceBuilder.java?view=diff&rev=551110&r1=551109&r2=551110
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/ServiceBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/ServiceBuilder.java Wed Jun
27 02:57:53 2007
@@ -34,4 +34,6 @@
     void setServiceClass(Class clz);
 
     File getOutputFile();
+
+    void validate();
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsServiceBuilder.java?view=diff&rev=551110&r1=551109&r2=551110
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsServiceBuilder.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsServiceBuilder.java
Wed Jun 27 02:57:53 2007
@@ -41,6 +41,14 @@
         setBindingConfig(new JaxWsSoapBindingConfiguration(serviceFactory));
     }
 
+    @Override
+    public void validate() {
+        Class clz = getServiceClass();
+        if (java.rmi.Remote.class.isAssignableFrom(clz)) {
+            throw new RuntimeException("JAXWS SEI can not implement java.rmi.Remote interface.");
+        }
+    }
+    
     public File getOutputFile() {
         JaxWsImplementorInfo jaxwsImpl = serviceFactory.getJaxWsImplementorInfo();
         String wsdlLocation = jaxwsImpl.getWsdlLocation();

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java?view=diff&rev=551110&r1=551109&r2=551110
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java
Wed Jun 27 02:57:53 2007
@@ -40,4 +40,8 @@
         super.setServiceClass(clz);
         getServiceFactory().setServiceClass(clz);
     }
+
+    public void validate() {
+        // nothing to validate here
+    }
 }

Modified: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java?view=diff&rev=551110&r1=551109&r2=551110
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
(original)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
Wed Jun 27 02:57:53 2007
@@ -73,8 +73,8 @@
             service.setName(new QName(service.getName().getNamespaceURI(), svName));
         }
     }
-    
-    public void process() throws ToolException {
+
+    public void process() throws ToolException {        
         String oldClassPath = System.getProperty(JAVA_CLASS_PATH);
         LOG.log(Level.INFO, "OLD_CP", oldClassPath);
         if (context.get(ToolConstants.CFG_CLASSPATH) != null) {
@@ -141,6 +141,9 @@
         // TODO check if user specify the style from cli arguments
         //      builderFactory.setStyle(style/from/command/line);
         ServiceBuilder builder = builderFactory.newBuilder();
+
+        builder.validate();
+        
         if (context.get(ToolConstants.CFG_ADDRESS) != null) {
             String address = (String)context.get(ToolConstants.CFG_ADDRESS);
             builder.setAddress(address);

Modified: incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java?view=diff&rev=551110&r1=551109&r2=551110
==============================================================================
--- incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java
(original)
+++ incubator/cxf/trunk/tools/javato/core/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/ServiceBuilderFactory.java
Wed Jun 27 02:57:53 2007
@@ -49,7 +49,9 @@
             String clzName = getBuilderClassName(s);
             builder = (ServiceBuilder) Class.forName(clzName).newInstance();
         } catch (Exception e) {
-            throw new ToolException("Can not find the ServiceBulider for style: " + s, e);
+            throw new ToolException("Can not find or initialize the ServiceBulider for style:
" + s
+                                    + " Reason: \n" + e.getMessage(),
+                                    e);
         }
         builder.setServiceClass(serviceClass);
         return builder;

Added: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/Hello.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/Hello.java?view=auto&rev=551110
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/Hello.java
(added)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/Hello.java
Wed Jun 27 02:57:53 2007
@@ -0,0 +1,27 @@
+/**
+ * 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.java2wsdl.processor;
+
+import javax.jws.WebService; 
+
+@WebService
+public interface Hello extends java.rmi.Remote {
+    String hello();
+}
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?view=diff&rev=551110&r1=551109&r2=551110
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Wed Jun 27 02:57:53 2007
@@ -351,8 +351,14 @@
         assertEquals(oldCP, newCP);
     }
     
-    
-    
-    
-    
+    @Test
+    public void testWrongInterface() throws Exception {
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.java2wsdl.processor.Hello");
+        processor.setEnvironment(env);
+        try {
+            processor.process();
+        } catch (RuntimeException e) {
+            assertEquals("JAXWS SEI can not implement java.rmi.Remote interface.", e.getMessage());
+        }
+    }
 }



Mime
View raw message