You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/12/13 02:11:06 UTC

svn commit: r356439 - in /beehive/trunk: system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ wsm/src/axis/org/apache/beehive/wsm/ax...

Author: ekoneil
Date: Mon Dec 12 17:10:56 2005
New Revision: 356439

URL: http://svn.apache.org/viewcvs?rev=356439&view=rev
Log:
More incremental decoupling.  Break hard references to TypeSystemLookupService's constructor.  

More factories and some commons-discovery stuff coming.  Need to be able to discover QName <> Java mappings based on web service container.

BB: self
Test: WSM and web service control pass


Modified:
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
    beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/TypeSystemLookupService.java
    beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
    beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/wsdl/XmlBeanWSDLProcessorTest.java

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java?rev=356439&r1=356438&r2=356439&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java Mon Dec 12 17:10:56 2005
@@ -22,6 +22,7 @@
 import org.apache.beehive.controls.system.webservice.wsdl.WsdlOperation;
 import org.apache.beehive.wsm.axis.databinding.TypeSystemLookupService;
 import org.apache.beehive.wsm.util.JavaClassUtils;
+import org.apache.beehive.wsm.databinding.BindingLookupService;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -240,9 +241,9 @@
             return void.class;
         }
 
-        TypeSystemLookupService typeSystemLookup = new TypeSystemLookupService();
+        BindingLookupService bindingLookupService = TypeSystemLookupService.getInstance();
         if (!isArray) {
-            return typeSystemLookup.qname2class(xmlType);
+            return bindingLookupService.qname2class(xmlType);
         }
 
         //
@@ -251,11 +252,12 @@
         //
         Class javaReturnType;
         if (itemXmlType != null) {
-            javaReturnType = typeSystemLookup.qname2class(itemXmlType);
+            javaReturnType = bindingLookupService.qname2class(itemXmlType);
         }
         else {
-            javaReturnType = typeSystemLookup.qname2class(xmlType);
+            javaReturnType = bindingLookupService.qname2class(xmlType);
         }
+
         Object o = Array.newInstance(javaReturnType, 1);
         return o.getClass();
     }

Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java?rev=356439&r1=356438&r2=356439&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ScAxisCall.java Mon Dec 12 17:10:56 2005
@@ -32,6 +32,7 @@
 import org.apache.beehive.controls.system.webservice.wsdl.WsdlOperation;
 import org.apache.beehive.controls.system.webservice.utils.AxisTypeRegistrar;
 import org.apache.beehive.wsm.axis.databinding.TypeSystemLookupService;
+import org.apache.beehive.wsm.databinding.BindingLookupService;
 
 /**
  * This is the AXIS 1.2 implementation of the call abstraction layer of the service control.
@@ -47,10 +48,13 @@
      * @param service Service to create the call with.
      * @throws ServiceException On error.
      */
