You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/10/16 02:55:25 UTC

svn commit: r584987 - in /incubator/tuscany/java/sca/modules: core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/ databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/ databinding/src/main/java/org/apach...

Author: rfeng
Date: Mon Oct 15 17:55:22 2007
New Revision: 584987

URL: http://svn.apache.org/viewvc?rev=584987&view=rev
Log:
Set databinding for introspected data type and enhance the checking of wrapper style

Modified:
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
    incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java Mon Oct 15 17:55:22 2007
@@ -66,7 +66,7 @@
         boolean wrapperStyle = false;
         if (dataBinding != null) {
             dataBindingId = dataBinding.value();
-            wrapperStyle = dataBinding.wrapperStyle();
+            wrapperStyle = dataBinding.wrapped();
         }
 
         Map<String, Operation> opMap = new HashMap<String, Operation>();
@@ -87,7 +87,7 @@
             wrapperStyle = false;
             if (dataBinding != null) {
                 dataBindingId = dataBinding.value();
-                wrapperStyle = dataBinding.wrapperStyle();
+                wrapperStyle = dataBinding.wrapped();
                 operation.setDataBinding(dataBindingId);
                 operation.setWrapperStyle(wrapperStyle);
             }

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java Mon Oct 15 17:55:22 2007
@@ -26,19 +26,31 @@
 import java.lang.annotation.Target;
 
 /**
- * Used to demarcate expected data types for an operation
+ * Used to demarcate the mapping style for an interface or operation
  *
  * @version $Rev$ $Date$
  */
+// FIXME: [rfeng] We should consider to use javax.jws.soap.SOAPBinding
 @Target({TYPE, METHOD})
 @Retention(RUNTIME)
 public @interface DataBinding {
 
     /**
-     * Returns the unique name of the data binding
+     * Indicate the effective databinding that controls the WSDL/Java mapping of the 
+     * interface/operation
+     * 
      * @return the unique name of the data binding
      */
     String value();
-    boolean wrapperStyle() default false;
+    
+    /**
+     * Indicate if the operation is mapped using WRAPPED or BARE style. Originated from
+     * javax.jws.soap.SOAPBinding.ParameterStyle: Determines whether method parameters 
+     * represent the entire message body, or whether the parameters are elements wrapped 
+     * inside a top-level element named after the operation
+     * 
+     * @return true if the parameter style is WRAPPED, false if BARE
+     */
+    boolean wrapped() default false;
 
 }

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java Mon Oct 15 17:55:22 2007
@@ -146,7 +146,8 @@
         String targetId = targetDataType.getDataBinding();
         List<Transformer> path = transformers.getTransformerChain(sourceId, targetId);
         if (path == null) {
-            TransformationException ex = new TransformationException("No path found for the transformation");
+            TransformationException ex =
+                new TransformationException("No path found for the transformation: " + sourceId + "->" + targetId);
             ex.setSourceDataBinding(sourceId);
             ex.setTargetDataBinding(targetId);
             throw ex;

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java Mon Oct 15 17:55:22 2007
@@ -63,6 +63,7 @@
     public boolean introspect(DataType type, Annotation[] annotations) {
         if(Node.class.isAssignableFrom(type.getPhysical())) {
             type.setLogical(new XMLType(ROOT_ELEMENT, null));
+            type.setDataBinding(NAME);
             return true;
         }
         return false;

Modified: incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java (original)
+++ incubator/tuscany/java/sca/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java Mon Oct 15 17:55:22 2007
@@ -44,6 +44,7 @@
     public boolean introspect(DataType type, Annotation[] annotations) {
         if (super.introspect(type, annotations)) {
             type.setLogical(XMLType.UNKNOWN);
+            type.setDataBinding(NAME);
             return true;
         } else {
             return false;

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java Mon Oct 15 17:55:22 2007
@@ -23,6 +23,8 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.wsdl.Fault;
 import javax.wsdl.Input;
@@ -60,6 +62,8 @@
  * @version $Rev$ $Date$
  */
 public class WSDLOperationIntrospectorImpl {
+    private static final Logger logger = Logger.getLogger(WSDLOperationIntrospectorImpl.class.getName());
+    
     private WSDLFactory wsdlFactory;
     private ModelResolver resolver;
     private WSDLDefinition wsdlDefinition;
@@ -145,7 +149,10 @@
             if (outputParts != null && outputParts.size() > 0) {
                 if (outputParts.size() > 1) {
                     // We don't support output with multiple parts
-                    throw new InvalidWSDLException("Multi-part output is not supported");
+                	if(logger.isLoggable(Level.WARNING)) {
+                		logger.warning("Multi-part output is not supported, please use BARE parameter style.");
+                	}
+                    // throw new InvalidWSDLException("Multi-part output is not supported");
                 }
                 Part part = (Part)outputParts.get(0);
                 outputType = new WSDLPart(part, Object.class).getDataType();
@@ -379,11 +386,16 @@
                 }
                 XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
                 if (childElement.getName() == null || childElement.getRefName() != null) {
-                    return null;
+                    // FIXME: [rfeng] Not very clear if the JAX-WS spec allows element-ref
+                    // return null;
                 }
                 // TODO: Do we support maxOccurs >1 ?
                 if (childElement.getMaxOccurs() > 1) {
-                    return null;
+                    // TODO: [rfeng] To be implemented
+                	if(logger.isLoggable(Level.WARNING)) {
+                		logger.warning("Support for elements with maxOccurs>1 is not implemented.");
+                	}
+                    // return null;
                 }
                 childElements.add(childElement);
             }
@@ -455,8 +467,7 @@
                     return null;
                 }
                 outputElements = getChildElements(outputWrapperElement);
-                // FIXME: Do we support multiple child elements for the
-                // response?
+                // FIXME: Do we support multiple child elements for the response?
                 return outputElements;
             } else {
                 return null;

Modified: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java (original)
+++ incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java Mon Oct 15 17:55:22 2007
@@ -128,7 +128,7 @@
             if (elements != null && elements.size() > 0) {
                 if (elements.size() > 1) {
                     // We don't support output with multiple parts
-                    throw new IllegalArgumentException("Multi-part output is not supported");
+                    // throw new IllegalArgumentException("Multi-part output is not supported");
                 }
                 ElementInfo element = elements.get(0);
 

Modified: incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java?rev=584987&r1=584986&r2=584987&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java (original)
+++ incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java Mon Oct 15 17:55:22 2007
@@ -67,6 +67,14 @@
     public QName getElementName() {
         return element;
     }
+    
+    public void setElementName(QName element) {
+        this.element = element;
+    }
+    
+    public void setTypeName(QName type) {
+        this.type = type;
+    }
 
     public static XMLType getType(QName type) {
         return new XMLType(null, type);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org