From 9f395ebf3ec27f89c8dc63137bc99c8d6b0cff6d Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:07:37 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835125 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/databinding/xstream/MetaObject.java | 37 ++++++ .../sca/databinding/xstream/MetaObjectImpl.java | 90 ++++++++++++++ .../sca/databinding/xstream/Node2XObject.java | 69 +++++++++++ .../sca/databinding/xstream/OMElement2XObject.java | 76 ++++++++++++ .../tuscany/sca/databinding/xstream/Utils.java | 74 ++++++++++++ .../tuscany/sca/databinding/xstream/XObject.java | 28 +++++ .../sca/databinding/xstream/XObject2Node.java | 69 +++++++++++ .../sca/databinding/xstream/XObject2OMElement.java | 106 +++++++++++++++++ .../databinding/xstream/XObjectDataBinding.java | 36 ++++++ .../org.apache.tuscany.sca.databinding.DataBinding | 20 ++++ ....apache.tuscany.sca.databinding.PullTransformer | 18 +++ .../databinding-xstream/src/test/resources/ipo.xml | 48 ++++++++ .../databinding-xstream/src/test/resources/ipo.xsd | 132 +++++++++++++++++++++ .../src/test/resources/order.wsdl | 76 ++++++++++++ 14 files changed, 879 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xml create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xsd create mode 100644 sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/order.wsdl (limited to 'sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src') diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.java new file mode 100644 index 0000000000..830cb8108d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.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.xstream; + +/** + * Wrapper for XObject + * @version $Rev$ $Date$ + */ +public interface MetaObject { + public void setName(String name); + + public String getName(); + + public Class getType(); + + public String getID(); + + public XObject getInstance(); + //public byte[] getByteCode(); +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java new file mode 100644 index 0000000000..df7df3d2b1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java @@ -0,0 +1,90 @@ +/* + * 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.xstream; + +import java.io.FileNotFoundException; +import java.io.IOException; + +public class MetaObjectImpl implements MetaObject { + private String obID; + private String name; + private XObject obInstance; + + //private byte[] bytecode = null; + + public MetaObjectImpl() { + this.obID = Utils.uniqueID(); + } + + public MetaObjectImpl(XObject x) { + //this.name = path; + this.obID = Utils.uniqueID(); + this.obInstance = x; + + try { + initMetaOb(this.obInstance.getClass()); + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void initMetaOb(Class class1) throws FileNotFoundException, IOException { + /* + File file = new File(cname); + DataInputStream cstream = new DataInputStream(new FileInputStream(file)); + bytecode = new byte[(int)file.length()]; + cstream.readFully(bytecode); + */ + name = class1.getName(); + + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getID() { + return obID; + } + + public Class getType() { + + return this.obInstance.getClass(); + } + + public XObject getInstance() { + return this.obInstance; + } + /* + * TODO Add bytecode with serialization + public byte[] getByteCode() { + return bytecode; + } + */ + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java new file mode 100644 index 0000000000..548d0b8df1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java @@ -0,0 +1,69 @@ +/* + * 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.xstream; + +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; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomReader; + +/** + * DOM Node --> XStream transformer + * + * @version $Rev$ $Date$ + */ +public class Node2XObject extends BaseTransformer implements PullTransformer { + + public XObject transform(Node source, TransformationContext context) { + try { + DomReader in = null; + if (source instanceof Document) { + in = new DomReader((Document)source); + } else if (source instanceof Element) { + in = new DomReader((Element)source); + } + XStream xs = new XStream(); + return (XObject)xs.unmarshal(in); + } catch (Exception e) { + throw new TransformationException(e); + } + } + + @Override + public Class getSourceType() { + return Node.class; + } + + @Override + public Class getTargetType() { + return XObject.class; + } + + @Override + public int getWeight() { + return 10; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java new file mode 100644 index 0000000000..e606507a9f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java @@ -0,0 +1,76 @@ +/* + * 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.xstream; + +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.impl.BaseTransformer; + +import com.thoughtworks.xstream.XStream; + +/** + * Job DataObject --> AXIOM OMElement transformer + * + * @version $Rev$ $Date$ + */ +public class OMElement2XObject extends BaseTransformer implements + PullTransformer { + + public XObject transform(OMElement source, TransformationContext context) { + + XStream xs = new XStream(); + xs.alias("xobject", MetaObjectImpl.class); + MetaObjectImpl mo; + try { + java.io.StringWriter writer = new StringWriter(); + source.serialize(writer); + String w = writer.toString(); + // FIXME: a better way to get eliminate param0 + w = w.replaceAll("param0", "xobject"); + w = w.replaceAll("xmlns=\"\"", ""); + mo = (MetaObjectImpl)xs.fromXML(w.trim()); + return mo.getInstance(); + } catch (XMLStreamException e) { + + e.printStackTrace(); + } + return null; + } + + @Override + public Class getSourceType() { + return OMElement.class; + } + + @Override + public Class getTargetType() { + return XObject.class; + } + + @Override + public int getWeight() { + return 10; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java new file mode 100644 index 0000000000..2de353312a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java @@ -0,0 +1,74 @@ +/* + * 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.xstream; + +import java.io.IOException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +public class Utils { + public static String toBase64(byte[] array) { + String code = null; + code = new sun.misc.BASE64Encoder().encode(array); + return code; + } + + public static byte[] fromBase64(String bytecode) { + byte[] dec = null; + try { + dec = new sun.misc.BASE64Decoder().decodeBuffer(bytecode); + } catch (IOException e) { + e.printStackTrace(); + } + return dec; + } + + public static String uniqueID() { + try { + //Initialize SecureRandom + //This is a lengthy operation, to be done only upon + //initialization of the application + SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); + + //generate a random number + String randomNum = new Integer(prng.nextInt()).toString(); + + //get its digest + MessageDigest sha = MessageDigest.getInstance("SHA-1"); + byte[] result = sha.digest(randomNum.getBytes()); + return hexEncode(result); + } catch (NoSuchAlgorithmException ex) { + ex.printStackTrace(); + } + return null; + } + + private static String hexEncode(byte[] aInput) { + StringBuffer result = new StringBuffer(); + char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + for (int idx = 0; idx < aInput.length; ++idx) { + byte b = aInput[idx]; + result.append(digits[(b & 0xf0) >> 4]); + result.append(digits[b & 0x0f]); + } + return result.toString(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java new file mode 100644 index 0000000000..1e3ab7a188 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java @@ -0,0 +1,28 @@ +/* + * 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.xstream; + +/** + * Marker interface for XStream serializable objects + * + * @version $Rev$ $Date$ + */ +// FIXME: Why do we require a marker interface? +public interface XObject { +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java new file mode 100644 index 0000000000..a284b5b0af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java @@ -0,0 +1,69 @@ +/* + * 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.xstream; + +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; +import org.apache.tuscany.sca.databinding.impl.DOMHelper; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomWriter; + +/** + * XObject --> DOM Node transformer + * + * @version $Rev$ $Date$ + */ +public class XObject2Node extends BaseTransformer implements PullTransformer { + + public Node transform(XObject source, TransformationContext context) { + try { + MetaObject mj = new MetaObjectImpl(source); + Document root = DOMHelper.newDocument(); + DomWriter out = new DomWriter(DOMHelper.newDocument()); + XStream xs = new XStream(); + xs.alias("xobject", mj.getClass()); + xs.marshal(source, out); + DOMHelper.adjustElementName(context, root.getDocumentElement()); + return root; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + @Override + public Class getSourceType() { + return XObject.class; + } + + @Override + public Class getTargetType() { + return Node.class; + } + + @Override + public int getWeight() { + return 10; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java new file mode 100644 index 0000000000..ebd282fd40 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java @@ -0,0 +1,106 @@ +/* + * 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.xstream; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +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.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; +import org.apache.tuscany.sca.interfacedef.DataType; +import org.apache.tuscany.sca.interfacedef.util.XMLType; + +import com.thoughtworks.xstream.XStream; + +/** + * XObject --> AXIOM OMElement transformer + * + * @version $Rev$ $Date$ + */ +public class XObject2OMElement extends BaseTransformer implements + PullTransformer { + + public OMElement transform(XObject source, TransformationContext context) { + MetaObject mj = new MetaObjectImpl(source); + OMElement element = null; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XStream xs = new XStream(); + xs.alias("xobject", mj.getClass()); + xs.toXML(mj, out); + /* TODO: Maybe a base64 conversion...? or not? + * ie. new ByteArrayInputStream(Utils.toBase64(out.toByteArray()).getBytes()) + */ + try { + // what's better this one: + StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(out.toByteArray())); + // or this one: + // StaAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(Utils.toBase64(out.toByteArray()).getBytes())) + element = builder.getDocumentElement(); + adjustElementName(context, element); + } catch (Exception e) { + throw new TransformationException(e); + } + return element; + + } + + private 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())) { + // FIXME:: 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()); + } + } + } + + @Override + public Class getSourceType() { + return XObject.class; + } + + @Override + public Class getTargetType() { + return OMElement.class; + } + + @Override + public int getWeight() { + return 10; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java new file mode 100644 index 0000000000..a371c09c25 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java @@ -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.sca.databinding.xstream; + +import org.apache.tuscany.sca.databinding.impl.BaseDataBinding; + +/** + * DataBinding for Jobs + */ +public class XObjectDataBinding extends BaseDataBinding { + + public static final String NAME = XObject.class.getName(); + public static final String[] ALIASES = new String[] {"xobject"}; + + public XObjectDataBinding() { + super(NAME, ALIASES, XObject.class); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding new file mode 100644 index 0000000000..f501ef2dc6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding @@ -0,0 +1,20 @@ +# 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 classes for the databindings +org.apache.tuscany.sca.databinding.xstream.XObjectDataBinding;type=org.apache.tuscany.sca.databinding.xstream.XObject,name=xobject + diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer new file mode 100644 index 0000000000..a733ad7b7d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer @@ -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. +org.apache.tuscany.sca.databinding.xstream.XObject2OMElement;source=org.apache.tuscany.sca.databinding.xstream.XObject,target=org.apache.axiom.om.OMElement,weight=10 +org.apache.tuscany.sca.databinding.xstream.OMElement2XObject;source=org.apache.axiom.om.OMElement,target=org.apache.tuscany.sca.databinding.xstream.XObject,weight=10 diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xml b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xml new file mode 100644 index 0000000000..1699538d62 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xml @@ -0,0 +1,48 @@ + + + + + + Helen Zoe + 47 Eden Street + Cambridge + CB1 1JR + + + + Robert Smith + 8 Oak Avenue + Old Town + PA + 95819 + + + + + Lapis necklace + 1 + 99.95 + Want this for the holidays + 1999-12-05 + + + + diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xsd new file mode 100644 index 0000000000..aac7ded180 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/ipo.xsd @@ -0,0 +1,132 @@ + + + + + + + International Purchase order schema for Example.com Copyright 2000 Example.com. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/order.wsdl b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/order.wsdl new file mode 100644 index 0000000000..65da5b602a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2/modules/databinding-xstream/src/test/resources/order.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3