summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-08-05 15:16:43 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-08-05 15:16:43 +0000
commit4487c2548f7ce51d57d0f23a932c9e334637afe1 (patch)
treed23c40a279ad73ea081491abb54dee9d71359fdd
parentaff23555cb8b3adeabbdd44c654cd4fa385e9d81 (diff)
Add a port of the 2.x version of the JSON databinding. This works with the JSONP binding. If I apply the 2.x changes to the existing JSON databinding the I can get the JSONP binding to work but it messes up other bindings, e.g. JSONRPC, which rely on it. These other bindings have been changed for 2.x also. Not in build yet.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@982657 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/LICENSE202
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/NOTICE6
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/pom.xml155
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.java72
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2String.java61
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.java65
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.java76
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONHelper.java106
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.java81
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.java142
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/String2JSON.java64
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.java77
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.java94
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.java57
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.java176
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.java49
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.java76
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.java65
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.java128
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java83
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer34
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/LICENSE202
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/MANIFEST.MF48
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/NOTICE6
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer34
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.classbin0 -> 2145 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2String.classbin0 -> 1866 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.classbin0 -> 2286 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.classbin0 -> 2658 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONHelper.classbin0 -> 2460 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.classbin0 -> 2452 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject$1.classbin0 -> 1151 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.classbin0 -> 5534 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/String2JSON.classbin0 -> 2298 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.classbin0 -> 3009 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.classbin0 -> 4123 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.classbin0 -> 972 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.classbin0 -> 4401 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.classbin0 -> 1756 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.classbin0 -> 2654 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.classbin0 -> 2309 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.classbin0 -> 4551 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.classbin0 -> 2697 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JSONTransformerTestCase.xml64
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JavaBean2JSONTestCase.xml63
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.POJOTestCase.xml65
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/ipo.xsd136
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.classbin0 -> 5901 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$MyBean.classbin0 -> 2344 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$YourBean.classbin0 -> 938 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.classbin0 -> 3607 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyBean.classbin0 -> 3629 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterface.classbin0 -> 222 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.classbin0 -> 1152 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/POJOTestCase.classbin0 -> 3815 bytes
-rw-r--r--sca-java-1.x/trunk/modules/databinding-json-2-x/target/tuscany-databinding-json-2-x-1.7-SNAPSHOT.jarbin0 -> 34686 bytes
58 files changed, 2527 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/LICENSE b/sca-java-1.x/trunk/modules/databinding-json-2-x/LICENSE
new file mode 100644
index 0000000000..75b52484ea
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/NOTICE b/sca-java-1.x/trunk/modules/databinding-json-2-x/NOTICE
new file mode 100644
index 0000000000..51042eab05
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/pom.xml b/sca-java-1.x/trunk/modules/databinding-json-2-x/pom.xml
new file mode 100644
index 0000000000..0eeb6b3723
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/pom.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-json-2-x</artifactId>
+ <name>Apache Tuscany SCA Data Binding for JSON from 2.x codebase</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>1.5.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.5.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ <version>1.5.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jabsorb</groupId>
+ <artifactId>jabsorb</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.0.1</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.7</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <configuration>
+ <instructions>
+ <Bundle-Version>${tuscany.version}</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.json</Bundle-SymbolicName>
+ <Bundle-Description>${pom.name}</Bundle-Description>
+ <Export-Package>org.apache.tuscany.sca.databinding.json*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.java
new file mode 100644
index 0000000000..edb3498aeb
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.java
@@ -0,0 +1,72 @@
+/*
+ * 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.json2x;
+
+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.javabeans.JavaBeansDataBinding;
+import org.jabsorb.JSONSerializer;
+import org.jabsorb.serializer.SerializerState;
+
+/**
+ * @version $Rev: 822905 $ $Date: 2009-10-07 21:52:32 +0100 (Wed, 07 Oct 2009) $
+ */
+public class JSON2JavaBean implements PullTransformer<Object, Object> {
+ private JSONSerializer serializer;
+
+ public JSON2JavaBean() {
+ super();
+ serializer = new JSONSerializer();
+ try {
+ serializer.registerDefaultSerializers();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ serializer.setMarshallClassHints(true);
+ serializer.setMarshallNullAttributes(true);
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+
+ try {
+ SerializerState state = new SerializerState();
+ return serializer.unmarshall(state, context.getTargetDataType().getPhysical(), source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+
+ }
+
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ public String getTargetDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ public int getWeight() {
+ return 5000;
+ }
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2String.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2String.java
new file mode 100644
index 0000000000..d5f1817018
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2String.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.json2x;
+
+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;
+
+/**
+ * @version $Rev: 916888 $ $Date: 2010-02-27 00:44:05 +0000 (Sat, 27 Feb 2010) $
+ */
+public class JSON2String extends BaseTransformer<Object, String> implements
+ PullTransformer<Object, String> {
+
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class<String> getTargetType() {
+ return String.class;
+ }
+
+ public String transform(Object source, TransformationContext context) {
+ try {
+ return source.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.java
new file mode 100644
index 0000000000..fcc6348b57
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.java
@@ -0,0 +1,65 @@
+/*
+ * 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.json2x;
+
+import javax.xml.stream.XMLStreamReader;
+
+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.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.codehaus.jettison.json.JSONObject;
+
+/**
+ * @version $Rev: 916888 $ $Date: 2010-02-27 00:44:05 +0000 (Sat, 27 Feb 2010) $
+ */
+public class JSON2XMLStreamReader extends BaseTransformer<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class<XMLStreamReader> getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(Object source, TransformationContext context) {
+ try {
+ JSONObject json = JSONHelper.toJettison(source);
+ return new BadgerFishXMLStreamReader(json);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.java
new file mode 100644
index 0000000000..9562f09a17
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.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.json2x;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.codehaus.jettison.json.JSONObject;
+
+/**
+ * JAXB DataBinding
+ *
+ * @version $Rev: 916888 $ $Date: 2010-02-27 00:44:05 +0000 (Sat, 27 Feb 2010) $
+ */
+public class JSONDataBinding extends BaseDataBinding {
+ public static final String NAME = "JSON2x";
+
+ public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/json/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public JSONDataBinding() {
+ super(NAME, org.json.JSONObject.class);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Operation operation) {
+ assert type != null;
+ Class cls = type.getPhysical();
+ if (JSONObject.class.isAssignableFrom(cls) || org.json.JSONObject.class.isAssignableFrom(cls)) {
+ type.setDataBinding(getName());
+ if (type.getLogical() == null) {
+ type.setLogical(XMLType.UNKNOWN);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object copy(Object arg,
+ DataType dataType,
+ Operation operation) {
+ if (arg == null) {
+ return null;
+ }
+ try {
+ Class type = arg != null ? arg.getClass() : null;
+ return JSONHelper.toJSON(arg.toString(), type);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONHelper.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONHelper.java
new file mode 100644
index 0000000000..d6e26f9fc7
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JSONHelper.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.json2x;
+
+import java.util.Collection;
+
+import org.apache.tuscany.sca.databinding.json2x.jackson.JacksonHelper;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.json.JSONArray;
+
+/**
+ * @version $Rev: 945980 $ $Date: 2010-05-19 01:53:52 +0100 (Wed, 19 May 2010) $
+ */
+public class JSONHelper {
+ private JSONHelper() {
+
+ }
+
+ /**
+ * Convert to Jettison JSONObject
+ * @param source
+ * @return
+ */
+ public static JSONObject toJettison(Object source) {
+ JSONObject json = null;
+ if (source instanceof JSONObject) {
+ json = (JSONObject)source;
+ } else if (source instanceof org.json.JSONObject || source instanceof String) {
+ json = stringToJettision(source.toString());
+ } else if (source instanceof JsonNode) {
+ json = stringToJettision(JacksonHelper.toString((JsonNode)source));
+ } else if (source instanceof JsonParser) {
+ json = stringToJettision(JacksonHelper.toString((JsonParser)source));
+ }
+ return json;
+ }
+
+ private static JSONObject stringToJettision(String content) {
+ try {
+ return new JSONObject(content);
+ } catch (JSONException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * Convert to org.json.JSONObject
+ * @param source
+ * @return
+ */
+ public static org.json.JSONObject toJSONOrg(Object source) {
+ org.json.JSONObject json = null;
+ if (source instanceof JSONObject) {
+ try {
+ json = new org.json.JSONObject(((JSONObject)source).toString());
+ } catch (org.json.JSONException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else if (source instanceof org.json.JSONObject) {
+ json = (org.json.JSONObject)source;
+ }
+ return json;
+ }
+
+ public static Object toJSON(String json, Class<?> type) {
+ if (type == JSONObject.class) {
+ try {
+ return new JSONObject(json);
+ } catch (JSONException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+ if (type == null) {
+ type = org.json.JSONObject.class;
+ }
+ try {
+ if (type == JSONArray.class || type.isArray() || Collection.class.isAssignableFrom(type)) {
+ return new JSONArray(json);
+ }
+ return new org.json.JSONObject(json);
+ } catch (org.json.JSONException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.java
new file mode 100644
index 0000000000..03c1ee17ed
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.java
@@ -0,0 +1,81 @@
+/*
+ * 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.json2x;
+
+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.javabeans.JavaBeansDataBinding;
+import org.jabsorb.JSONSerializer;
+import org.jabsorb.serializer.SerializerState;
+
+public class JavaBean2JSON extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+ private JSONSerializer serializer;
+
+ public JavaBean2JSON() {
+ serializer = new JSONSerializer();
+ try {
+ serializer.registerDefaultSerializers();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ serializer.setMarshallClassHints(true);
+ serializer.setMarshallNullAttributes(true);
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ public Object toJSON(Object source) throws Exception {
+ if (source == null) {
+ return org.json.JSONObject.NULL;
+ }
+
+ SerializerState state = new SerializerState();
+ return serializer.marshall(state, null, source, new Integer(0));
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ try {
+ return toJSON(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.java
new file mode 100644
index 0000000000..5c51d9c9e3
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.java
@@ -0,0 +1,142 @@
+/*
+ * 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.json2x;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+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.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+
+public class JavaBean2JSONObject extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+ private static final SimpleTypeMapper SIMPLE_TYPE_MAPPER = new SimpleTypeMapperImpl();
+
+ private static final Comparator<PropertyDescriptor> COMPARATOR = new Comparator<PropertyDescriptor>() {
+ public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
+ private static final Object[] NULL = null;
+
+ private static String getStringValue(Object o) {
+ if (o == null) {
+ return null;
+ }
+ TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
+ if (info != null) {
+ return MAPPER.toXMLLiteral(info.getQName(), o, null);
+ } else {
+ return String.valueOf(o);
+ }
+ }
+
+ private static boolean isSimpleType(Class<?> javaType) {
+ return SimpleTypeMapperImpl.getXMLType(javaType) != null;
+ }
+
+ public JavaBean2JSONObject() {
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ public Object toJSON(Object source) throws Exception {
+ if (source == null) {
+ return JSONObject.NULL;
+ }
+ Class<?> type = source.getClass();
+ if (isSimpleType(type)) {
+ return source;
+ } else if (type.isArray()) {
+ JSONArray array = new JSONArray();
+ int i1 = Array.getLength(source);
+ for (int j = 0; j < i1; j++) {
+ Object o = Array.get(source, j);
+ array.put(toJSON(o));
+ }
+ return array;
+ } else if (Collection.class.isAssignableFrom(type)) {
+ Collection c = (Collection)source;
+ JSONArray array = new JSONArray();
+ for (Object element : c) {
+ array.put(toJSON(element));
+ }
+ return array;
+ }
+ JSONObject json = new JSONObject();
+ BeanInfo beanInfo = Introspector.getBeanInfo(type);
+ PropertyDescriptor[] propDescs = beanInfo.getPropertyDescriptors();
+ Collections.sort(Arrays.asList(propDescs), COMPARATOR);
+
+ for (int i = 0; i < propDescs.length; i++) {
+ PropertyDescriptor propDesc = propDescs[i];
+ Class<?> pType = propDesc.getPropertyType();
+ if ("class".equals(propDesc.getName())) {
+ continue;
+ }
+ Object pValue = propDesc.getReadMethod().invoke(source, NULL);
+ json.put(propDesc.getName(), toJSON(pValue));
+ }
+ return json;
+
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ try {
+ return toJSON(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/String2JSON.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/String2JSON.java
new file mode 100644
index 0000000000..7de6e0073c
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/String2JSON.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.json2x;
+
+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;
+
+/**
+ * @version $Rev: 916888 $ $Date: 2010-02-27 00:44:05 +0000 (Sat, 27 Feb 2010) $
+ */
+public class String2JSON extends BaseTransformer<String, Object> implements PullTransformer<String, Object> {
+
+ @Override
+ protected Class<String> getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ public Object transform(String source, TransformationContext context) {
+ try {
+ Class type = null;
+ if (context != null && context.getTargetDataType() != null) {
+ type = context.getTargetDataType().getPhysical();
+ }
+ return JSONHelper.toJSON(source, type);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.java
new file mode 100644
index 0000000000..78e23b6c7e
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.java
@@ -0,0 +1,77 @@
+/*
+ * 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.json2x;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+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.xml.XMLStreamSerializer;
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter;
+
+/**
+ * @version $Rev: 659284 $ $Date: 2008-05-22 23:26:18 +0100 (Thu, 22 May 2008) $
+ */
+public class XMLStreamReader2JSON extends BaseTransformer<XMLStreamReader, Object> implements
+ PullTransformer<XMLStreamReader, Object> {
+
+ @Override
+ protected Class<XMLStreamReader> getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class<Object> getTargetType() {
+ return Object.class;
+ }
+
+ public Object transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ XMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(writer);
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ serializer.serialize(source, jsonWriter);
+ source.close();
+ Class type = null;
+ if (context != null && context.getTargetDataType() != null) {
+ type = context.getTargetDataType().getPhysical();
+ }
+ return JSONHelper.toJSON(writer.toString(), type);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.java
new file mode 100644
index 0000000000..882fea2547
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.java
@@ -0,0 +1,94 @@
+/*
+ * 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.json2x.axiom;
+
+
+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.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.json2x.JSONDataBinding;
+import org.apache.tuscany.sca.databinding.json2x.JSONHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.codehaus.jettison.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev: 659284 $ $Date: 2008-05-22 23:26:18 +0100 (Thu, 22 May 2008) $
+ */
+@Service(Transformer.class)
+public class JSON2OMElement extends BaseTransformer<Object, OMElement> implements PullTransformer<Object, OMElement> {
+
+ private OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ @Override
+ protected Class<Object> getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class<OMElement> getTargetType() {
+ return OMElement.class;
+ }
+
+ public OMElement transform(Object source, TransformationContext context) {
+ try {
+ JSONObject json = JSONHelper.toJettison(source);
+ if (json == null) {
+ return null;
+ }
+ String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
+ String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
+ if (context != null) {
+ DataType<?> dataType = context.getTargetDataType();
+ Object logical = dataType.getLogical();
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement()) {
+ ns = xmlType.getElementName().getNamespaceURI();
+ name = xmlType.getElementName().getLocalPart();
+ }
+ }
+ }
+ JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(json);
+ OMNamespace namespace = factory.createOMNamespace(ns, "");
+ return factory.createOMElement(ds, name, namespace);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.java
new file mode 100644
index 0000000000..157b79a53f
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.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.json2x.axiom;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+
+/**
+ * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
+ * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
+ * This uses the "Badgerfish" JSON convention.
+ *
+ * @version $Rev: 567542 $ $Date: 2007-08-20 06:13:29 +0100 (Mon, 20 Aug 2007) $
+ */
+
+public class JSONBadgerfishDataSource extends JSONDataSource {
+
+ public JSONBadgerfishDataSource(JSONObject json) {
+ super(json);
+ }
+
+ /**
+ * Gives the StAX reader using the "Badgerfish" formatted input JSON String.
+ *
+ * @return The XMLStreamReader according to the JSON String.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
+ */
+ @Override
+ public javax.xml.stream.XMLStreamReader getReader() throws XMLStreamException {
+ try {
+ return new BadgerFishXMLStreamReader(json);
+ } catch (JSONException e) {
+ throw new XMLStreamException(e);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.java
new file mode 100644
index 0000000000..a0eba7a6f7
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.java
@@ -0,0 +1,176 @@
+/*
+ * 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.json2x.axiom;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMOutputFormat;
+import org.codehaus.jettison.json.JSONObject;
+import org.codehaus.jettison.json.JSONTokener;
+import org.codehaus.jettison.mapped.MappedXMLInputFactory;
+
+/**
+ * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
+ * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
+ * This uses the "Mapped" JSON convention.
+ *
+ * @version $Rev: 656170 $ $Date: 2008-05-14 10:17:54 +0100 (Wed, 14 May 2008) $
+ */
+
+public class JSONDataSource implements OMDataSource {
+ protected JSONObject json;
+
+ public JSONDataSource(JSONObject json) {
+ this.json = json;
+ }
+
+ /**
+ * Writes JSON into the output stream. As this should write JSON, it directly gets the JSON string and writes it
+ * without expanding the tree.
+ *
+ * @param outputStream the stream to be written into
+ * @param omOutputFormat format of the message, this is ignored.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message in to the output
+ * stream.
+ */
+ public void serialize(OutputStream outputStream, OMOutputFormat omOutputFormat)
+ throws javax.xml.stream.XMLStreamException {
+ try {
+ String encoding = omOutputFormat == null ? "UTF-8" : omOutputFormat.getCharSetEncoding();
+ outputStream.write(getJSONString().getBytes(encoding));
+ } catch (IOException e) {
+ throw new OMException();
+ }
+ }
+
+ /**
+ * Writes JSON through the writer. As this should write JSON, it directly gets the JSON string and writes it without
+ * expanding the tree.
+ *
+ * @param writer Writer to be written into
+ * @param omOutputFormat format of the message, this is ignored.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the writer.
+ */
+ public void serialize(Writer writer, OMOutputFormat omOutputFormat) throws javax.xml.stream.XMLStreamException {
+ try {
+ writer.write(getJSONString());
+ } catch (IOException e) {
+ throw new OMException();
+ }
+ }
+
+ /**
+ * Writes XML through the XMLStreamWriter. As the input data source is JSON, this method needs to get a StAX reader
+ * from that JSON String. Therefore this uses the getReader() method to get the StAX reader writes the events into
+ * the XMLStreamWriter.
+ *
+ * @param xmlStreamWriter StAX writer to be written into
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the StAX
+ * writer.
+ */
+ public void serialize(javax.xml.stream.XMLStreamWriter xmlStreamWriter) throws javax.xml.stream.XMLStreamException {
+ XMLStreamReader reader = getReader();
+ xmlStreamWriter.writeStartDocument();
+ while (reader.hasNext()) {
+ int x = reader.next();
+ switch (x) {
+ case XMLStreamConstants.START_ELEMENT:
+ xmlStreamWriter.writeStartElement(reader.getPrefix(), reader.getLocalName(), reader
+ .getNamespaceURI());
+ int namespaceCount = reader.getNamespaceCount();
+ for (int i = namespaceCount - 1; i >= 0; i--) {
+ xmlStreamWriter.writeNamespace(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
+ }
+ int attributeCount = reader.getAttributeCount();
+ for (int i = 0; i < attributeCount; i++) {
+ xmlStreamWriter.writeAttribute(reader.getAttributePrefix(i),
+ reader.getAttributeNamespace(i),
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
+ }
+ break;
+ case XMLStreamConstants.START_DOCUMENT:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ xmlStreamWriter.writeCharacters(reader.getText());
+ break;
+ case XMLStreamConstants.CDATA:
+ xmlStreamWriter.writeCData(reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ xmlStreamWriter.writeEndElement();
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ xmlStreamWriter.writeEndDocument();
+ break;
+ case XMLStreamConstants.SPACE:
+ break;
+ case XMLStreamConstants.COMMENT:
+ xmlStreamWriter.writeComment(reader.getText());
+ break;
+ case XMLStreamConstants.DTD:
+ xmlStreamWriter.writeDTD(reader.getText());
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ xmlStreamWriter.writeProcessingInstruction(reader.getPITarget(), reader.getPIData());
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ xmlStreamWriter.writeEntityRef(reader.getLocalName());
+ break;
+ default:
+ throw new OMException();
+ }
+ }
+ xmlStreamWriter.writeEndDocument();
+ }
+
+ /**
+ * Gives the StAX reader using the "Mapped" formatted input JSON String.
+ *
+ * @return The XMLStreamReader according to the JSON String.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
+ */
+
+ public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException {
+
+ Map<String, String> nsMap = new HashMap<String, String>();
+ nsMap.put("", "");
+
+ // input factory for "Mapped" convention
+ MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap);
+ String jsonString = this.getJSONString();
+ return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
+ }
+
+ // returns the json string by consuming the JSON input stream.
+ protected String getJSONString() {
+ return json.toString();
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.java
new file mode 100644
index 0000000000..66ec073e6b
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.java
@@ -0,0 +1,49 @@
+/*
+ * 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.json2x.jackson;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.json2x.JSONDataBinding;
+
+/**
+ *
+ */
+public class InputStream2JSON implements PullTransformer<InputStream, Object> {
+
+ public String getSourceDataBinding() {
+ return "application/json" + "#" + InputStream.class.getName();
+ }
+
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+ public Object transform(InputStream source, TransformationContext context) {
+ return JacksonHelper.createJsonParser(source);
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.java
new file mode 100644
index 0000000000..952e7a752a
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.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.json2x.jackson;
+
+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.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.json2x.JSONDataBinding;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.type.TypeFactory;
+import org.codehaus.jackson.type.JavaType;
+
+/**
+ * @version $Rev: 945980 $ $Date: 2010-05-19 01:53:52 +0100 (Wed, 19 May 2010) $
+ */
+public class JSON2Object implements PullTransformer<Object, Object> {
+ private ObjectMapper mapper;
+
+ public JSON2Object() {
+ super();
+ mapper = JacksonHelper.createObjectMapper();
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+
+ try {
+ JavaType javaType = TypeFactory.type(context.getTargetDataType().getGenericType());
+ if (source instanceof String) {
+ return mapper.readValue((String)source, javaType);
+ } else if (source instanceof JsonNode) {
+ return mapper.treeToValue((JsonNode)source, context.getTargetDataType().getPhysical());
+ } else if (source instanceof JsonParser) {
+ return mapper.readValue((JsonParser)source, javaType);
+ } else {
+ return mapper.readValue(source.toString(), javaType);
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ public String getTargetDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ public int getWeight() {
+ return 5000;
+ }
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.java
new file mode 100644
index 0000000000..d832cb767d
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.java
@@ -0,0 +1,65 @@
+/*
+ * 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.json2x.jackson;
+
+import java.io.OutputStream;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.json2x.JSONDataBinding;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonParser;
+
+/**
+ *
+ */
+public class JSON2OutputStream implements PushTransformer<Object, OutputStream> {
+
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ public String getTargetDataBinding() {
+ return "application/json" + "#" + OutputStream.class.getName();
+ }
+
+ public void transform(Object source, OutputStream sink, TransformationContext context) {
+ if (source == null) {
+ return;
+ }
+ if (source instanceof JsonNode) {
+ JacksonHelper.write((JsonNode)source, sink);
+ } else if (source instanceof JsonParser) {
+ JacksonHelper.write((JsonParser)source, sink);
+ } else {
+ try {
+ sink.write(source.toString().getBytes("UTF-8"));
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.java
new file mode 100644
index 0000000000..d460a9f92a
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.java
@@ -0,0 +1,128 @@
+/*
+ * 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.json2x.jackson;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringWriter;
+
+import org.codehaus.jackson.JsonEncoding;
+import org.codehaus.jackson.JsonFactory;
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.map.AnnotationIntrospector;
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector;
+import org.codehaus.jackson.xc.JaxbAnnotationIntrospector;
+
+/**
+ *
+ */
+public class JacksonHelper {
+ public static ObjectMapper createObjectMapper() {
+ ObjectMapper mapper = new ObjectMapper();
+ AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
+ AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
+ AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary, secondary);
+ mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
+ // [rfeng] To avoid complaints about javaClass
+ mapper.getDeserializationConfig().set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
+ mapper.getSerializationConfig().setAnnotationIntrospector(pair);
+ return mapper;
+ }
+
+ public static String toString(JsonNode node) {
+ try {
+ JsonFactory jsonFactory = new JsonFactory();
+ StringWriter sw = new StringWriter();
+ JsonGenerator generator = jsonFactory.createJsonGenerator(sw);
+ generator.writeTree(node);
+ return sw.toString();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static String toString(JsonParser parser) {
+ try {
+ JsonFactory jsonFactory = new JsonFactory();
+ StringWriter sw = new StringWriter();
+ JsonGenerator generator = jsonFactory.createJsonGenerator(sw);
+ JsonNode node = parser.readValueAs(JsonNode.class);
+ generator.writeTree(node);
+ return sw.toString();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static JsonParser createJsonParser(String content) {
+ JsonFactory jsonFactory = new JsonFactory();
+ try {
+ return jsonFactory.createJsonParser(content);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static JsonParser createJsonParser(InputStream content) {
+ JsonFactory jsonFactory = new JsonFactory();
+ try {
+ return jsonFactory.createJsonParser(content);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static JsonParser createJsonParser(Reader content) {
+ JsonFactory jsonFactory = new JsonFactory();
+ try {
+ return jsonFactory.createJsonParser(content);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static void write(JsonNode node, OutputStream out) {
+ try {
+ JsonFactory jsonFactory = new JsonFactory();
+ JsonGenerator generator = jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
+ generator.writeTree(node);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static void write(JsonParser parser, OutputStream out) {
+ try {
+ JsonFactory jsonFactory = new JsonFactory();
+ JsonGenerator generator = jsonFactory.createJsonGenerator(out, JsonEncoding.UTF8);
+ JsonNode node = parser.readValueAs(JsonNode.class);
+ generator.writeTree(node);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java
new file mode 100644
index 0000000000..d7d04d7848
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.java
@@ -0,0 +1,83 @@
+/*
+ * 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.json2x.jackson;
+
+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.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.json2x.JSONDataBinding;
+import org.apache.tuscany.sca.databinding.json2x.JSONHelper;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.map.ObjectMapper;
+
+/**
+ * @version $Rev: 948680 $ $Date: 2010-05-27 06:59:55 +0100 (Thu, 27 May 2010) $
+ */
+public class Object2JSON implements PullTransformer<Object, Object> {
+ private ObjectMapper mapper;
+
+ public Object2JSON() {
+ super();
+ mapper = JacksonHelper.createObjectMapper();
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+
+ Class<?> targetType = null;
+ if (context != null && context.getTargetDataType() != null) {
+ targetType = context.getTargetDataType().getPhysical();
+ }
+ if (targetType == null) {
+ targetType = String.class;
+ }
+ try {
+ String value = mapper.writeValueAsString(source);
+ if (targetType == String.class || targetType == Object.class) {
+ return value;
+ } else if (JsonNode.class.isAssignableFrom(targetType)) {
+ return JacksonHelper.createJsonParser(value).readValueAsTree();
+ }
+ if (JsonParser.class.isAssignableFrom(targetType)) {
+ return JacksonHelper.createJsonParser(value);
+ } else {
+ return JSONHelper.toJSON(value, targetType);
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ public int getWeight() {
+ return 5000;
+ }
+}
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..d7549f0af3
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/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.json2x.JSONDataBinding;name=JSON2x
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..0eb24f31a3
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -0,0 +1,34 @@
+# 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 transformers
+org.apache.tuscany.sca.databinding.json2x.JSON2XMLStreamReader;source=JSON2x,target=javax.xml.stream.XMLStreamReader,weight=5000
+org.apache.tuscany.sca.databinding.json2x.XMLStreamReader2JSON;source=javax.xml.stream.XMLStreamReader,target=JSON2x,weight=5000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=java:complexType,target=JSON2x,weight=90000,public=true
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=java:simpleType,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.axiom.JSON2OMElement;source=JSON2x,target=org.apache.axiom.om.OMElement,weight=500
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=java:array,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=commonj.sdo.DataObject,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=javax.xml.bind.JAXBElement,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=java:complexType,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=java:simpleType,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=commonj.sdo.DataObject,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=javax.xml.bind.JAXBElement,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=java:array,weight=90000,public=false
+
+org.apache.tuscany.sca.databinding.json2x.jackson.InputStream2JSON;source=application/json#java.io.InputStream;target=JSON2x,weight=50,public=true
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/LICENSE b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/LICENSE
new file mode 100644
index 0000000000..75b52484ea
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/MANIFEST.MF b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..1a2611b7e0
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/MANIFEST.MF
@@ -0,0 +1,48 @@
+Manifest-Version: 1.0
+Export-Package: org.apache.tuscany.sca.databinding.json2x.axiom;uses:=
+ "org.apache.tuscany.sca.databinding,org.osoa.sca.annotations,org.apac
+ he.tuscany.sca.interfacedef.util,org.codehaus.jettison.mapped,org.apa
+ che.tuscany.sca.databinding.impl,org.codehaus.jettison.json,org.apach
+ e.tuscany.sca.interfacedef,javax.xml.namespace,org.apache.axiom.om,ja
+ vax.xml.stream,org.codehaus.jettison.badgerfish,org.apache.tuscany.sc
+ a.databinding.json2x";version="1.6",org.apache.tuscany.sca.databindin
+ g.json2x.jackson;uses:="org.apache.tuscany.sca.databinding,org.codeha
+ us.jackson.map,org.codehaus.jackson.map.type,org.codehaus.jackson.map
+ .introspect,org.codehaus.jackson,org.codehaus.jackson.xc,org.apache.t
+ uscany.sca.interfacedef,org.codehaus.jackson.type,org.apache.tuscany.
+ sca.databinding.json2x";version="1.6",org.apache.tuscany.sca.databind
+ ing.json2x;uses:="org.apache.tuscany.sca.databinding,org.apache.tusca
+ ny.sca.databinding.xml,org.jabsorb,org.apache.tuscany.sca.interfacede
+ f.util,org.apache.tuscany.sca.databinding.json2x.jackson,org.apache.t
+ uscany.sca.databinding.impl,org.codehaus.jettison.json,org.json,org.a
+ pache.tuscany.sca.interfacedef,javax.xml.namespace,org.codehaus.jetti
+ son.badgerfish,javax.xml.stream,org.jabsorb.serializer,org.codehaus.j
+ ackson";version="1.6"
+Tool: Bnd-0.0.255
+Bundle-Name: Apache Tuscany SCA Data Binding for JSON from 2.x codebas
+ e
+Created-By: 1.6.0_20 (Sun Microsystems Inc.)
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 1.6
+Bnd-LastModified: 1281020683718
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Data Binding for JSON from 2.x
+ codebase
+Import-Package: javax.xml.namespace,javax.xml.stream;version="1.0",org
+ .apache.axiom.om,org.apache.tuscany.sca.databinding;version="1.6",org
+ .apache.tuscany.sca.databinding.impl;version="1.6",org.apache.tuscany
+ .sca.databinding.json2x;version="1.6",org.apache.tuscany.sca.databind
+ ing.json2x.axiom;version="1.6",org.apache.tuscany.sca.databinding.jso
+ n2x.jackson;version="1.6",org.apache.tuscany.sca.databinding.xml;vers
+ ion="1.6",org.apache.tuscany.sca.interfacedef;version="1.6",org.apach
+ e.tuscany.sca.interfacedef.util;version="1.6",org.codehaus.jackson;ve
+ rsion="1.5",org.codehaus.jackson.map;version="1.5",org.codehaus.jacks
+ on.map.introspect;version="1.5",org.codehaus.jackson.map.type;version
+ ="1.5",org.codehaus.jackson.type;version="1.5",org.codehaus.jackson.x
+ c;version="1.5",org.codehaus.jettison.badgerfish,org.codehaus.jettiso
+ n.json,org.codehaus.jettison.mapped,org.jabsorb,org.jabsorb.serialize
+ r,org.json,org.osoa.sca.annotations;version="1.4"
+Bundle-SymbolicName: org.apache.tuscany.sca.databinding.json
+Bundle-DocURL: http://www.apache.org/
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/NOTICE b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/NOTICE
new file mode 100644
index 0000000000..f5cfc6695f
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/NOTICE
@@ -0,0 +1,6 @@
+Apache Tuscany SCA Data Binding for JSON from 2.x codebase
+Copyright (c) 2005 - 2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..d7549f0af3
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/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.json2x.JSONDataBinding;name=JSON2x
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..0eb24f31a3
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -0,0 +1,34 @@
+# 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 transformers
+org.apache.tuscany.sca.databinding.json2x.JSON2XMLStreamReader;source=JSON2x,target=javax.xml.stream.XMLStreamReader,weight=5000
+org.apache.tuscany.sca.databinding.json2x.XMLStreamReader2JSON;source=javax.xml.stream.XMLStreamReader,target=JSON2x,weight=5000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=java:complexType,target=JSON2x,weight=90000,public=true
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=java:simpleType,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.axiom.JSON2OMElement;source=JSON2x,target=org.apache.axiom.om.OMElement,weight=500
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=java:array,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=commonj.sdo.DataObject,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.Object2JSON;source=javax.xml.bind.JAXBElement,target=JSON2x,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=java:complexType,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=java:simpleType,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=commonj.sdo.DataObject,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=javax.xml.bind.JAXBElement,weight=90000,public=false
+org.apache.tuscany.sca.databinding.json2x.jackson.JSON2Object;source=JSON2x,target=java:array,weight=90000,public=false
+
+org.apache.tuscany.sca.databinding.json2x.jackson.InputStream2JSON;source=application/json#java.io.InputStream;target=JSON2x,weight=50,public=true
+
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.class
new file mode 100644
index 0000000000..0c89c76416
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2JavaBean.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2String.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2String.class
new file mode 100644
index 0000000000..d5378a37c9
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2String.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.class
new file mode 100644
index 0000000000..96abc990ef
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSON2XMLStreamReader.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.class
new file mode 100644
index 0000000000..8a78663336
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONDataBinding.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONHelper.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONHelper.class
new file mode 100644
index 0000000000..a575d62258
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JSONHelper.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.class
new file mode 100644
index 0000000000..0e36272097
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSON.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject$1.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject$1.class
new file mode 100644
index 0000000000..3847580c80
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject$1.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.class
new file mode 100644
index 0000000000..302ffdf3a3
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/JavaBean2JSONObject.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/String2JSON.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/String2JSON.class
new file mode 100644
index 0000000000..d13f550756
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/String2JSON.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.class
new file mode 100644
index 0000000000..7a9593b1a2
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/XMLStreamReader2JSON.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.class
new file mode 100644
index 0000000000..104e73f110
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.class
new file mode 100644
index 0000000000..428e2b5a72
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONBadgerfishDataSource.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.class
new file mode 100644
index 0000000000..e8b386ef91
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/axiom/JSONDataSource.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.class
new file mode 100644
index 0000000000..225d1accb5
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/InputStream2JSON.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.class
new file mode 100644
index 0000000000..2790d1b04d
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2Object.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.class
new file mode 100644
index 0000000000..2334d3bc96
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JSON2OutputStream.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.class
new file mode 100644
index 0000000000..c304b0a0dc
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/JacksonHelper.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.class
new file mode 100644
index 0000000000..fd6b71966b
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/classes/org/apache/tuscany/sca/databinding/json2x/jackson/Object2JSON.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JSONTransformerTestCase.xml b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JSONTransformerTestCase.xml
new file mode 100644
index 0000000000..762f039993
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JSONTransformerTestCase.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="0.187" errors="0" skipped="0" tests="4" name="org.apache.tuscany.sca.databinding.json.JSONTransformerTestCase">
+ <properties>
+ <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
+ <property name="sun.boot.library.path" value="D:\apps\sun_jdk6_20\jre\bin"/>
+ <property name="java.vm.version" value="16.3-b01"/>
+ <property name="java.vm.vendor" value="Sun Microsystems Inc."/>
+ <property name="java.vendor.url" value="http://java.sun.com/"/>
+ <property name="path.separator" value=";"/>
+ <property name="java.vm.name" value="Java HotSpot(TM) Client VM"/>
+ <property name="file.encoding.pkg" value="sun.io"/>
+ <property name="user.country" value="GB"/>
+ <property name="sun.java.launcher" value="SUN_STANDARD"/>
+ <property name="sun.os.patch.level" value="Service Pack 3"/>
+ <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
+ <property name="user.dir" value="D:\sca-java-1.x\modules\databinding-json-2-x"/>
+ <property name="java.runtime.version" value="1.6.0_20-b02"/>
+ <property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
+ <property name="basedir" value="D:\sca-java-1.x\modules\databinding-json-2-x"/>
+ <property name="java.endorsed.dirs" value="D:\apps\sun_jdk6_20\jre\lib\endorsed"/>
+ <property name="os.arch" value="x86"/>
+ <property name="java.io.tmpdir" value="C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\"/>
+ <property name="line.separator" value="
+"/>
+ <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
+ <property name="user.variant" value=""/>
+ <property name="os.name" value="Windows XP"/>
+ <property name="sun.jnu.encoding" value="Cp1252"/>
+ <property name="java.library.path" value="D:\apps\sun_jdk6_20\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\apps\sun_jdk6_20\bin;C:\Program Files\ThinkPad\Utilities;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IBM\Infoprint Select;C:\Notes;C:\Program Files\XLView;C:\lotus\compnent;C:\Utilities;C:\Program Files\Common Files\Lenovo;C:\program files\ibm\personal communications\;C:\Program Files\IBM\Trace Facility\;C:\Program Files\ThinkPad\ConnectUtilities;C:\simon\apps\TortoiseSVN\bin;D:\apps\apache-maven-2.2.1\bin;D:\apps\apache-ant-1.8.0\bin;C:\Program Files\QuickTime\QTSystem\"/>
+ <property name="java.specification.name" value="Java Platform API Specification"/>
+ <property name="java.class.version" value="50.0"/>
+ <property name="sun.management.compiler" value="HotSpot Client Compiler"/>
+ <property name="os.version" value="5.1"/>
+ <property name="user.home" value="C:\Documents and Settings\Administrator"/>
+ <property name="user.timezone" value="Europe/London"/>
+ <property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
+ <property name="file.encoding" value="Cp1252"/>
+ <property name="java.specification.version" value="1.6"/>
+ <property name="user.name" value="slaws"/>
+ <property name="java.class.path" value="C:\Documents and Settings\Administrator\.m2\repository\org\apache\maven\surefire\surefire-booter\2.3.1\surefire-booter-2.3.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\apache\maven\surefire\surefire-api\2.3.1\surefire-api-2.3.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-utils\1.1\plexus-utils-1.1.jar;C:\Documents and Settings\Administrator\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-archiver\1.0-alpha-7\plexus-archiver-1.0-alpha-7.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-8\plexus-container-default-1.0-alpha-8.jar;C:\Documents and Settings\Administrator\.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar;C:\Documents and Settings\Administrator\.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar"/>
+ <property name="java.vm.specification.version" value="1.0"/>
+ <property name="sun.arch.data.model" value="32"/>
+ <property name="java.home" value="D:\apps\sun_jdk6_20\jre"/>
+ <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
+ <property name="user.language" value="en"/>
+ <property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
+ <property name="java.vm.info" value="mixed mode"/>
+ <property name="java.version" value="1.6.0_20"/>
+ <property name="java.ext.dirs" value="D:\apps\sun_jdk6_20\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
+ <property name="sun.boot.class.path" value="D:\apps\sun_jdk6_20\jre\lib\resources.jar;D:\apps\sun_jdk6_20\jre\lib\rt.jar;D:\apps\sun_jdk6_20\jre\lib\sunrsasign.jar;D:\apps\sun_jdk6_20\jre\lib\jsse.jar;D:\apps\sun_jdk6_20\jre\lib\jce.jar;D:\apps\sun_jdk6_20\jre\lib\charsets.jar;D:\apps\sun_jdk6_20\jre\classes"/>
+ <property name="java.vendor" value="Sun Microsystems Inc."/>
+ <property name="localRepository" value="C:\Documents and Settings\Administrator\.m2\repository"/>
+ <property name="file.separator" value="\"/>
+ <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/>
+ <property name="sun.cpu.endian" value="little"/>
+ <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
+ <property name="sun.desktop" value="windows"/>
+ <property name="sun.cpu.isalist" value="pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86"/>
+ </properties>
+ <testcase time="0" name="testString2JSON"/>
+ <testcase time="0.094" name="testXML2JSON"/>
+ <testcase time="0.031" name="testJSON2XML"/>
+ <testcase time="0.062" name="testJSON2OMElement"/>
+</testsuite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JavaBean2JSONTestCase.xml b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JavaBean2JSONTestCase.xml
new file mode 100644
index 0000000000..f4efded28c
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.JavaBean2JSONTestCase.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="0.125" errors="0" skipped="0" tests="3" name="org.apache.tuscany.sca.databinding.json.JavaBean2JSONTestCase">
+ <properties>
+ <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
+ <property name="sun.boot.library.path" value="D:\apps\sun_jdk6_20\jre\bin"/>
+ <property name="java.vm.version" value="16.3-b01"/>
+ <property name="java.vm.vendor" value="Sun Microsystems Inc."/>
+ <property name="java.vendor.url" value="http://java.sun.com/"/>
+ <property name="path.separator" value=";"/>
+ <property name="java.vm.name" value="Java HotSpot(TM) Client VM"/>
+ <property name="file.encoding.pkg" value="sun.io"/>
+ <property name="user.country" value="GB"/>
+ <property name="sun.java.launcher" value="SUN_STANDARD"/>
+ <property name="sun.os.patch.level" value="Service Pack 3"/>
+ <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
+ <property name="user.dir" value="D:\sca-java-1.x\modules\databinding-json-2-x"/>
+ <property name="java.runtime.version" value="1.6.0_20-b02"/>
+ <property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
+ <property name="basedir" value="D:\sca-java-1.x\modules\databinding-json-2-x"/>
+ <property name="java.endorsed.dirs" value="D:\apps\sun_jdk6_20\jre\lib\endorsed"/>
+ <property name="os.arch" value="x86"/>
+ <property name="java.io.tmpdir" value="C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\"/>
+ <property name="line.separator" value="
+"/>
+ <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
+ <property name="user.variant" value=""/>
+ <property name="os.name" value="Windows XP"/>
+ <property name="sun.jnu.encoding" value="Cp1252"/>
+ <property name="java.library.path" value="D:\apps\sun_jdk6_20\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\apps\sun_jdk6_20\bin;C:\Program Files\ThinkPad\Utilities;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IBM\Infoprint Select;C:\Notes;C:\Program Files\XLView;C:\lotus\compnent;C:\Utilities;C:\Program Files\Common Files\Lenovo;C:\program files\ibm\personal communications\;C:\Program Files\IBM\Trace Facility\;C:\Program Files\ThinkPad\ConnectUtilities;C:\simon\apps\TortoiseSVN\bin;D:\apps\apache-maven-2.2.1\bin;D:\apps\apache-ant-1.8.0\bin;C:\Program Files\QuickTime\QTSystem\"/>
+ <property name="java.specification.name" value="Java Platform API Specification"/>
+ <property name="java.class.version" value="50.0"/>
+ <property name="sun.management.compiler" value="HotSpot Client Compiler"/>
+ <property name="os.version" value="5.1"/>
+ <property name="user.home" value="C:\Documents and Settings\Administrator"/>
+ <property name="user.timezone" value="Europe/London"/>
+ <property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
+ <property name="file.encoding" value="Cp1252"/>
+ <property name="java.specification.version" value="1.6"/>
+ <property name="user.name" value="slaws"/>
+ <property name="java.class.path" value="C:\Documents and Settings\Administrator\.m2\repository\org\apache\maven\surefire\surefire-booter\2.3.1\surefire-booter-2.3.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\apache\maven\surefire\surefire-api\2.3.1\surefire-api-2.3.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-utils\1.1\plexus-utils-1.1.jar;C:\Documents and Settings\Administrator\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-archiver\1.0-alpha-7\plexus-archiver-1.0-alpha-7.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-8\plexus-container-default-1.0-alpha-8.jar;C:\Documents and Settings\Administrator\.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar;C:\Documents and Settings\Administrator\.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar"/>
+ <property name="java.vm.specification.version" value="1.0"/>
+ <property name="sun.arch.data.model" value="32"/>
+ <property name="java.home" value="D:\apps\sun_jdk6_20\jre"/>
+ <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
+ <property name="user.language" value="en"/>
+ <property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
+ <property name="java.vm.info" value="mixed mode"/>
+ <property name="java.version" value="1.6.0_20"/>
+ <property name="java.ext.dirs" value="D:\apps\sun_jdk6_20\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
+ <property name="sun.boot.class.path" value="D:\apps\sun_jdk6_20\jre\lib\resources.jar;D:\apps\sun_jdk6_20\jre\lib\rt.jar;D:\apps\sun_jdk6_20\jre\lib\sunrsasign.jar;D:\apps\sun_jdk6_20\jre\lib\jsse.jar;D:\apps\sun_jdk6_20\jre\lib\jce.jar;D:\apps\sun_jdk6_20\jre\lib\charsets.jar;D:\apps\sun_jdk6_20\jre\classes"/>
+ <property name="java.vendor" value="Sun Microsystems Inc."/>
+ <property name="localRepository" value="C:\Documents and Settings\Administrator\.m2\repository"/>
+ <property name="file.separator" value="\"/>
+ <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/>
+ <property name="sun.cpu.endian" value="little"/>
+ <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
+ <property name="sun.desktop" value="windows"/>
+ <property name="sun.cpu.isalist" value="pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86"/>
+ </properties>
+ <testcase time="0.093" name="testBean2JSON"/>
+ <testcase time="0.016" name="testString2JSON"/>
+ <testcase time="0" name="testStringArray2JSON"/>
+</testsuite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.POJOTestCase.xml b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.POJOTestCase.xml
new file mode 100644
index 0000000000..f03665cf14
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/surefire-reports/TEST-org.apache.tuscany.sca.databinding.json.POJOTestCase.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="0.015" errors="0" skipped="0" tests="5" name="org.apache.tuscany.sca.databinding.json.POJOTestCase">
+ <properties>
+ <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
+ <property name="sun.boot.library.path" value="D:\apps\sun_jdk6_20\jre\bin"/>
+ <property name="java.vm.version" value="16.3-b01"/>
+ <property name="java.vm.vendor" value="Sun Microsystems Inc."/>
+ <property name="java.vendor.url" value="http://java.sun.com/"/>
+ <property name="path.separator" value=";"/>
+ <property name="java.vm.name" value="Java HotSpot(TM) Client VM"/>
+ <property name="file.encoding.pkg" value="sun.io"/>
+ <property name="user.country" value="GB"/>
+ <property name="sun.java.launcher" value="SUN_STANDARD"/>
+ <property name="sun.os.patch.level" value="Service Pack 3"/>
+ <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
+ <property name="user.dir" value="D:\sca-java-1.x\modules\databinding-json-2-x"/>
+ <property name="java.runtime.version" value="1.6.0_20-b02"/>
+ <property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
+ <property name="basedir" value="D:\sca-java-1.x\modules\databinding-json-2-x"/>
+ <property name="java.endorsed.dirs" value="D:\apps\sun_jdk6_20\jre\lib\endorsed"/>
+ <property name="os.arch" value="x86"/>
+ <property name="java.io.tmpdir" value="C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\"/>
+ <property name="line.separator" value="
+"/>
+ <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
+ <property name="user.variant" value=""/>
+ <property name="os.name" value="Windows XP"/>
+ <property name="sun.jnu.encoding" value="Cp1252"/>
+ <property name="java.library.path" value="D:\apps\sun_jdk6_20\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\apps\sun_jdk6_20\bin;C:\Program Files\ThinkPad\Utilities;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IBM\Infoprint Select;C:\Notes;C:\Program Files\XLView;C:\lotus\compnent;C:\Utilities;C:\Program Files\Common Files\Lenovo;C:\program files\ibm\personal communications\;C:\Program Files\IBM\Trace Facility\;C:\Program Files\ThinkPad\ConnectUtilities;C:\simon\apps\TortoiseSVN\bin;D:\apps\apache-maven-2.2.1\bin;D:\apps\apache-ant-1.8.0\bin;C:\Program Files\QuickTime\QTSystem\"/>
+ <property name="java.specification.name" value="Java Platform API Specification"/>
+ <property name="java.class.version" value="50.0"/>
+ <property name="sun.management.compiler" value="HotSpot Client Compiler"/>
+ <property name="os.version" value="5.1"/>
+ <property name="user.home" value="C:\Documents and Settings\Administrator"/>
+ <property name="user.timezone" value="Europe/London"/>
+ <property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
+ <property name="file.encoding" value="Cp1252"/>
+ <property name="java.specification.version" value="1.6"/>
+ <property name="user.name" value="slaws"/>
+ <property name="java.class.path" value="C:\Documents and Settings\Administrator\.m2\repository\org\apache\maven\surefire\surefire-booter\2.3.1\surefire-booter-2.3.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\apache\maven\surefire\surefire-api\2.3.1\surefire-api-2.3.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-utils\1.1\plexus-utils-1.1.jar;C:\Documents and Settings\Administrator\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-archiver\1.0-alpha-7\plexus-archiver-1.0-alpha-7.jar;C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-8\plexus-container-default-1.0-alpha-8.jar;C:\Documents and Settings\Administrator\.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar;C:\Documents and Settings\Administrator\.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar"/>
+ <property name="java.vm.specification.version" value="1.0"/>
+ <property name="sun.arch.data.model" value="32"/>
+ <property name="java.home" value="D:\apps\sun_jdk6_20\jre"/>
+ <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
+ <property name="user.language" value="en"/>
+ <property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
+ <property name="java.vm.info" value="mixed mode"/>
+ <property name="java.version" value="1.6.0_20"/>
+ <property name="java.ext.dirs" value="D:\apps\sun_jdk6_20\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
+ <property name="sun.boot.class.path" value="D:\apps\sun_jdk6_20\jre\lib\resources.jar;D:\apps\sun_jdk6_20\jre\lib\rt.jar;D:\apps\sun_jdk6_20\jre\lib\sunrsasign.jar;D:\apps\sun_jdk6_20\jre\lib\jsse.jar;D:\apps\sun_jdk6_20\jre\lib\jce.jar;D:\apps\sun_jdk6_20\jre\lib\charsets.jar;D:\apps\sun_jdk6_20\jre\classes"/>
+ <property name="java.vendor" value="Sun Microsystems Inc."/>
+ <property name="localRepository" value="C:\Documents and Settings\Administrator\.m2\repository"/>
+ <property name="file.separator" value="\"/>
+ <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/>
+ <property name="sun.cpu.endian" value="little"/>
+ <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
+ <property name="sun.desktop" value="windows"/>
+ <property name="sun.cpu.isalist" value="pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86"/>
+ </properties>
+ <testcase time="0" name="testString"/>
+ <testcase time="0.015" name="testNull"/>
+ <testcase time="0" name="testArray"/>
+ <testcase time="0" name="testByteArray"/>
+ <testcase time="0" name="testPrimitive"/>
+</testsuite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/ipo.xsd b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/ipo.xsd
new file mode 100644
index 0000000000..3dc2647fea
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/ipo.xsd
@@ -0,0 +1,136 @@
+<!--
+ * 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/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.class
new file mode 100644
index 0000000000..c283f6f5dd
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$MyBean.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$MyBean.class
new file mode 100644
index 0000000000..c13cd65575
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$MyBean.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$YourBean.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$YourBean.class
new file mode 100644
index 0000000000..9015b7d27f
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase$YourBean.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.class
new file mode 100644
index 0000000000..f7de06bc02
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyBean.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyBean.class
new file mode 100644
index 0000000000..e40a669211
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyBean.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterface.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterface.class
new file mode 100644
index 0000000000..dec9f57265
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterface.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.class
new file mode 100644
index 0000000000..b77cd66967
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/POJOTestCase.class b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/POJOTestCase.class
new file mode 100644
index 0000000000..7598314101
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/test-classes/org/apache/tuscany/sca/databinding/json/POJOTestCase.class
Binary files differ
diff --git a/sca-java-1.x/trunk/modules/databinding-json-2-x/target/tuscany-databinding-json-2-x-1.7-SNAPSHOT.jar b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/tuscany-databinding-json-2-x-1.7-SNAPSHOT.jar
new file mode 100644
index 0000000000..b8d057d413
--- /dev/null
+++ b/sca-java-1.x/trunk/modules/databinding-json-2-x/target/tuscany-databinding-json-2-x-1.7-SNAPSHOT.jar
Binary files differ