summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src')
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java64
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java61
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java64
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java37
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java59
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java47
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java70
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java52
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java57
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java60
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java61
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java108
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java103
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xml51
-rwxr-xr-xtags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xsd137
-rw-r--r--tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/order.wsdl76
17 files changed, 1125 insertions, 0 deletions
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java
new file mode 100644
index 0000000000..72fc90d187
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java
@@ -0,0 +1,64 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataBinding for AXIOM
+ */
+public class AxiomDataBinding extends BaseDataBinding {
+
+ public static final String NAME = OMElement.class.getName();
+ public static final String[] ALIASES = new String[] {"axiom"};
+
+ public AxiomDataBinding() {
+ super(NAME, ALIASES, OMElement.class);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseDataBinding#getWrapperHandler()
+ */
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new OMElementWrapperHandler();
+ }
+
+ public Object copy(Object source) {
+ if ( OMElement.class.isAssignableFrom(source.getClass()) ) {
+ try {
+ OMElement sourceElement = (OMElement)source;
+ return sourceElement.cloneOMElement();
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return super.copy(source);
+ }
+
+ @Override
+ public ExceptionHandler getExceptionHandler() {
+ return new AxiomExceptionHandler();
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java
new file mode 100644
index 0000000000..dd4553fc6a
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java
@@ -0,0 +1,61 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * AXIOM implementation of ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomExceptionHandler implements ExceptionHandler {
+
+ public Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ return new FaultException(message, (OMElement)faultInfo, cause);
+ }
+
+ public Object getFaultInfo(Exception exception) {
+ if (exception == null) {
+ return null;
+ }
+ FaultException faultException = (FaultException)exception;
+ return faultException.getFaultInfo();
+
+ }
+
+ public DataType<?> getFaultType(DataType exceptionType) {
+ if (FaultException.class == exceptionType.getPhysical()) {
+ XMLType type = XMLType.UNKNOWN;
+ if(exceptionType.getLogical() instanceof XMLType) {
+ type = (XMLType) exceptionType.getLogical();
+ }
+ DataType<XMLType> faultType = new DataTypeImpl<XMLType>(AxiomDataBinding.NAME, OMElement.class, type);
+ return faultType;
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
new file mode 100644
index 0000000000..28141cd144
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
@@ -0,0 +1,64 @@
+/*
+ * 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.sca.databinding.axiom;
+
+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.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Helper for AXIOM
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomHelper {
+
+ private AxiomHelper() {
+ }
+
+ /**
+ * @param context
+ * @param element
+ */
+ public static void adjustElementName(TransformationContext context, OMElement element) {
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object logical = dataType == null ? null : dataType.getLogical();
+ if (!(logical instanceof XMLType)) {
+ return;
+ }
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
+ // TODO: Throw expection or switch to the new Element
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ QName name = xmlType.getElementName();
+ OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(name.getLocalPart());
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
new file mode 100644
index 0000000000..4d2bc2b4d6
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
@@ -0,0 +1,37 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
+
+/**
+ * Transformer to convert data from a simple java bject to OMElement
+ */
+public class OMElement2Object extends SimpleType2JavaTransformer<OMElement> {
+
+ @Override
+ protected String getText(OMElement source) {
+ return source.getText();
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java
new file mode 100755
index 0000000000..3eb5878de3
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * Transformer to convert data from an OMElement to XML String
+ */
+public class OMElement2String extends BaseTransformer<OMElement, String> implements PullTransformer<OMElement, String> {
+ // private XmlOptions options;
+
+ public String transform(OMElement source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ source.serialize(writer);
+ return writer.toString();
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java
new file mode 100755
index 0000000000..c72bee62e2
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class OMElement2XMLStreamReader extends BaseTransformer<OMElement, XMLStreamReader> implements PullTransformer<OMElement, XMLStreamReader> {
+ // private XmlOptions options;
+
+ public XMLStreamReader transform(OMElement source, TransformationContext context) {
+ return source.getXMLStreamReader();
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
new file mode 100644
index 0000000000..91d00c4c79
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
@@ -0,0 +1,70 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+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.OMNamespace;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+
+/**
+ * OMElement wrapper handler implementation
+ */
+public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
+
+ private OMFactory factory;
+
+ public OMElementWrapperHandler() {
+ super();
+ this.factory = OMAbstractFactory.getOMFactory();
+ }
+
+ public OMElement create(ElementInfo element, TransformationContext context) {
+ OMElement wrapper = factory.createOMElement(element.getQName(), null);
+ return wrapper;
+ }
+
+ public void setChild(OMElement wrapper, int i, ElementInfo childElement, Object value) {
+ OMElement element = (OMElement)value;
+ QName elementName = childElement.getQName();
+ OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(childElement.getQName().getLocalPart());
+ wrapper.addChild((OMElement)value);
+ }
+
+ public List getChildren(OMElement wrapper) {
+ List<Object> elements = new ArrayList<Object>();
+ for (Iterator i = wrapper.getChildElements(); i.hasNext();) {
+ elements.add(i.next());
+ }
+ return elements;
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java
new file mode 100644
index 0000000000..50ac0ecae6
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sca.databinding.axiom;
+
+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.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
+
+/**
+ * Transformer to convert data from an simple OMElement to Java Object
+ */
+public class Object2OMElement extends Java2SimpleTypeTransformer<OMElement> {
+
+ private OMFactory factory;
+
+ public Object2OMElement() {
+ super();
+ factory = OMAbstractFactory.getOMFactory();
+ }
+
+ protected OMElement createElement(QName element, String text, TransformationContext context) {
+ OMElement omElement = factory.createOMElement(element, null);
+ factory.createOMText(omElement, text);
+ return omElement;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java
new file mode 100755
index 0000000000..b2549029f2
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java
@@ -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.sca.databinding.axiom;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class String2OMElement extends BaseTransformer<String, OMElement> implements
+ PullTransformer<String, OMElement> {
+
+ @SuppressWarnings("unchecked")
+ public OMElement transform(String source, TransformationContext context) {
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(source.getBytes()));
+ OMElement element = builder.getDocumentElement();
+ AxiomHelper.adjustElementName(context, element);
+ return element;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java
new file mode 100755
index 0000000000..ffb31aae0b
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java
@@ -0,0 +1,60 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2OMElement extends BaseTransformer<XMLStreamReader, OMElement> implements
+ PullTransformer<XMLStreamReader, OMElement> {
+
+ public XMLStreamReader2OMElement() {
+ super();
+ }
+
+ public OMElement transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(source);
+ OMElement element = builder.getDocumentElement();
+ AxiomHelper.adjustElementName(context, element);
+ return element;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java
new file mode 100644
index 0000000000..8dd3cb0f51
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java
@@ -0,0 +1,61 @@
+/*
+ * 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.sca.databinding.axiom.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.axiom.AxiomDataBinding;
+import org.apache.tuscany.sca.databinding.axiom.OMElement2Object;
+import org.apache.tuscany.sca.databinding.axiom.OMElement2String;
+import org.apache.tuscany.sca.databinding.axiom.OMElement2XMLStreamReader;
+import org.apache.tuscany.sca.databinding.axiom.Object2OMElement;
+import org.apache.tuscany.sca.databinding.axiom.String2OMElement;
+import org.apache.tuscany.sca.databinding.axiom.XMLStreamReader2OMElement;
+
+/**
+ * Module activator for AXIOM databinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomDataBindingModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ dataBindings.addDataBinding(new AxiomDataBinding());
+
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ transformers.addTransformer(new Object2OMElement());
+ transformers.addTransformer(new OMElement2Object());
+ transformers.addTransformer(new OMElement2String());
+ transformers.addTransformer(new OMElement2XMLStreamReader());
+ transformers.addTransformer(new String2OMElement());
+ transformers.addTransformer(new XMLStreamReader2OMElement());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..394d11304d
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# 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.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.databinding.axiom.module.AxiomDataBindingModuleActivator \ No newline at end of file
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..d75d729294
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java
@@ -0,0 +1,108 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Test case for SDOExceptionHandler
+ */
+public class AxiomExceptionHandlerTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " 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>"
+ + "</ipo:purchaseOrder>";
+
+ private AxiomExceptionHandler handler;
+ private OMElement faultElement;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new AxiomExceptionHandler();
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ StAXOMBuilder builder = new StAXOMBuilder(reader);
+ faultElement = builder.getDocumentElement();
+ }
+
+ public void testGetFaultType() {
+ DataType<?> dataType = handler.getFaultType(new DataTypeImpl<XMLType>(FaultException.class, null));
+ assertEquals(OMElement.class, dataType.getPhysical());
+ assertEquals(XMLType.UNKNOWN, dataType.getLogical());
+ assertEquals(AxiomDataBinding.NAME, dataType.getDataBinding());
+ dataType = handler.getFaultType(new DataTypeImpl<XMLType>(Exception.class, null));
+ assertNull(dataType);
+ }
+
+ public void testCreate() {
+
+ Exception ex = handler.createException(null, "Order", faultElement, null);
+ assertTrue(ex instanceof FaultException);
+ FaultException exception = (FaultException)ex;
+ assertEquals("Order", exception.getMessage());
+ assertSame(faultElement, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ FaultException exception = new FaultException("Order", faultElement, null);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(faultElement, faultInfo);
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
new file mode 100755
index 0000000000..7c04a98859
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
@@ -0,0 +1,103 @@
+/*
+ * 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.sca.databinding.axiom;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+
+public class OMElementTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " 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>"
+ + "</ipo:purchaseOrder>";
+
+ public final void testStringTransform() {
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(IPO_XML, null);
+ OMElement2String t2 = new OMElement2String();
+ String xml = t2.transform(element, null);
+ Assert.assertNotNull(xml);
+ Assert.assertNotNull(xml.indexOf("<ipo:comment>") != -1);
+ }
+
+ public final void testStringTransform2() {
+ String str =
+ "<p0:firstName xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xmlns:p0=\"http://helloworld\">Robert</p0:firstName>";
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(str, null);
+ OMElement2String t2 = new OMElement2String();
+ String xml = t2.transform(element, null);
+ Assert.assertNotNull(xml);
+ Assert.assertNotNull(xml.indexOf("<ipo:comment>") != -1);
+ }
+
+ public final void testStAXTransform() {
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(IPO_XML, null);
+
+ OMElement2XMLStreamReader t2 = new OMElement2XMLStreamReader();
+ XMLStreamReader reader = t2.transform(element, null);
+
+ XMLStreamReader2OMElement t3 = new XMLStreamReader2OMElement();
+ OMElement element2 = t3.transform(reader, null);
+
+ Assert.assertEquals(element2.getQName(), element.getQName());
+ Assert.assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), element2.getQName());
+ }
+
+ public final void testCopy() {
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(IPO_XML, null);
+ OMElement copy = (OMElement)new AxiomDataBinding().copy(element);
+ assertNotSame(element, copy);
+ assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getQName());
+ }
+
+}
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xml b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xml
new file mode 100755
index 0000000000..df901d183d
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<ipo:purchaseOrder
+ 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>
+</ipo:purchaseOrder>
+
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xsd b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..af1e73172d
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/ipo.xsd
@@ -0,0 +1,137 @@
+<!--
+ * 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.
+-->
+
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/order.wsdl b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/order.wsdl
new file mode 100644
index 0000000000..a5ead60382
--- /dev/null
+++ b/tags/java/sca/0.91-rc2-incubating/modules/databinding-axiom/src/test/resources/order.wsdl
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<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