diff options
Diffstat (limited to 'branches/pre-spec-changes/services/databinding/databinding-sdo')
32 files changed, 0 insertions, 2573 deletions
diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/.ruleset b/branches/pre-spec-changes/services/databinding/databinding-sdo/.ruleset deleted file mode 100644 index e615e93a4b..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/.ruleset +++ /dev/null @@ -1,172 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ruleset name="pmd-eclipse"> - <description>PMD Plugin preferences rule set</description> - - - <rule ref="rulesets/basic.xml/BooleanInstantiation"/> - <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/> - <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/> -<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>--> - <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/> -<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>--> -<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>--> -<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>--> - <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/> - <rule ref="rulesets/basic.xml/JumbledIncrementer"/> -<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>--> - <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/> - <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/> - <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/> - <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/> - <rule ref="rulesets/basic.xml/UnnecessaryReturn"/> -<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>--> - -<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>--> -<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>--> -<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>--> -<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>--> - -<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>--> -<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>--> -<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>--> - -<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>--> -<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>--> - -<rule ref="rulesets/controversial.xml/AssignmentInOperand"/> -<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>--> -<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>--> -<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>--> -<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>--> -<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>--> -<!--<rule ref="rulesets/controversial.xml/SingularField"/>--> -<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>--> -<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>--> -<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/> -<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>--> - -<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>--> -<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>--> -<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>--> - -<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>--> -<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>--> -<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>--> -<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>--> -<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>--> -<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/> -<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>--> -<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>--> -<!--<rule ref="rulesets/design.xml/BadComparison"/>--> -<!--<rule ref="rulesets/design.xml/CloseConnection"/>--> -<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>--> -<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>--> -<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/> -<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>--> -<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>--> -<rule ref="rulesets/design.xml/IdempotentOperations"/> -<!--<rule ref="rulesets/design.xml/ImmutableField"/>--> -<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>--> -<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>--> -<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>--> -<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>--> -<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>--> -<rule ref="rulesets/design.xml/OptimizableToArrayCall"/> -<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/> -<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/> -<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/> -<rule ref="rulesets/design.xml/SimplifyConditional"/> -<!--<rule ref="rulesets/design.xml/SwitchDensity"/>--> -<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>--> -<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/> -<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>--> -<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>--> -<!--<rule ref="rulesets/design.xml/UseSingleton"/>--> - -<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>--> -<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>--> - -<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>--> -<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>--> -<!--<rule ref="rulesets/imports.xml/UnusedImports"/>--> -<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>--> - -<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>--> -<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>--> - -<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>--> -<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>--> -<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>--> -<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>--> -<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>--> -<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>--> -<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>--> -<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>--> - - <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>--> - <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>--> - <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>--> - <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>--> - <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>--> - <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>--> - <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>--> - <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>--> - - <!--<rule ref="rulesets/naming.xml/ShortVariable"/>--> - <!--<rule ref="rulesets/naming.xml/LongVariable"/>--> - <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>--> - <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>--> - <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>--> - <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>--> - <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>--> - <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>--> - <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>--> - <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>--> - <!--<rule ref="rulesets/naming.xml/NoPackage"/>--> - <!--<rule ref="rulesets/naming.xml/PackageCase"/>--> - - <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>--> - <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>--> - <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>--> - <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>--> - <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>--> - <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>--> - - <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>--> - <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>--> - <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>--> - <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>--> - <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>--> - <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>--> - - <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>--> - <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>--> - <!--<rule ref="rulesets/strings.xml/StringToString"/>--> - <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>--> - <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>--> - - <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>--> - <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>--> - - <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/> - <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/> - <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/> - <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>--> - -</ruleset> diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/LICENSE.txt b/branches/pre-spec-changes/services/databinding/databinding-sdo/LICENSE.txt deleted file mode 100755 index d645695673..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - 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/branches/pre-spec-changes/services/databinding/databinding-sdo/NOTICE.txt b/branches/pre-spec-changes/services/databinding/databinding-sdo/NOTICE.txt deleted file mode 100644 index d83ebbe236..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/NOTICE.txt +++ /dev/null @@ -1,14 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2006 The Apache Software Foundation - -Apache Tuscany is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/pom.xml b/branches/pre-spec-changes/services/databinding/databinding-sdo/pom.xml deleted file mode 100755 index 84e8b084ea..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ -<?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> - <parent> - <groupId>org.apache.tuscany.sca.services.databinding</groupId> - <artifactId>parent</artifactId> - <version>0.1-pre-spec-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>databinding-sdo</artifactId> - <name>Apache Tuscany Data Binding for SDO</name> - <description>Data Binding based on SDO.</description> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca.kernel</groupId> - <artifactId>tuscany-spi</artifactId> - <version>0.1-pre-spec-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sdo</groupId> - <artifactId>tuscany-sdo-impl</artifactId> - <version>1.0-incubator-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca.kernel</groupId> - <artifactId>core</artifactId> - <version>0.1-pre-spec-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <id>add-test-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>target/sdo-source</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.tuscany.sdo</groupId> - <artifactId>tuscany-sdo-plugin</artifactId> - <version>1.0-incubator-SNAPSHOT</version> - <executions> - <execution> - <id>generate-sdo</id> - <phase>generate-test-sources</phase> - <configuration> - <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile> - <javaPackage>com.example.ipo.sdo</javaPackage> - <noNotification>true</noNotification> - <noContainer>true</noContainer> - <noUnsettable>true</noUnsettable> - </configuration> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java deleted file mode 100755 index 9125980eed..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLHelper; - -@Service(Transformer.class) -public class DataObject2String extends TransformerExtension<DataObject, String> implements - PullTransformer<DataObject, String> { - - private static final String TUSCANY_SDO = "http://tuscany.apache.org/xmlns/sdo/1.0-SNAPSHOT"; - - public String transform(DataObject source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLHelper xmlHelper = helperContext.getXMLHelper(); - Object logicalType = context.getSourceDataType().getLogical(); - if (logicalType instanceof QName) { - QName elementName = (QName) logicalType; - return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart()); - } else { - return xmlHelper.save(source, TUSCANY_SDO, "dataObject"); - } - } catch (Exception e) { - throw new TransformationException(e); - } - } - - public Class getSourceType() { - return DataObject.class; - } - - public Class getTargetType() { - return String.class; - } - - public int getWeight() { - return 40; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java deleted file mode 100755 index 2892b1bc4d..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sdo.helper.XMLStreamHelper; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; - -@Service(Transformer.class) -public class DataObject2XMLStreamReader extends TransformerExtension<DataObject, XMLStreamReader> implements - PullTransformer<DataObject, XMLStreamReader> { - - public XMLStreamReader transform(DataObject source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper()); - Object logicalType = context.getSourceDataType().getLogical(); - QName elementName = - (logicalType instanceof QName) ? (QName) logicalType : new QName("commonj.sdo", "dataObject"); - XMLHelper xmlHelper = helperContext.getXMLHelper(); - XMLDocument document = - xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart()); - return streamHelper.createXMLStreamReader(document); - } catch (XMLStreamException e) { - // TODO: Add context to the exception - throw new TransformationException(e); - } - } - - public Class getSourceType() { - return DataObject.class; - } - - public Class getTargetType() { - return XMLStreamReader.class; - } - - public int getWeight() { - return 10; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java deleted file mode 100755 index 5706005252..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sdo.helper.XMLStreamHelper; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.component.CompositeComponent; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.StAXElementLoader; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.annotation.Autowire; -import org.osoa.sca.annotations.EagerInit; - -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XSDHelper; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Destroy; - -/** - * A SDO model-based Loader to load DataObject from the XML stream - * - */ -@EagerInit -public class DataObjectLoader implements StAXElementLoader<ModelObject> { - protected LoaderRegistry registry; - private QName propertyQName; - - public DataObjectLoader(Property property) { - super(); - this.propertyQName = new QName(XSDHelper.INSTANCE.getNamespaceURI(property), - XSDHelper.INSTANCE.getLocalName(property)); - } - - public DataObjectLoader(QName propertyQName) { - super(); - this.propertyQName = propertyQName; - } - - public ModelObject load(CompositeComponent parent, ModelObject object, XMLStreamReader reader, DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { - assert propertyQName.equals(reader.getName()); - // TODO: We need a way to get TypeHelper from deploymentContext - TypeHelper typeHelper = TypeHelper.INSTANCE; - XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper); - DataObject dataObject = streamHelper.loadObject(reader); - // TODO: Is it required that the object always extends from ModelObject? - return new ModelDataObject(dataObject); - } - - @Autowire - public void setRegistry(LoaderRegistry registry) { - this.registry = registry; - } - - @Init - public void start() { - registry.registerLoader(propertyQName, this); - } - - @Destroy - public void stop() { - registry.unregisterLoader(propertyQName, this); - } - - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java deleted file mode 100755 index 92b1036bc0..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.annotation.Autowire; -import org.apache.tuscany.spi.component.CompositeComponent; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.loader.LoaderUtil; -import org.apache.tuscany.spi.model.ModelObject; -import org.osoa.sca.annotations.Constructor; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XSDHelper; - -/** - * Loader that handles <import.sdo> elements. - * - * @version $Rev$ $Date$ - */ -public class ImportSDOLoader extends LoaderExtension { - public static final QName IMPORT_SDO = - new QName("http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0", "import.sdo"); - - @Constructor( {"registry"}) - public ImportSDOLoader(@Autowire - LoaderRegistry registry) { - super(registry); - } - - public QName getXMLType() { - return IMPORT_SDO; - } - - public ModelObject load(CompositeComponent parent, - ModelObject object, - XMLStreamReader reader, - DeploymentContext deploymentContext) throws XMLStreamException, LoaderException { - assert IMPORT_SDO.equals(reader.getName()); - - // FIXME: [rfeng] How to associate the TypeHelper with deployment - // context? - HelperContext helperContext = null; - if (deploymentContext != null && deploymentContext.getParent() != null) { - helperContext = (HelperContext)deploymentContext.getParent().getExtension(HelperContext.class.getName()); - if (helperContext == null) { - helperContext = SDOUtil.createHelperContext(); - deploymentContext.getParent().putExtension(HelperContext.class.getName(), helperContext); - } - } - - if (helperContext == null) { - helperContext = SDOUtil.createHelperContext(); - } - - importFactory(reader, deploymentContext); - importWSDL(reader, deploymentContext, helperContext); - LoaderUtil.skipToEndElement(reader); - return new SDOType(helperContext); - } - - private void importFactory(XMLStreamReader reader, DeploymentContext deploymentContext) throws LoaderException { - String factoryName = reader.getAttributeValue(null, "factory"); - if (factoryName != null) { - ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); - try { - // set TCCL as SDO needs it - ClassLoader cl = deploymentContext.getClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - Class<?> factoryClass = cl.loadClass(factoryName); - // FIXME: We require the SDO to provide an API to register - // static types in a given TypeHelper - SDOUtil.registerStaticTypes(factoryClass); - } catch (ClassNotFoundException e) { - throw new LoaderException(e.getMessage(), e); - } finally { - Thread.currentThread().setContextClassLoader(oldCL); - } - } - } - - private void importWSDL(XMLStreamReader reader, DeploymentContext deploymentContext, HelperContext helperContext) - throws LoaderException { - String location = reader.getAttributeValue(null, "location"); - if (location == null) - location = reader.getAttributeValue(null, "wsdlLocation"); - if (location != null) { - try { - URL wsdlURL = null; - URI uri = URI.create(location); - if (uri.isAbsolute()) { - wsdlURL = uri.toURL(); - } - wsdlURL = deploymentContext.getClassLoader().getResource(location); - if (null == wsdlURL) { - LoaderException loaderException = new LoaderException("WSDL location error"); - loaderException.setResourceURI(location); - throw loaderException; - } - InputStream xsdInputStream = wsdlURL.openStream(); - try { - XSDHelper xsdHelper = helperContext.getXSDHelper(); - xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm()); - } finally { - xsdInputStream.close(); - } - } catch (IOException e) { - LoaderException sfe = new LoaderException(e.getMessage()); - sfe.setResourceURI(location); - throw sfe; - } - } - } - - public static class SDOType extends ModelObject { - private HelperContext helperContext; - - public SDOType(HelperContext typeHelper) { - super(); - this.helperContext = typeHelper; - } - - public HelperContext getHelperContext() { - return helperContext; - } - } -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java deleted file mode 100755 index a3870b5e9a..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import org.apache.tuscany.spi.model.ModelObject; - -import commonj.sdo.DataObject; - -public class ModelDataObject extends ModelObject { - private DataObject dataObject; - - public ModelDataObject(DataObject dataObject) { - super(); - this.dataObject = dataObject; - } - - public DataObject getDataObject() { - return dataObject; - } - - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java deleted file mode 100644 index 213dfd9280..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.databinding.WrapperHandler; -import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; -import org.apache.tuscany.spi.model.DataType; - -import commonj.sdo.DataObject; -import commonj.sdo.Type; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XSDHelper; - -/** - * - */ -public class SDODataBinding extends DataBindingExtension { - private WrapperHandler<Object> wrapperHandler; - - @Override - public DataType introspect(Class<?> javaType) { - if (javaType == DataObject.class) { - return new DataType<QName>(getName(), javaType, null); - } - Type type = TypeHelper.INSTANCE.getType(javaType); - if (type == null || type.isDataType()) { - return null; - } - String namespace = type.getURI(); - String name = XSDHelper.INSTANCE.getLocalName(type); - QName xmlType = new QName(namespace, name); - DataType<QName> dataType = new DataType<QName>(getName(), javaType, xmlType); - return dataType; - } - - public SDODataBinding() { - super(DataObject.class); - wrapperHandler = new SDOWrapperHandler(); - } - - @Override - public WrapperHandler getWrapperHandler() { - return wrapperHandler; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataTypeHelper.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataTypeHelper.java deleted file mode 100644 index 7cb52e366e..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataTypeHelper.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import org.apache.tuscany.databinding.sdo.ImportSDOLoader.SDOType; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.component.CompositeComponent; -import org.apache.tuscany.spi.databinding.TransformationContext; - -import commonj.sdo.helper.HelperContext; - -/** - * Helper class to get TypeHelper from the transformation context - */ -public class SDODataTypeHelper { - private SDODataTypeHelper() { - } - - public static HelperContext getHelperContext(TransformationContext context) { - if (context == null || context.getMetadata() == null) { - return SDOUtil.createHelperContext(); - } - HelperContext helperContext = null; - CompositeComponent composite = (CompositeComponent)context.getMetadata().get(CompositeComponent.class); - if (composite != null) { - SDOType sdoType = (SDOType)composite.getExtensions().get(SDOType.class); - if (sdoType != null) { - helperContext = sdoType.getHelperContext(); - } - } - if (helperContext == null) { - return SDOUtil.createHelperContext(); - } else { - return helperContext; - } - } -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java deleted file mode 100755 index 0c3e74cdc7..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.CopyHelper; -import org.apache.tuscany.spi.ObjectFactory; -import org.apache.tuscany.spi.ObjectCreationException; - -/** - * Creates new instances of an SDO - * - * @version $Rev$ $Date$ - */ -public class SDOObjectFactory implements ObjectFactory<DataObject> { - - private DataObject dataObject; - - public SDOObjectFactory(DataObject dataObject) { - this.dataObject = dataObject; - } - - public DataObject getInstance() throws ObjectCreationException { - return CopyHelper.INSTANCE.copy(dataObject); - } - - public void releaseInstance(DataObject instance) { - } - -} - diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java deleted file mode 100644 index a363a8a3ec..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.databinding.SimpleTypeMapper; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.idl.TypeInfo; - -import commonj.sdo.Type; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.TypeHelper; - -/** - * SDO Java/XML mapping for simple XSD types - */ -public class SDOSimpleTypeMapper implements SimpleTypeMapper { - public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; - - public SDOSimpleTypeMapper() { - super(); - } - - public Object toJavaObject(TypeInfo simpleType, String value, TransformationContext context) { - QName typeName = simpleType.getQName(); - Type type = null; - if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) { - type = SDOUtil.getXSDSDOType(typeName.getLocalPart()); - } else { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - TypeHelper typeHelper = helperContext.getTypeHelper(); - type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart()); - } - return SDOUtil.createFromString(type, value); - } - - public String toXMLLiteral(TypeInfo simpleType, Object obj, TransformationContext context) { - QName typeName = simpleType.getQName(); - Type type = null; - if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) { - type = SDOUtil.getXSDSDOType(typeName.getLocalPart()); - } else { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - TypeHelper typeHelper = helperContext.getTypeHelper(); - type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart()); - } - return SDOUtil.convertToString(type, obj); - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java deleted file mode 100644 index 7074687722..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.WrapperHandler; -import org.apache.tuscany.spi.idl.ElementInfo; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; - -/** - * SDO Wrapper Handler - */ -public class SDOWrapperHandler implements WrapperHandler<Object> { - - /** - * @see org.apache.tuscany.spi.databinding.WrapperHandler#create(ElementInfo, - * TransformationContext) - */ - public Object create(ElementInfo element, TransformationContext context) { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - QName typeName = element.getType().getQName(); - DataFactory dataFactory = helperContext.getDataFactory(); - DataObject root = dataFactory.create(typeName.getNamespaceURI(), typeName.getLocalPart()); - XMLHelper xmlHelper = helperContext.getXMLHelper(); - return xmlHelper.createDocument(root, element.getQName().getNamespaceURI(), element.getQName().getLocalPart()); - } - - /** - * @see org.apache.tuscany.spi.databinding.WrapperHandler#getChild(java.lang.Object, - * int, ElementInfo) - */ - public Object getChild(Object wrapper, int i, ElementInfo element) { - DataObject wrapperDO = - (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper; - return wrapperDO.get(element.getQName().getLocalPart()); - } - - /** - * @see org.apache.tuscany.spi.databinding.WrapperHandler#setChild(java.lang.Object, - * int, ElementInfo, java.lang.Object) - */ - public void setChild(Object wrapper, int i, ElementInfo childElement, Object value) { - DataObject wrapperDO = - (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper; - wrapperDO.set(childElement.getQName().getLocalPart(), value); - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java deleted file mode 100755 index 64c79a3bd0..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLHelper; - -@Service(Transformer.class) -public class String2DataObject extends TransformerExtension<String, DataObject> implements - PullTransformer<String, DataObject> { - - public DataObject transform(String source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLHelper xmlHelper = helperContext.getXMLHelper(); - return xmlHelper.load(source).getRootObject(); - } catch (Exception e) { - throw new TransformationException(e); - } - } - - public Class getSourceType() { - return String.class; - } - - public Class getTargetType() { - return DataObject.class; - } - - public int getWeight() { - return 50; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java deleted file mode 100644 index 16e2714a89..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import java.io.StringWriter; - -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; - -@Service(Transformer.class) -public class XMLDocument2String extends TransformerExtension<XMLDocument, String> implements - PullTransformer<XMLDocument, String> { - - public String transform(XMLDocument source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLHelper xmlHelper = helperContext.getXMLHelper(); - StringWriter writer = new StringWriter(); - xmlHelper.save(source, writer, null); - return writer.toString(); - } catch (Exception e) { - throw new TransformationException(e); - } - } - - public Class getSourceType() { - return XMLDocument.class; - } - - public Class getTargetType() { - return String.class; - } - - public int getWeight() { - return 40; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java deleted file mode 100755 index 53343aba6b..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sdo.helper.XMLStreamHelper; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLDocument; - -@Service(Transformer.class) -public class XMLDocument2XMLStreamReader extends TransformerExtension<XMLDocument, XMLStreamReader> implements - PullTransformer<XMLDocument, XMLStreamReader> { - /** - * @param source - * @param context - * @return - */ - public XMLStreamReader transform(XMLDocument source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper()); - return streamHelper.createXMLStreamReader(source); - } catch (XMLStreamException e) { - throw new TransformationException(e); - } - } - - public Class getSourceType() { - return XMLDocument.class; - } - - public Class getTargetType() { - return XMLStreamReader.class; - } - - public int getWeight() { - return 10; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java deleted file mode 100755 index 2a4ce83eb6..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sdo.helper.XMLStreamHelper; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.HelperContext; - -@Service(Transformer.class) -public class XMLStreamReader2DataObject extends TransformerExtension<XMLStreamReader, DataObject> implements - PullTransformer<XMLStreamReader, DataObject> { - - public DataObject transform(XMLStreamReader source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper()); - // The XMLStreamHelper requires that the reader is posistioned at - // START_ELEMENT - while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext()) { - source.next(); - } - return streamHelper.loadObject(source); - } catch (Exception e) { - throw new TransformationException(e); - } - } - - public Class getTargetType() { - return DataObject.class; - } - - public Class getSourceType() { - return XMLStreamReader.class; - } - - public int getWeight() { - return 15; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java deleted file mode 100755 index 616d2139d4..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sdo.helper.XMLStreamHelper; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.databinding.PullTransformer; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.databinding.TransformationException; -import org.apache.tuscany.spi.databinding.Transformer; -import org.apache.tuscany.spi.databinding.extension.TransformerExtension; -import org.osoa.sca.annotations.Service; - -import commonj.sdo.helper.HelperContext; -import commonj.sdo.helper.XMLDocument; - -@Service(Transformer.class) -public class XMLStreamReader2XMLDocument extends TransformerExtension<XMLStreamReader, XMLDocument> implements - PullTransformer<XMLStreamReader, XMLDocument> { - - public XMLDocument transform(XMLStreamReader source, TransformationContext context) { - try { - HelperContext helperContext = SDODataTypeHelper.getHelperContext(context); - XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper()); - return streamHelper.load(source); - } catch (Exception e) { - throw new TransformationException(e); - } - } - - public Class getTargetType() { - return XMLDocument.class; - } - - public Class getSourceType() { - return XMLStreamReader.class; - } - - public int getWeight() { - return 15; - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl deleted file mode 100644 index 84ac5cc58a..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl +++ /dev/null @@ -1,68 +0,0 @@ -<?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.
--->
-<!--
- SDO databinding extension
-
- This is the copy to be included by other extensions
-
- $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
- name="org.apache.tuscany.databinding.sdo.include">
-
- <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
- <group>org.apache.tuscany.sca.services.databinding</group>
- <name>databinding-sdo</name>
- <version>1.0-incubator-SNAPSHOT</version>
- </dependency>
-
- <!-- import.sdo element loader implementations -->
- <component name="elementLoader.import.sdo">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
- </component>
-
- <component name="databinding.sdo">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
- </component>
-
- <component name="transformer.DataObject2String">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
- </component>
- <component name="transformer.DataObject2XMLStreamReader">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
- </component>
- <component name="transformer.XMLDocument2String">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
- </component>
- <component name="transformer.String2DataObject">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
- </component>
- <component name="transformer.XMLDocument2XMLStreamReader">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
- </component>
- <component name="transformer.XMLStreamReader2DataObject">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
- </component>
- <component name="transformer.XMLStreamReader2XMLDocument">
- <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
- </component>
-
-</composite>
diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl deleted file mode 100644 index 19a00aa147..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl +++ /dev/null @@ -1,66 +0,0 @@ -<?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. ---> -<!-- - SDO databinding extension - - $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $ ---> -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" - name="org.apache.tuscany.databinding.sdo"> - - <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"> - <group>org.apache.tuscany.sca.services.databinding</group> - <name>databinding-sdo</name> - <version>1.0-incubator-SNAPSHOT</version> - </dependency> - - <!-- import.sdo element loader implementations --> - <component name="elementLoader.import.sdo"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/> - </component> - - <component name="databinding.sdo"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" /> - </component> - - <component name="transformer.DataObject2String"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/> - </component> - <component name="transformer.DataObject2XMLStreamReader"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/> - </component> - <component name="transformer.XMLDocument2String"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/> - </component> - <component name="transformer.String2DataObject"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/> - </component> - <component name="transformer.XMLDocument2XMLStreamReader"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/> - </component> - <component name="transformer.XMLStreamReader2DataObject"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/> - </component> - <component name="transformer.XMLStreamReader2XMLDocument"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/> - </component> - -</composite> diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java deleted file mode 100644 index 28a885cd16..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import junit.framework.Assert; - -import org.apache.tuscany.spi.model.DataType; - -import com.example.ipo.sdo.PurchaseOrderType; -import commonj.sdo.DataObject; - -/** - * - */ -public class DataObject2StringTestCase extends SDOTransformerTestCaseBase { - @Override - protected DataType<?> getSourceDataType() { - return new DataType<QName>(binding, PurchaseOrderType.class, orderQName); - } - - @Override - protected DataType<?> getTargetDataType() { - return new DataType<Class<String>>(String.class, String.class); - } - - public final void testTransform() { - String xml = new DataObject2String().transform(dataObject, context); - Assert.assertTrue(xml.indexOf("<city>San Jose</city>") != -1); - DataObject po = new String2DataObject().transform(xml, reversedContext); - Assert.assertTrue(po instanceof PurchaseOrderType); - PurchaseOrderType orderType = (PurchaseOrderType) po; - Assert.assertEquals("San Jose", orderType.getBillTo().getCity()); - } - - public final void testXML() { - String xml = - "<foo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ipo=\"http://www.example.com/IPO\" xsi:type=\"ipo:USAddress\"/>"; - DataObject dataObject = new String2DataObject().transform(xml, reversedContext); - context.setSourceDataType(new DataType<QName>(DataObject.class.getName(), DataObject.class, null)); - xml = new DataObject2String().transform(dataObject, context); - Assert.assertTrue(xml.contains("xsi:type=\"ipo:USAddress\"")); - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java deleted file mode 100644 index 5ab23c6df1..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.spi.model.DataType; - -import com.example.ipo.sdo.PurchaseOrderType; - -/** - * - */ -public class DataObject2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase { - - @Override - protected DataType<?> getSourceDataType() { - return new DataType<QName>(binding, PurchaseOrderType.class, orderQName); - } - - @Override - protected DataType<?> getTargetDataType() { - return new DataType<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class); - } - - public final void testTransform() throws XMLStreamException { - XMLStreamReader reader = new DataObject2XMLStreamReader().transform(dataObject, context); - while (reader.hasNext()) { - int event = reader.next(); - if (event == XMLStreamConstants.START_ELEMENT) - break; - } - new XMLStreamReader2DataObject().transform(reader, reversedContext); - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java deleted file mode 100755 index 33ae6bbe97..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import java.io.StringReader; -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.core.component.scope.CompositeScopeContainer; -import org.apache.tuscany.core.deployer.RootDeploymentContext; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -import commonj.sdo.helper.XSDHelper; - -public class DataObjectLoaderTestCase extends TestCase { - - private XSDHelper xsdHelper = XSDHelper.INSTANCE; - - private QName name = new QName("http://www.osoa.org/xmlns/mock/0.9", "implementation.mock"); - - private String xml = "<module name=\"m\" xmlns=\"http://www.osoa.org/xmlns/sca/0.9\" xmlns:mock=\"http://www.osoa.org/xmlns/mock/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.osoa.org/xmlns/mock/0.9 sca-implementation-mock.xsd http://www.osoa.org/xmlns/sca/0.9 sca-core.xsd \"><component name=\"c\"><mock:implementation.mock myAttr=\"helloworld.HelloWorldImpl\" /></component></module>"; - - @Override - protected void setUp() throws Exception { - super.setUp(); - URL url = getClass().getClassLoader().getResource("model/sca-implementation-mock.xsd"); - // URL url = getClass().getClassLoader().getResource("model/sca-core.xsd"); - xsdHelper.define(url.openStream(), url.toExternalForm()); - } - - public void testLoader() throws Exception { - XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml)); - int event = reader.getEventType(); - while (!(event == XMLStreamConstants.START_ELEMENT && reader.getName().equals(name)) && reader.hasNext()) { - event = reader.nextTag(); - } - DataObjectLoader loader = new DataObjectLoader(name); - DeploymentContext context = new RootDeploymentContext(getClass().getClassLoader(), inputFactory, new CompositeScopeContainer(null), null); - ModelDataObject modelObject = (ModelDataObject) loader.load(null, null, reader, context); - Assert.assertNotNull(modelObject.getDataObject()); - Assert.assertTrue(modelObject.getDataObject().getString("myAttr").equals("helloworld.HelloWorldImpl")); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java deleted file mode 100755 index ff6f07427c..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import java.io.StringReader; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.deployer.RootDeploymentContext; -import org.apache.tuscany.databinding.sdo.ImportSDOLoader.SDOType; -import org.apache.tuscany.sdo.model.ModelFactory; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.loader.LoaderException; - -/** - * @version $Rev$ $Date$ - */ -public class ImportSDOLoaderTestCase extends TestCase { - private static boolean inited; - - private ImportSDOLoader loader; - private XMLInputFactory xmlFactory; - private DeploymentContext deploymentContext; - - public void testMinimal() throws XMLStreamException, LoaderException { - String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0'/>"; - XMLStreamReader reader = getReader(xml); - assertTrue(loader.load(null, null, reader, deploymentContext) instanceof SDOType); - } - - public void testLocation() throws XMLStreamException, LoaderException { - String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' location='ipo.xsd'/>"; - XMLStreamReader reader = getReader(xml); - assertTrue(loader.load(null, null, reader, deploymentContext) instanceof SDOType); - } - - public void testFactory() throws XMLStreamException, LoaderException { - String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' " - + "factory='org.apache.tuscany.databinding.sdo.ImportSDOLoaderTestCase$MockFactory'/>"; - XMLStreamReader reader = getReader(xml); - assertFalse(inited); - assertTrue(loader.load(null, null, reader, deploymentContext) instanceof SDOType); - assertTrue(inited); - } - - protected void setUp() throws Exception { - super.setUp(); - loader = new ImportSDOLoader(null); - xmlFactory = XMLInputFactory.newInstance(); - deploymentContext = new RootDeploymentContext(getClass().getClassLoader(), xmlFactory, null, null); - } - - protected XMLStreamReader getReader(String xml) throws XMLStreamException { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); - reader.next(); - return reader; - } - - public static class MockFactory { - public static final Object INSTANCE = ModelFactory.INSTANCE; - - static { - ImportSDOLoaderTestCase.inited = true; - } - } -} - diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java deleted file mode 100644 index 438de93c76..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.model.DataType; - -import com.example.ipo.sdo.PurchaseOrderType; -import com.example.ipo.sdo.SdoFactory; -import com.example.ipo.sdo.USAddress; -import commonj.sdo.DataObject; - -/** - * - */ -public class SDODataBindingTestCase extends TestCase { - private SDODataBinding binding; - - /** - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - binding = new SDODataBinding(); - SDOUtil.registerStaticTypes(SdoFactory.class); - } - - public final void testIntrospect() { - DataType<?> dataType = binding.introspect(DataObject.class); - Assert.assertTrue(dataType.getDataBinding().equals(binding.getName())); - Assert.assertTrue(dataType.getPhysical() == DataObject.class && dataType.getLogical() == null); - dataType = binding.introspect(PurchaseOrderType.class); - Assert.assertEquals(PurchaseOrderType.class, dataType.getPhysical()); - Assert.assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), dataType.getLogical()); - dataType = binding.introspect(USAddress.class); - Assert.assertEquals(USAddress.class, dataType.getPhysical()); - Assert.assertEquals(new QName("http://www.example.com/IPO", "USAddress"), dataType.getLogical()); - } -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java deleted file mode 100644 index c7403410ef..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.databinding.impl.TransformationContextImpl; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.apache.tuscany.spi.databinding.TransformationContext; -import org.apache.tuscany.spi.model.DataType; - -import com.example.ipo.sdo.PurchaseOrderType; -import com.example.ipo.sdo.SdoFactory; -import com.example.ipo.sdo.USAddress; -import commonj.sdo.DataObject; - -/** - * The base class for SDO-related test cases - */ -public abstract class SDOTransformerTestCaseBase extends TestCase { - protected String binding = DataObject.class.getName(); - - protected static final QName orderQName = new QName("http://www.example.com/IPO", "purchaseOrder"); - - protected TransformationContext context; - protected TransformationContext reversedContext; - protected DataObject dataObject; - - /** - * @see junit.framework.TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - SDOUtil.registerStaticTypes(SdoFactory.class); - context = new TransformationContextImpl(); - context.setSourceDataType(getSourceDataType()); - context.setTargetDataType(getTargetDataType()); - - reversedContext = new TransformationContextImpl(); - reversedContext.setSourceDataType(getTargetDataType()); - reversedContext.setTargetDataType(getSourceDataType()); - - PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType(); - USAddress address = SdoFactory.INSTANCE.createUSAddress(); - address.setCity("San Jose"); - address.setStreet("123 ABC St"); - address.setState("CA"); - address.setStreet("95131"); - po.setBillTo(address); - dataObject = (DataObject) po; - } - - protected abstract DataType<?> getSourceDataType(); - - protected abstract DataType<?> getTargetDataType(); - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java deleted file mode 100644 index a7f391216b..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.databinding.sdo; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.Assert; - -import org.apache.tuscany.spi.model.DataType; - -import com.example.ipo.sdo.PurchaseOrderType; - -import commonj.sdo.helper.XMLDocument; -import commonj.sdo.helper.XMLHelper; - -/** - * - */ -public class XMLDocument2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase { - - @Override - protected DataType<?> getSourceDataType() { - return new DataType<QName>(XMLDocument.class.getName(), XMLDocument.class, orderQName); - } - - @Override - protected DataType<?> getTargetDataType() { - return new DataType<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class); - } - - public final void testTransform() throws XMLStreamException { - XMLDocument document = - XMLHelper.INSTANCE.createDocument(dataObject, orderQName.getNamespaceURI(), orderQName.getLocalPart()); - XMLStreamReader reader = new XMLDocument2XMLStreamReader().transform(document, context); - XMLDocument document2 = new XMLStreamReader2XMLDocument().transform(reader, reversedContext); - Assert.assertEquals(orderQName.getNamespaceURI(), document2.getRootElementURI()); - Assert.assertEquals(orderQName.getLocalPart(), document2.getRootElementName()); - Assert.assertTrue(document2.getRootObject() instanceof PurchaseOrderType); - } - -} diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl deleted file mode 100644 index 8f4ee4be3e..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl +++ /dev/null @@ -1,34 +0,0 @@ -<?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. ---> -<!-- - import.sdo configuration - - $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $ ---> -<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT" - name="org.apache.tuscany.databinding.sdo"> - - <!-- import.sdo element loader implementations --> - <component name="elementLoader.import.sdo"> - <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/> - </component> - -</composite> diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/ipo.xsd b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/ipo.xsd deleted file mode 100755 index 5468542693..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/ipo.xsd +++ /dev/null @@ -1,118 +0,0 @@ -<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/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd deleted file mode 100755 index 56c6977254..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd +++ /dev/null @@ -1,233 +0,0 @@ -<?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. ---> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - elementFormDefault="qualified"> - - <element name="componentType" type="sca:ComponentType"/> - <complexType name="ComponentType"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/> - <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/> - <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="Service"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:interface"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="interface" type="sca:Interface"/> - <complexType name="Interface"/> - - <complexType name="Reference"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:interface"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="Property"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="type" type="QName" use="required"/> - <attribute name="many" type="boolean" default="false" use="optional"/> - <attribute name="required" type="boolean" default="false" use="optional"/> - <attribute name="default" type="string" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <element name="moduleFragment" type="sca:ModuleFragment"/> - <complexType name="ModuleFragment"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/> - <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/> - <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/> - <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="module" type="sca:Module"/> - <complexType name="Module"> - <complexContent> - <extension base="sca:ModuleFragment"/> - </complexContent> - </complexType> - - <complexType name="EntryPoint"> - <sequence> - <element minOccurs="0" maxOccurs="1" ref="sca:interface"/> - <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/> - <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - <!-- a multiplicity 1..1 or 0..n sample - <reference>StockQuoteComponent</reference> - type must be URI - a multiplicity 1..n or 0..n sample - <reference>StockQuoteComponent1</reference> - type must be URI - <reference>StockQuoteComponent2</reference> - --> - - <element name="binding" type="sca:Binding"/> - <complexType name="Binding"> - <attribute name="uri" type="anyURI" use="optional"/> - </complexType> - - <complexType name="Component"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/> - <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/> - <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - <!-- a multiplicity 1..1 or 0..1 sample - <references> - <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI - </references> - a multiplicity 1..n or 0..n sample - <references> - <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI - <v:stockQuote>StockQuoteComponent2</v:stockQuote> - </references> - --> - - <element name="implementation" type="sca:Implementation"/> - <complexType name="Implementation"/> - - <complexType name="PropertyValues"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="ReferenceValues"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <complexType name="ExternalService"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:interface"/> - <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <complexType name="ModuleWire"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/> - <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="source" type="anyType"/> - <element name="target" type="anyType"/> - - <element name="source.uri" type="anyURI" substitutionGroup="sca:source"/> - <element name="target.uri" type="anyURI" substitutionGroup="sca:target"/> - - <element name="subsystem" type="sca:Subsystem"/> - <complexType name="Subsystem"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/> - <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/> - <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/> - <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="uri" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="ModuleComponent"> - <sequence> - <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/> - <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="module" type="NCName" use="required"/> - <attribute name="uri" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="SystemWire"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:source"/> - <element minOccurs="1" maxOccurs="1" ref="sca:target"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - </complexType> - - <element name="source.epr" type="anyType" substitutionGroup="sca:source"/> - <element name="target.epr" type="anyType" substitutionGroup="sca:target"/> - - <simpleType name="Multiplicity"> - <restriction base="string"> - <enumeration value="0..1"/> - <enumeration value="1..1"/> - <enumeration value="0..n"/> - <enumeration value="1..n"/> - </restriction> - </simpleType> - - <simpleType name="OverrideOptions"> - <restriction base="string"> - <enumeration value="no"/> - <enumeration value="may"/> - <enumeration value="must"/> - </restriction> - </simpleType> - -</schema> diff --git a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd b/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd deleted file mode 100755 index bbaf58f00c..0000000000 --- a/branches/pre-spec-changes/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd +++ /dev/null @@ -1,43 +0,0 @@ -<?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. ---> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/mock/0.9" - elementFormDefault="qualified" - xmlns:mock="http://www.osoa.org/xmlns/mock/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"> - - <import namespace="http://www.osoa.org/xmlns/sca/0.9" - schemaLocation="sca-core.xsd" /> - - <element name="implementation.mock" type="mock:MockImplementation" - substitutionGroup="sca:implementation" /> - <complexType name="MockImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" - minOccurs="0" maxOccurs="unbounded" /> - </sequence> - <attribute name="myAttr" type="NCName" use="required" /> - <anyAttribute namespace="##any" processContents="lax" /> - </extension> - </complexContent> - </complexType> -</schema> |