-    ScAxisCall(Service service) throws ServiceException {
-        _call = service.createCall();
+    ScAxisCall(Service service)
+        throws ServiceException {
         TypeMapping typeMapping = service.getTypeMappingRegistry().getDefaultTypeMapping();
-        _typeRegistrar = new AxisTypeRegistrar(typeMapping, new TypeSystemLookupService());
+        BindingLookupService bindingLookupService = TypeSystemLookupService.getInstance();
+
+        _call = service.createCall();
+        _typeRegistrar = new AxisTypeRegistrar(typeMapping, bindingLookupService);
     }
 
     /* -----------------------------   Protected Methods ------------------------- */
@@ -67,8 +71,9 @@
     protected void addFault(QName faultName, QName xmlType, boolean isComplexType,
                             WsdlOperation.SOAPBindingStyle style, WsdlOperation.SOAPBindingUse use) {
 
-        TypeSystemLookupService lookup = new TypeSystemLookupService();
-        Class javaType = lookup.qname2class(xmlType);
+        BindingLookupService bindingLookupService = TypeSystemLookupService.getInstance();
+        Class javaType = bindingLookupService.qname2class(xmlType);
+
         QName registeredTypeQName = registerType(javaType, xmlType, style, use);
         ((org.apache.axis.client.Call) _call).addFault(faultName, javaType, registeredTypeQName, isComplexType);
     }

Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java?rev=356439&r1=356438&r2=356439&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java Mon Dec 12 17:10:56 2005
@@ -370,8 +370,6 @@
         if(Void.TYPE.equals(type))
             return null;
 
-        // todo: need to replace this with delegation to the BindingLookupService's implementation
-        //       for the built-in types
         /* get built-in type QName */
         QName builtInQName = AxisTypeMappingMetaData.getBuiltInTypeQname(type);
         if(builtInQName != null)
@@ -384,7 +382,7 @@
         /* the type needs to be registered */
         TypeMapping tm = desc.getTypeMapping();
 
-        BindingLookupService lookupService = new TypeSystemLookupService();
+        BindingLookupService lookupService = TypeSystemLookupService.getInstance();
         QName qname = lookupService.class2qname(type, defaultNamespace);
 
         if(type.isArray()) {

Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/TypeSystemLookupService.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/TypeSystemLookupService.java?rev=356439&r1=356438&r2=356439&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/TypeSystemLookupService.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/TypeSystemLookupService.java Mon Dec 12 17:10:56 2005
@@ -30,9 +30,14 @@
 
     private ArrayList<BindingLookupService> _lookupServiceList = new ArrayList<BindingLookupService>();
 
-    public TypeSystemLookupService() {
-        _lookupServiceList.add(new XmlBeanLookupService());
-        _lookupServiceList.add(new AxisLookupService());
+    public static BindingLookupService getInstance() {
+        TypeSystemLookupService ts = new TypeSystemLookupService();
+        ts.addBindingLookupService(new XmlBeanLookupService());
+        ts.addBindingLookupService(new AxisLookupService());
+        return ts;
+    }
+
+    private TypeSystemLookupService() {
     }
 
     public void addBindingLookupService(BindingLookupService bindingLookupService) {

Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java?rev=356439&r1=356438&r2=356439&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/tools/Wsdl2AJava.java Mon Dec 12 17:10:56 2005
@@ -25,6 +25,7 @@
 import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
 import org.apache.beehive.wsm.tools.wsdl2ajava.Model2AJava;
 import org.apache.beehive.wsm.wsdl.Utilities;
+import org.apache.beehive.wsm.databinding.BindingLookupService;
 import org.apache.xmlbeans.XmlException;
 
 public final class Wsdl2AJava {
@@ -43,18 +44,21 @@
         System.out.println("Base source directory: " + args[1]);
         System.out.println("Processing WSDL: " + args[0]);
 
-        TypeSystemLookupService lookupService = new TypeSystemLookupService();
+        BindingLookupService bindingLookupService = TypeSystemLookupService.getInstance();
         XmlBeanWSDLProcessor processor;
         try {
-            processor = new XmlBeanWSDLProcessor(Utilities.parseWSDL(args[0]), lookupService);
-        } catch (MalformedURLException e) {
+            processor = new XmlBeanWSDLProcessor(Utilities.parseWSDL(args[0]), bindingLookupService);
+        }
+        catch (MalformedURLException e) {
             System.out.println("Unable to find WSDL with URL '" + args[0] + "'.");
             return;
-        } catch (XmlException e) {
+        }
+        catch (XmlException e) {
             System.out.println("Failed generating an Annotated Web Service from WSDL '"  + args[0] + "'.  Cause: " + e);
             e.printStackTrace();
             return;
-        } catch (IOException e) {
+        }
+        catch (IOException e) {
             System.out.println("Failed generating an Annotated Web Service from WSDL.  Cause: " + e);
             e.printStackTrace();
             return;

Modified: beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/wsdl/XmlBeanWSDLProcessorTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/wsdl/XmlBeanWSDLProcessorTest.java?rev=356439&r1=356438&r2=356439&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/wsdl/XmlBeanWSDLProcessorTest.java (original)
+++ beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/jsr181/wsdl/XmlBeanWSDLProcessorTest.java Mon Dec 12 17:10:56 2005
@@ -28,6 +28,7 @@
 import org.apache.beehive.wsm.model.jsr181.Jsr181ObjectModelStore;
 import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
 import org.apache.beehive.wsm.wsdl.Utilities;
+import org.apache.beehive.wsm.databinding.BindingLookupService;
 
 /**
  */
@@ -47,8 +48,8 @@
         InputStream is = null;
         try {
             is = Thread.currentThread().getContextClassLoader().getResourceAsStream("schemas/starwars.wsdl");
-            TypeSystemLookupService lookupService = new TypeSystemLookupService();
-            XmlBeanWSDLProcessor xbwp = new XmlBeanWSDLProcessor(Utilities.parseWSDL(is), lookupService);
+            BindingLookupService bindingLookupService = TypeSystemLookupService.getInstance();
+            XmlBeanWSDLProcessor xbwp = new XmlBeanWSDLProcessor(Utilities.parseWSDL(is), bindingLookupService);
             clientModel = xbwp.getObjectModel();
         }
         finally {