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 2006/09/12 07:30:49 UTC
svn commit: r442456 [1/2] - in /incubator/tuscany/java:
samples/sca/echo.databinding/
samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/
samples/sca/helloworldws/ sca/bindings/binding.axis2/
sca/databinding/databinding-axiom/ sca/databin...
Author: rfeng
Date: Mon Sep 11 22:30:48 2006
New Revision: 442456
URL: http://svn.apache.org/viewvc?view=rev&rev=442456
Log:
Extract the WSDLOperation metadata to capture the signature of a WSDL operation
Add more IDL-related input/output transformation
Implement OM-based wrapping/unwrapping
Switch dependencies from ws-commons to org.apache.ws.commons
Added:
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementInputTransformer.java
- copied, changed from r442322, incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/ObjectArray2OM.java
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java (with props)
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java (with props)
incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java (with props)
incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/resources/order.wsdl
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java (with props)
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java (with props)
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java (with props)
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java (with props)
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java (with props)
incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java (with props)
Removed:
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/ObjectArray2OM.java
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperation.java
Modified:
incubator/tuscany/java/samples/sca/echo.databinding/pom.xml
incubator/tuscany/java/samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl
incubator/tuscany/java/samples/sca/helloworldws/pom.xml
incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
incubator/tuscany/java/sca/databinding/databinding-axiom/pom.xml
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/resources/META-INF/sca/databinding-axiom.scdl
incubator/tuscany/java/sca/databinding/databinding-framework/pom.xml
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/JavaParametersTransformer.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/MediatorImpl.java
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java
incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java
incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java
incubator/tuscany/java/sca/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl
Modified: incubator/tuscany/java/samples/sca/echo.databinding/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/echo.databinding/pom.xml?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/samples/sca/echo.databinding/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/echo.databinding/pom.xml Mon Sep 11 22:30:48 2006
@@ -67,7 +67,7 @@
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-impl</artifactId>
<version>SNAPSHOT</version>
<scope>test</scope>
Modified: incubator/tuscany/java/samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl (original)
+++ incubator/tuscany/java/samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl Mon Sep 11 22:30:48 2006
@@ -23,7 +23,7 @@
<!-- Transformers -->
<component name="transformer.ObjectArray2OM">
- <system:implementation.system class="org.apache.tuscany.databinding.axiom.ObjectArray2OM" />
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElementInputTransformer" />
</component>
<component name="transformer.XMLStreamReader2OMElement">
Modified: incubator/tuscany/java/samples/sca/helloworldws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/pom.xml?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/pom.xml Mon Sep 11 22:30:48 2006
@@ -70,13 +70,13 @@
<scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-api</artifactId>
<version>SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-impl</artifactId>
<version>SNAPSHOT</version>
<scope>runtime</scope>
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml Mon Sep 11 22:30:48 2006
@@ -82,13 +82,13 @@
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-api</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-impl</artifactId>
<version>SNAPSHOT</version>
</dependency>
@@ -128,7 +128,7 @@
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>neethi</artifactId>
<version>SNAPSHOT</version>
<scope>runtime</scope>
Modified: incubator/tuscany/java/sca/databinding/databinding-axiom/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/pom.xml?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/pom.xml (original)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/pom.xml Mon Sep 11 22:30:48 2006
@@ -50,7 +50,7 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-api</artifactId>
<version>SNAPSHOT</version>
<scope>compile</scope>
@@ -70,7 +70,7 @@
<artifactId>junit</artifactId>
</dependency>
<dependency>
- <groupId>ws-commons</groupId>
+ <groupId>org.apache.ws.commons</groupId>
<artifactId>axiom-impl</artifactId>
<version>SNAPSHOT</version>
<scope>test</scope>
Copied: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementInputTransformer.java (from r442322, incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/ObjectArray2OM.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementInputTransformer.java?view=diff&rev=442456&p1=incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/ObjectArray2OM.java&r1=442322&p2=incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementInputTransformer.java&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/ObjectArray2OM.java (original)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementInputTransformer.java Mon Sep 11 22:30:48 2006
@@ -19,88 +19,21 @@
package org.apache.tuscany.databinding.axiom;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNode;
-import org.apache.tuscany.databinding.Mediator;
-import org.apache.tuscany.databinding.PullTransformer;
-import org.apache.tuscany.databinding.TransformationContext;
import org.apache.tuscany.databinding.Transformer;
-import org.apache.tuscany.databinding.extension.TransformerExtension;
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.databinding.idl.Input2InputTransformer;
import org.osoa.sca.annotations.Service;
/**
- *
+ * Object[] --> OMElement Transformer
*/
@Service(Transformer.class)
-public class ObjectArray2OM extends TransformerExtension<Object[], OMElement> implements
- PullTransformer<Object[], OMElement> {
-
- private Mediator mediator;
-
- /**
- *
- */
- public ObjectArray2OM() {
- }
-
- /**
- * @see org.apache.tuscany.databinding.extension.TransformerExtension#getSourceType()
- */
- @Override
- protected Class getSourceType() {
- return Object[].class;
- }
-
- /**
- * @see org.apache.tuscany.databinding.extension.TransformerExtension#getTargetType()
- */
- @Override
- protected Class getTargetType() {
- return OMElement.class;
- }
-
- /**
- * @see org.apache.tuscany.databinding.Transformer#getWeight()
- */
- public int getWeight() {
- return 10;
- }
-
- @SuppressWarnings("unchecked")
- public OMElement transform(Object[] source, TransformationContext context) {
- DataType<List<DataType<QName>>> targetType = context.getTargetDataType();
- DataType<List<DataType<Class>>> sourceType = context.getSourceDataType();
- OMFactory factory = OMAbstractFactory.getOMFactory();
- QName elementName = (QName) targetType.getMetadata("element.name");
- OMElement element = factory.createOMElement(elementName, null);
- if (source == null)
- return null;
- for (int i = 0; i < source.length; i++) {
- Object child = mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical().get(i));
- if (child instanceof OMNode) {
- element.addChild((OMNode) child);
- } else {
- OMElement childElement = factory.createOMElement(targetType.getLogical().get(i).getLogical(), element);
- factory.createOMText(childElement, child.toString());
- }
- }
- return element;
- }
+public class OMElementInputTransformer extends Input2InputTransformer<OMElement> {
+ private OMFactory factory;
- /**
- * @param mediator the mediator to set
- */
- @Autowire
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
+ public OMElementInputTransformer() {
+ super(new OMElementWrapperHandler());
}
}
Added: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java (added)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,36 @@
+/*
+ * 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.tuscany.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.databinding.Transformer;
+import org.apache.tuscany.databinding.idl.Output2OutputTransformer;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Object <--> OMElement Transformer
+ */
+@Service(Transformer.class)
+public class OMElementOutputTransformer extends Output2OutputTransformer<OMElement> {
+
+ public OMElementOutputTransformer() {
+ super(new OMElementWrapperHandler());
+ }
+}
Propchange: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementOutputTransformer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java (added)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,247 @@
+/*
+ * 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.tuscany.databinding.axiom;
+
+import static org.apache.ws.commons.schema.constants.Constants.XSD_BOOLEAN;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_BYTE;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_DATETIME;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_DOUBLE;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_FLOAT;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_INT;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_LONG;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_SHORT;
+import static org.apache.ws.commons.schema.constants.Constants.XSD_STRING;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.tuscany.databinding.idl.WrapperHandler;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * OMElement wrapper handler implementation
+ */
+public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
+
+ private OMFactory factory;
+
+ public OMElementWrapperHandler() {
+ super();
+ this.factory = OMAbstractFactory.getOMFactory();
+ }
+
+ public OMElement create(XmlSchemaElement element) {
+ OMElement wrapper = factory.createOMElement(element.getQName(), null);
+ return wrapper;
+ }
+
+ public Object getChild(OMElement wrapper, int i, XmlSchemaElement element) {
+ int index = 0;
+ for (Iterator e = wrapper.getChildElements(); e.hasNext();) {
+ OMElement child = (OMElement) e.next();
+ if (index != i) {
+ continue;
+ }
+ if (child.getQName().equals(element.getQName())) {
+ XmlSchemaType type = element.getSchemaType();
+ if (type instanceof XmlSchemaSimpleType) {
+ return SimpleTypeMapper.getSimpleTypeObject(type.getQName(), child);
+ } else {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setChild(OMElement wrapper, int i, XmlSchemaElement childElement, Object value) {
+ if (childElement.getSchemaType() instanceof XmlSchemaSimpleType) {
+ OMElement child = factory.createOMElement(childElement.getQName(), wrapper);
+ factory.createOMText(child, SimpleTypeMapper.getStringValue(value));
+ } else {
+ wrapper.addChild((OMElement) value);
+ }
+ }
+
+ public static class SimpleTypeMapper {
+ private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ // 0123456789 0 123456789
+
+ static {
+ format.setTimeZone(TimeZone.getTimeZone("GMT"));
+ }
+
+ public static Object getSimpleTypeObject(QName type, OMElement value) {
+ if (type.equals(XSD_STRING)) {
+ return value.getText();
+ } else if (type.equals(XSD_INT)) {
+ return new Integer(value.getText());
+ } else if (type.equals(XSD_BOOLEAN)) {
+ return Boolean.valueOf(value.getText());
+ } else if (type.equals(XSD_BYTE)) {
+ return new Byte(value.getText());
+ } else if (type.equals(XSD_DOUBLE)) {
+ return new Double(value.getText());
+ } else if (type.equals(XSD_SHORT)) {
+ return new Short(value.getText());
+ } else if (type.equals(XSD_LONG)) {
+ return new Long(value.getText());
+ } else if (type.equals(XSD_FLOAT)) {
+ return new Float(value.getText());
+ } else if (type.equals(XSD_DATETIME)) {
+ return makeCalendar(value.getText(), false);
+ } else {
+ return value.getText();
+ }
+ }
+
+ public static String getStringValue(Object obj) {
+ if (obj instanceof Float || obj instanceof Double) {
+ double data;
+ if (obj instanceof Float) {
+ data = ((Float) obj).doubleValue();
+ } else {
+ data = ((Double) obj).doubleValue();
+ }
+ if (Double.isNaN(data)) {
+ return "NaN";
+ } else if (data == Double.POSITIVE_INFINITY) {
+ return "INF";
+ } else if (data == Double.NEGATIVE_INFINITY) {
+ return "-INF";
+ } else {
+ return obj.toString();
+ }
+ } else if (obj instanceof Calendar) {
+ return format.format(((Calendar) obj).getTime());
+ }
+ return obj.toString();
+ }
+
+ public static Object makeCalendar(String source, boolean returnDate) {
+ Calendar calendar = Calendar.getInstance();
+ Date date;
+ boolean bc = false;
+
+ // validate fixed portion of format
+ if (source == null || source.length() == 0) {
+ throw new NumberFormatException("badDateTime00");
+ }
+ if (source.charAt(0) == '+') {
+ source = source.substring(1);
+ }
+ if (source.charAt(0) == '-') {
+ source = source.substring(1);
+ bc = true;
+ }
+ if (source.length() < 19) {
+ throw new NumberFormatException("badDateTime00");
+ }
+ if (source.charAt(4) != '-' || source.charAt(7) != '-' || source.charAt(10) != 'T') {
+ throw new NumberFormatException("badDate00");
+ }
+ if (source.charAt(13) != ':' || source.charAt(16) != ':') {
+ throw new NumberFormatException("badTime00");
+ }
+ // convert what we have validated so far
+ try {
+ synchronized (format) {
+ date = format.parse(source.substring(0, 19) + ".000Z");
+ }
+ } catch (Exception e) {
+ throw new NumberFormatException(e.toString());
+ }
+ int pos = 19;
+
+ // parse optional milliseconds
+ if (pos < source.length() && source.charAt(pos) == '.') {
+ int milliseconds;
+ int start = ++pos;
+ while (pos < source.length() && Character.isDigit(source.charAt(pos))) {
+ pos++;
+ }
+ String decimal = source.substring(start, pos);
+ if (decimal.length() == 3) {
+ milliseconds = Integer.parseInt(decimal);
+ } else if (decimal.length() < 3) {
+ milliseconds = Integer.parseInt((decimal + "000").substring(0, 3));
+ } else {
+ milliseconds = Integer.parseInt(decimal.substring(0, 3));
+ if (decimal.charAt(3) >= '5') {
+ ++milliseconds;
+ }
+ }
+
+ // add milliseconds to the current date
+ date.setTime(date.getTime() + milliseconds);
+ }
+
+ // parse optional timezone
+ if (pos + 5 < source.length() && (source.charAt(pos) == '+' || (source.charAt(pos) == '-'))) {
+ if (!Character.isDigit(source.charAt(pos + 1)) || !Character.isDigit(source.charAt(pos + 2))
+ || source.charAt(pos + 3) != ':' || !Character.isDigit(source.charAt(pos + 4))
+ || !Character.isDigit(source.charAt(pos + 5))) {
+ throw new NumberFormatException("badTimezone00");
+ }
+ int hours = (source.charAt(pos + 1) - '0') * 10 + source.charAt(pos + 2) - '0';
+ int mins = (source.charAt(pos + 4) - '0') * 10 + source.charAt(pos + 5) - '0';
+ int milliseconds = (hours * 60 + mins) * 60 * 1000;
+
+ // subtract milliseconds from current date to obtain GMT
+ if (source.charAt(pos) == '+') {
+ milliseconds = -milliseconds;
+ }
+ date.setTime(date.getTime() + milliseconds);
+ pos += 6;
+ }
+ if (pos < source.length() && source.charAt(pos) == 'Z') {
+ pos++;
+ calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
+ }
+ if (pos < source.length()) {
+ throw new NumberFormatException("badChars00");
+ }
+ calendar.setTime(date);
+
+ // support dates before the Christian era
+ if (bc) {
+ calendar.set(Calendar.ERA, GregorianCalendar.BC);
+ }
+
+ if (returnDate) {
+ return date;
+ } else {
+ return calendar;
+ }
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java (original)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java Mon Sep 11 22:30:48 2006
@@ -20,22 +20,43 @@
import java.io.ByteArrayInputStream;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.tuscany.databinding.TransformationContext;
import org.apache.tuscany.databinding.TransformationException;
import org.apache.tuscany.databinding.PullTransformer;
import org.apache.tuscany.databinding.Transformer;
import org.apache.tuscany.databinding.extension.TransformerExtension;
+import org.apache.tuscany.spi.model.DataType;
import org.osoa.sca.annotations.Service;
@Service(Transformer.class)
-public class String2OMElement extends TransformerExtension<String, OMElement> implements PullTransformer<String, OMElement> {
+public class String2OMElement extends TransformerExtension<String, OMElement> implements
+ PullTransformer<String, OMElement> {
+ @SuppressWarnings("unchecked")
public OMElement transform(String source, TransformationContext context) {
try {
StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(source.getBytes()));
- return builder.getDocumentElement();
+ OMElement element = builder.getDocumentElement();
+ if (context != null) {
+ DataType<QName> dataType = context.getTargetDataType();
+ QName targetQName = dataType == null ? null : dataType.getLogical();
+ if (targetQName != null && !element.getQName().equals(targetQName)) {
+ // TODO: Throw expection or switch to the new Element
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace =
+ factory.createOMNamespace(targetQName.getNamespaceURI(), targetQName.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(targetQName.getLocalPart());
+ }
+ }
+ return element;
} catch (Exception e) {
throw new TransformationException(e);
}
Modified: incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/resources/META-INF/sca/databinding-axiom.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/resources/META-INF/sca/databinding-axiom.scdl?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/resources/META-INF/sca/databinding-axiom.scdl (original)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/resources/META-INF/sca/databinding-axiom.scdl Mon Sep 11 22:30:48 2006
@@ -23,7 +23,7 @@
<!-- Transformers -->
<component name="transformer.ObjectArray2OM">
- <system:implementation.system class="org.apache.tuscany.databinding.axiom.ObjectArray2OM" />
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElementInputTransformer" />
</component>
<component name="transformer.XMLStreamReader2OMElement">
Added: incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java (added)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,118 @@
+/*
+ * 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.tuscany.databinding.axiom;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.tuscany.databinding.TransformationContext;
+import org.apache.tuscany.databinding.impl.DataBindingRegistryImpl;
+import org.apache.tuscany.databinding.impl.MediatorImpl;
+import org.apache.tuscany.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.databinding.impl.TransformerRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl;
+import org.apache.tuscany.idl.wsdl.WSDLOperation;
+import org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl;
+import org.apache.tuscany.spi.model.DataType;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+public class OMElementWrapperTransformerTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<order1" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>" + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>" + " </shipTo>" + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>" + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>" + " <state>PA</state>" + " <zip>95819</zip>" + " </billTo>"
+ + " <items>" + " <item partNum=\"833-AA\">" + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>" + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>" + " </item>" + " </items>" + "</order1>";
+
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/order.wsdl", "OrderPortType");
+
+ private WSDLDefinitionRegistryImpl registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDefinitionRegistryImpl();
+ registry.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ }
+
+ public void testTransform() throws Exception {
+ URL url = getClass().getClassLoader().getResource("order.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("checkOrderStatus", null, null);
+ WSDLOperation op = new WSDLOperation(operation, OMElement.class.getName(), registry.getSchemaRegistry());
+ Assert.assertTrue(op.isWrapperStyle());
+
+ Object[] source = new Object[] { "cust001", IPO_XML, Integer.valueOf(1) };
+ OMElementInputTransformer t = new OMElementInputTransformer();
+ MediatorImpl m = new MediatorImpl();
+ TransformerRegistryImpl tr = new TransformerRegistryImpl();
+ tr.registerTransformer(new String2OMElement());
+ tr.registerTransformer(new OMElement2String());
+ m.setTransformerRegistry(tr);
+ m.setDataBindingRegistry(new DataBindingRegistryImpl());
+ t.setMediator(m);
+
+ TransformationContext context = new TransformationContextImpl();
+ List<DataType<Class>> types = new ArrayList<DataType<Class>>();
+ types.add(new DataType<Class>(null, String.class, String.class));
+ types.add(new DataType<Class>("java.lang.String", String.class, String.class));
+ types.add(new DataType<Class>(null, int.class, int.class));
+ DataType<List<DataType<Class>>> inputType1 =
+ new DataType<List<DataType<Class>>>("idl:input", Object[].class, types);
+ context.setSourceDataType(inputType1);
+ context.setTargetDataType(op.getInputType());
+ Object[] results = t.transform(source, context);
+ Assert.assertEquals(1, results.length);
+ System.out.println(results[0]);
+
+ TransformationContext context1 = new TransformationContextImpl();
+ context1.setSourceDataType(op.getOutputType());
+ context1.setTargetDataType(new DataType<Class>("java.lang.String", String.class, String.class));
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMElement responseElement =
+ factory.createOMElement(new QName("http://example.com/order.wsdl", "checkOrderStatusResponse"), null);
+ OMElement status = factory.createOMElement(new QName(null, "status"), responseElement);
+ factory.createOMText(status, "shipped");
+ OMElementOutputTransformer t2 = new OMElementOutputTransformer();
+ Object st = t2.transform(responseElement, context1);
+ Assert.assertEquals("shipped", st);
+
+ }
+}
Propchange: incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/resources/order.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/resources/order.wsdl?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/resources/order.wsdl (added)
+++ incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/resources/order.wsdl Mon Sep 11 22:30:48 2006
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<definitions name="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
+ xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
+ <element name="checkOrderStatus">
+ <complexType>
+ <sequence>
+ <element name="customerId" type="string" />
+ <element name="order" type="ipo:PurchaseOrderType" />
+ <element name="flag" type="int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="checkOrderStatusResponse">
+ <complexType>
+ <sequence>
+ <element name="status" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="note" type="string" />
+ </schema>
+ </types>
+
+ <message name="CheckOrderStatusInput1">
+ <part name="body" element="xsd1:checkOrderStatus" />
+ </message>
+
+ <message name="CheckOrderStatusOutput1">
+ <part name="body" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <message name="CheckOrderStatusInput2">
+ <part name="p1" element="xsd1:checkOrderStatus" />
+ <part name="p2" element="xsd1:note" />
+ </message>
+
+ <message name="CheckOrderStatusOutput2">
+ <part name="p1" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <portType name="OrderPortType">
+ <operation name="checkOrderStatus">
+ <input message="tns:CheckOrderStatusInput1" />
+ <output message="tns:CheckOrderStatusOutput1" />
+ </operation>
+ <operation name="checkOrderStatus2">
+ <input message="tns:CheckOrderStatusInput2" />
+ <output message="tns:CheckOrderStatusOutput2" />
+ </operation>
+ </portType>
+
+</definitions>
\ No newline at end of file
Modified: incubator/tuscany/java/sca/databinding/databinding-framework/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-framework/pom.xml?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-framework/pom.xml (original)
+++ incubator/tuscany/java/sca/databinding/databinding-framework/pom.xml Mon Sep 11 22:30:48 2006
@@ -52,8 +52,16 @@
<artifactId>easymock</artifactId>
</dependency>
<dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
+ <groupId>org.apache.tuscany.idl</groupId>
+ <artifactId>wsdl</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
</dependency>
</dependencies>
Added: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java (added)
+++ incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,150 @@
+/*
+ * 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.tuscany.databinding.idl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.databinding.Mediator;
+import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.TransformationContext;
+import org.apache.tuscany.databinding.Transformer;
+import org.apache.tuscany.databinding.extension.TransformerExtension;
+import org.apache.tuscany.idl.wsdl.WSDLOperation;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the input from one IDL to the other one
+ */
+@Service(Transformer.class)
+public abstract class Input2InputTransformer<T> extends TransformerExtension<Object[], Object[]> implements
+ PullTransformer<Object[], Object[]> {
+
+ protected WrapperHandler<T> wrapperHandler;
+
+ protected Mediator mediator;
+
+ /**
+ * @param wrapperHandler
+ */
+ protected Input2InputTransformer(WrapperHandler<T> wrapperHandler) {
+ super();
+ this.wrapperHandler = wrapperHandler;
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Autowire
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.extension.TransformerExtension#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.extension.TransformerExtension#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] transform(Object[] source, TransformationContext context) {
+ DataType<List<DataType<?>>> sourceType = context.getSourceDataType();
+ WSDLOperation sourceOp = (WSDLOperation) sourceType.getMetadata(WSDLOperation.class.getName());
+ boolean sourceWrapped = (sourceOp != null && sourceOp.isWrapperStyle());
+
+ DataType<List<DataType<QName>>> targetType = context.getTargetDataType();
+ WSDLOperation targetOp = (WSDLOperation) targetType.getMetadata(WSDLOperation.class.getName());
+ boolean targetWrapped = (targetOp != null && targetOp.isWrapperStyle());
+
+ if ((!sourceWrapped) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WSDLOperation.Wrapper wrapper = targetOp.getWrapper();
+ T targetWrapper = wrapperHandler.create(wrapper.getInputWrapperElement());
+ if (source == null) {
+ return new Object[] { targetWrapper };
+ }
+ List<DataType<QName>> argTypes = wrapper.getUnwrappedInputType().getLogical();
+
+ for (int i = 0; i < source.length; i++) {
+ XmlSchemaElement argElement = wrapper.getInputChildElements().get(i);
+ DataType<QName> argType = argTypes.get(i);
+ XmlSchemaType argXSDType = argElement.getSchemaType();
+ boolean isSimpleType = (argXSDType instanceof XmlSchemaSimpleType);
+ Object child = source[i];
+ if (!isSimpleType) {
+ child = mediator.mediate(source[i], sourceType.getLogical().get(i), argType);
+ wrapperHandler.setChild(targetWrapper, i, argElement, child);
+ } else {
+ wrapperHandler.setChild(targetWrapper, i, argElement, child);
+ }
+ }
+ return new Object[] { targetWrapper };
+ } else if (sourceWrapped && (!targetWrapped)) {
+ // Wrapped to Unwrapped
+ T sourceWrapper = (T) source[0];
+ List<XmlSchemaElement> childElements = sourceOp.getWrapper().getInputChildElements();
+ Object[] newArgs = new Object[childElements.size()];
+ for (int i = 0; i < childElements.size(); i++) {
+ XmlSchemaElement childElement = childElements.get(i);
+ if (childElement.getSchemaType() instanceof XmlSchemaSimpleType) {
+ Object child = wrapperHandler.getChild(sourceWrapper, i, childElement);
+ newArgs[i] = child;
+ } else {
+ Object child = wrapperHandler.getChild(sourceWrapper, i, childElement);
+ DataType<QName> childType = sourceOp.getWrapper().getUnwrappedInputType().getLogical().get(i);
+ newArgs[i] = mediator.mediate(child, childType, targetType.getLogical().get(i));
+ }
+ }
+ return newArgs;
+ } else {
+ Object[] newArgs = new Object[source.length];
+ for (int i = 0; i < source.length; i++) {
+ Object child =
+ mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical().get(i));
+ newArgs[i] = child;
+ }
+ return newArgs;
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java (added)
+++ incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,140 @@
+/*
+ * 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.tuscany.databinding.idl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.databinding.Mediator;
+import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.TransformationContext;
+import org.apache.tuscany.databinding.TransformationException;
+import org.apache.tuscany.databinding.Transformer;
+import org.apache.tuscany.databinding.extension.TransformerExtension;
+import org.apache.tuscany.idl.wsdl.WSDLOperation;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the other one
+ */
+@Service(Transformer.class)
+public abstract class Output2OutputTransformer<T> extends TransformerExtension<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ protected WrapperHandler<T> wrapperHandler;
+ protected Mediator mediator;
+
+ /**
+ * @param wrapperHandler
+ */
+ protected Output2OutputTransformer(WrapperHandler<T> wrapperHandler) {
+ super();
+ this.wrapperHandler = wrapperHandler;
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Autowire
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.extension.TransformerExtension#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.extension.TransformerExtension#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object response, TransformationContext context) {
+ try {
+ DataType<?> sourceType = context.getSourceDataType();
+ WSDLOperation sourceOp = (WSDLOperation) sourceType.getMetadata(WSDLOperation.class.getName());
+ boolean sourceWrapped = (sourceOp != null && sourceOp.isWrapperStyle());
+
+ DataType<?> targetType = context.getTargetDataType();
+ WSDLOperation targetOp = (WSDLOperation) targetType.getMetadata(WSDLOperation.class.getName());
+ boolean targetWrapped = (targetOp != null && targetOp.isWrapperStyle());
+
+ if ((!sourceWrapped) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WSDLOperation.Wrapper wrapper = targetOp.getWrapper();
+ T targetWrapper = wrapperHandler.create(wrapper.getOutputWrapperElement());
+ if (response == null) {
+ return targetWrapper;
+ }
+
+ XmlSchemaElement argElement = wrapper.getOutputChildElements().get(0);
+ DataType<QName> argType = wrapper.getUnwrappedOutputType();
+ XmlSchemaType argXSDType = argElement.getSchemaType();
+ boolean isSimpleType = (argXSDType instanceof XmlSchemaSimpleType);
+ Object child = response;
+ if (!isSimpleType) {
+ child = mediator.mediate(response, sourceType, argType);
+ wrapperHandler.setChild(targetWrapper, 0, argElement, child);
+ } else {
+ wrapperHandler.setChild(targetWrapper, 0, argElement, child);
+ }
+ return targetWrapper;
+ } else if (sourceWrapped && (!targetWrapped)) {
+ // Wrapped to Unwrapped
+ T sourceWrapper = (T) response;
+ List<XmlSchemaElement> childElements = sourceOp.getWrapper().getOutputChildElements();
+ XmlSchemaElement childElement = childElements.get(0);
+ if (childElement.getSchemaType() instanceof XmlSchemaSimpleType) {
+ return wrapperHandler.getChild(sourceWrapper, 0, childElement);
+ } else {
+ Object child = wrapperHandler.getChild(sourceWrapper, 0, childElement);
+ DataType<?> childType = sourceOp.getWrapper().getUnwrappedOutputType();
+ return mediator.mediate(child, childType, targetType);
+ }
+ } else {
+ return mediator.mediate(response, sourceType, targetType);
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java (added)
+++ incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,55 @@
+/*
+ * 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.tuscany.databinding.idl;
+
+import org.apache.ws.commons.schema.XmlSchemaElement;
+
+/**
+ * A contract for transformers to deal with wrapping/unwrapping for WSDL wrapper style operations
+ */
+public interface WrapperHandler<T> {
+ /**
+ * Create a wrapper element
+ *
+ * @param element The XSD element
+ * @return
+ */
+ T create(XmlSchemaElement element);
+
+ /**
+ * Set child element for the wrapper
+ *
+ * @param wrapper The wrapper
+ * @param i The index
+ * @param childElement The XSD element
+ * @param value The value of the child
+ */
+ void setChild(T wrapper, int i, XmlSchemaElement childElement, Object value);
+
+ /**
+ * Get child element from the wrapper
+ *
+ * @param wrapper The wrapper
+ * @param i The index
+ * @param element The XSD element
+ * @return The value of the child
+ */
+ Object getChild(T wrapper, int i, XmlSchemaElement element);
+}
Propchange: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/WrapperHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/JavaParametersTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/JavaParametersTransformer.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/JavaParametersTransformer.java (original)
+++ incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/JavaParametersTransformer.java Mon Sep 11 22:30:48 2006
@@ -19,26 +19,22 @@
package org.apache.tuscany.databinding.impl;
-import java.util.List;
-
-import org.apache.tuscany.databinding.Mediator;
-import org.apache.tuscany.databinding.PullTransformer;
-import org.apache.tuscany.databinding.TransformationContext;
import org.apache.tuscany.databinding.Transformer;
-import org.apache.tuscany.databinding.extension.TransformerExtension;
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.databinding.idl.Input2InputTransformer;
import org.osoa.sca.annotations.Service;
/**
- * This is a special transformer to convert java parameters by the inputType
+ * This is a special transformer to convert java parameters by the inputType
*/
@Service(Transformer.class)
-public class JavaParametersTransformer extends TransformerExtension<Object[], Object[]> implements
- PullTransformer<Object[], Object[]> {
+public class JavaParametersTransformer extends Input2InputTransformer<Object> {
private static final String IDL_INPUT = "idl:input";
+ public JavaParametersTransformer() {
+ super(null);
+ }
+
@Override
public String getSourceBinding() {
return IDL_INPUT;
@@ -49,58 +45,11 @@
return IDL_INPUT;
}
- private Mediator mediator;
-
- /**
- *
- */
- public JavaParametersTransformer() {
- }
-
- /**
- * @see org.apache.tuscany.databinding.extension.TransformerExtension#getSourceType()
- */
- @Override
- protected Class getSourceType() {
- return Object[].class;
- }
-
- /**
- * @see org.apache.tuscany.databinding.extension.TransformerExtension#getTargetType()
- */
- @Override
- protected Class getTargetType() {
- return Object[].class;
- }
-
/**
* @see org.apache.tuscany.databinding.Transformer#getWeight()
*/
public int getWeight() {
return 10;
- }
-
- public Object[] transform(Object[] source, TransformationContext context) {
- List sourceParameterTypes = (List) context.getSourceDataType().getLogical();
- List targetParameterTypes = (List) context.getTargetDataType().getLogical();
- Object[] args = source;
- // TODO: How to handle document-literal wrapped style?
- if (args != null) {
- Object[] newArgs = new Object[args.length];
- for (int i = 0; i < sourceParameterTypes.size(); i++) {
- newArgs[i] = mediator.mediate(args[i], (DataType) sourceParameterTypes.get(i), (DataType) targetParameterTypes.get(i));
- }
- return newArgs;
- }
- return null;
- }
-
- /**
- * @param mediator the mediator to set
- */
- @Autowire
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
}
}
Modified: incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/MediatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/MediatorImpl.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/MediatorImpl.java (original)
+++ incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/MediatorImpl.java Mon Sep 11 22:30:48 2006
@@ -18,7 +18,6 @@
*/
package org.apache.tuscany.databinding.impl;
-import java.util.Iterator;
import java.util.List;
import org.apache.tuscany.databinding.DataBindingRegistry;
@@ -35,7 +34,7 @@
import org.osoa.sca.annotations.Scope;
/**
- *
+ * Default Mediator implementation
*/
@Scope("MODULE")
public class MediatorImpl implements Mediator {
@@ -79,20 +78,17 @@
List<Transformer> path = getTransformerChain(sourceDataType, targetDataType);
Object result = source;
- for (Iterator<Transformer> i = path.iterator(); i.hasNext();) {
- Transformer transformer = i.next();
- // FIXME: We probably need to reset the context for each transformation on the path to reflect
+ int size = path.size();
+ for (int i = 0; i < size; i++) {
+ Transformer transformer = path.get(i);
+ TransformationContext context =
+ createTransformationContext(sourceDataType, targetDataType, size, i, transformer);
// the source and target type
if (transformer instanceof PullTransformer) {
- TransformationContext context =
- new TransformationContextImpl(sourceDataType, targetDataType, Thread.currentThread()
- .getContextClassLoader());
+ // For intermediate node, set data type to null
result = ((PullTransformer) transformer).transform(result, context);
} else if (transformer instanceof PushTransformer) {
- TransformationContext context =
- new TransformationContextImpl(sourceDataType, targetDataType, Thread.currentThread()
- .getContextClassLoader());
- DataPipe dataPipe = i.hasNext() ? (DataPipe) i.next() : null;
+ DataPipe dataPipe = (i < size - 1) ? (DataPipe) path.get(++i) : null;
((PushTransformer) transformer).transform(result, dataPipe.getSink(), context);
result = dataPipe.getResult();
}
@@ -101,6 +97,23 @@
return result;
}
+ private TransformationContext createTransformationContext(
+ DataType sourceDataType,
+ DataType targetDataType,
+ int size,
+ int index,
+ Transformer transformer) {
+ DataType sourceType =
+ (index == 0) ? sourceDataType
+ : new DataType<Object>(transformer.getSourceBinding(), Object.class, null);
+ DataType targetType =
+ (index == size - 1) ? targetDataType : new DataType<Object>(transformer.getTargetBinding(),
+ Object.class, null);
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ TransformationContext context = new TransformationContextImpl(sourceType, targetType, classLoader);
+ return context;
+ }
+
@SuppressWarnings("unchecked")
public void mediate(Object source, Object target, DataType sourceDataType, DataType targetDataType) {
if (source == null) {
@@ -117,20 +130,17 @@
}
List<Transformer> path = getTransformerChain(sourceDataType, targetDataType);
-
Object result = source;
- for (Iterator<Transformer> i = path.iterator(); i.hasNext();) {
- Transformer transformer = i.next();
+ int size = path.size();
+ for (int i = 0; i < size; i++) {
+ Transformer transformer = path.get(i);
+ TransformationContext context =
+ createTransformationContext(sourceDataType, targetDataType, size, i, transformer);
+
if (transformer instanceof PullTransformer) {
- TransformationContext context =
- new TransformationContextImpl(sourceDataType, targetDataType, Thread.currentThread()
- .getContextClassLoader());
result = ((PullTransformer) transformer).transform(result, context);
} else if (transformer instanceof PushTransformer) {
- TransformationContext context =
- new TransformationContextImpl(sourceDataType, targetDataType, Thread.currentThread()
- .getContextClassLoader());
- DataPipe dataPipe = i.hasNext() ? (DataPipe) i.next() : null;
+ DataPipe dataPipe = (i < size - 1) ? (DataPipe) path.get(++i) : null;
Object sink = dataPipe != null ? dataPipe.getSink() : target;
((PushTransformer) transformer).transform(result, sink, context);
result = (dataPipe != null) ? dataPipe.getResult() : null;
Modified: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java (original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java Mon Sep 11 22:30:48 2006
@@ -19,25 +19,17 @@
package org.apache.tuscany.idl.wsdl;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import javax.wsdl.Fault;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
import javax.wsdl.PortType;
import javax.xml.namespace.QName;
import org.apache.tuscany.spi.annotation.Autowire;
import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.model.DataType;
import org.apache.tuscany.spi.model.InteractionScope;
+import org.osoa.sca.annotations.Constructor;
import org.osoa.sca.annotations.Property;
/**
@@ -55,6 +47,7 @@
/**
* @param wsdlDefinitionRegistry
*/
+ @Constructor("wsdlDefinitionRegistry")
public InterfaceWSDLIntrospectorImpl(@Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) {
super();
this.wsdlDefinitionRegistry = wsdlDefinitionRegistry;
@@ -67,7 +60,7 @@
// FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS spec?
protected Map<String, org.apache.tuscany.spi.model.Operation<QName>> introspectOperations(PortType portType)
- throws NotSupportedWSDLException {
+ throws InvalidServiceContractException {
Map<String, org.apache.tuscany.spi.model.Operation<QName>> operations =
new HashMap<String, org.apache.tuscany.spi.model.Operation<QName>>();
for (Object op : portType.getOperations()) {
@@ -78,84 +71,10 @@
}
protected org.apache.tuscany.spi.model.Operation<QName> introspectOperation(Operation wsdlOp)
- throws NotSupportedWSDLException {
+ throws InvalidServiceContractException {
- Input input = wsdlOp.getInput();
- Message inputMsg = (input == null) ? null : input.getMessage();
- DataType<List<DataType<QName>>> inputType = introspectType(inputMsg);
-
- Message outputMsg;
- Output output = wsdlOp.getOutput();
- boolean oneway = false;
- if (output == null) {
- // TODO: [rfeng] Is this the correct way to determine if it's non-blocking?
- oneway = true;
- }
- outputMsg = (output == null) ? null : output.getMessage();
-
- List outputParts = (outputMsg == null) ? null : outputMsg.getOrderedParts(null);
- DataType<QName> outputType = null;
- if (outputParts != null || outputParts.size() > 0) {
- if (outputParts.size() > 1) {
- // We don't support output with multiple parts
- throw new NotSupportedWSDLException("Multi-part output is not supported");
- }
- Part part = (Part) outputParts.get(0);
- outputType = introspectType(part);
- }
-
- Collection faults = wsdlOp.getFaults().values();
- List<DataType<QName>> faultTypes = new ArrayList<DataType<QName>>();
- for (Object f : faults) {
- Fault fault = (Fault) f;
- Message faultMsg = fault.getMessage();
- List faultParts = faultMsg.getOrderedParts(null);
- if (faultParts.size() != 1) {
- throw new NotSupportedWSDLException("The fault message MUST have a single part");
- }
- Part part = (Part) faultParts.get(0);
- // A fault is typed by a message
- DataType<QName> dataType = introspectType(part);
- faultTypes.add(dataType);
- }
-
- org.apache.tuscany.spi.model.Operation<QName> operation =
- new org.apache.tuscany.spi.model.Operation<QName>(wsdlOp.getName(), inputType, outputType, faultTypes,
- oneway, defaultDataBinding);
-
- WrapperStyleOperation wrapperStyleOperation =
- new WrapperStyleOperation(wsdlOp, wsdlDefinitionRegistry.getSchemaRegistry());
- if (wrapperStyleOperation.isWrapperStyle()) {
- operation.addMetaData(WrapperStyleOperation.class.getName(), wrapperStyleOperation);
- }
- return operation;
-
- }
-
- protected DataType<List<DataType<QName>>> introspectType(Message message) {
- List<DataType<QName>> dataTypes = new ArrayList<DataType<QName>>();
- if (message != null) {
- List parts = message.getOrderedParts(null);
- for (Object p : parts) {
- Part part = (Part) p;
- DataType<QName> dataType = introspectType(part);
- dataTypes.add(dataType);
- }
- }
- DataType<List<DataType<QName>>> msgType =
- new DataType<List<DataType<QName>>>(INPUT_PARTS, Object.class, dataTypes);
- msgType.setMetadata(IDL_WSDL_DOCUMENT_LITERAL_WRPPED, Boolean.FALSE);
- return msgType;
- }
-
- protected DataType<QName> introspectType(Part part) {
- QName partTypeName = part.getElementName();
- // FIXME: How can we get the corresponing type name for the element? We need the XSD model
- if (partTypeName == null) {
- partTypeName = part.getTypeName();
- }
- // FIXME: What java class is it? Should we try to see if there's a generated one?
- return new DataType<QName>(defaultDataBinding, Object.class, partTypeName);
+ WSDLOperation op = new WSDLOperation(wsdlOp, defaultDataBinding, wsdlDefinitionRegistry.getSchemaRegistry());
+ return op.getOperation();
}
/**
Added: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java (added)
+++ incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,57 @@
+/*
+ * 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.tuscany.idl.wsdl;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * An exception to indicate the WSDL definition is invalid
+ */
+public class InvalidWSDLException extends InvalidServiceContractException {
+
+ /**
+ *
+ */
+ public InvalidWSDLException() {
+ }
+
+ /**
+ * @param message
+ */
+ public InvalidWSDLException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InvalidWSDLException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param cause
+ */
+ public InvalidWSDLException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org