diff options
Diffstat (limited to 'sandbox/old/contrib/binding-celtix')
44 files changed, 4356 insertions, 0 deletions
diff --git a/sandbox/old/contrib/binding-celtix/binding/.checkstyle b/sandbox/old/contrib/binding-celtix/binding/.checkstyle new file mode 100644 index 0000000000..048a1cef2e --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/.checkstyle @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fileset-config file-format-version="1.2.0" simple-config="true"> + <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false"> + <file-match-pattern match-pattern="." include-pattern="true"/> + </fileset> +</fileset-config> diff --git a/sandbox/old/contrib/binding-celtix/binding/.pmd b/sandbox/old/contrib/binding-celtix/binding/.pmd new file mode 100644 index 0000000000..138693a60b --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/.pmd @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd> diff --git a/sandbox/old/contrib/binding-celtix/binding/.ruleset b/sandbox/old/contrib/binding-celtix/binding/.ruleset new file mode 100644 index 0000000000..0933c1569c --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/.ruleset @@ -0,0 +1,190 @@ +<?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. +--> +<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/sandbox/old/contrib/binding-celtix/binding/LICENSE.txt b/sandbox/old/contrib/binding-celtix/binding/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, serviceDefinition 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/sandbox/old/contrib/binding-celtix/binding/NOTICE.txt b/sandbox/old/contrib/binding-celtix/binding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/NOTICE.txt @@ -0,0 +1,14 @@ +${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/sandbox/old/contrib/binding-celtix/binding/README.txt b/sandbox/old/contrib/binding-celtix/binding/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the 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. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sandbox/old/contrib/binding-celtix/binding/pom.xml.off b/sandbox/old/contrib/binding-celtix/binding/pom.xml.off new file mode 100644 index 0000000000..838016048e --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/pom.xml.off @@ -0,0 +1,96 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <parent> + <groupId>org.apache.tuscany.sca.services.bindings</groupId> + <artifactId>parent</artifactId> + <version>1.0-incubator-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <artifactId>celtix</artifactId> + <name>Apache Tuscany Binding for Celtix</name> + <description>Implementation of the SCA Web Services binding using Celtix.</description> + + <properties> + <celtix.version>1.0</celtix.version> + <checkstyle.properties>checkstyle.severity=error</checkstyle.properties> + <sourcechecks.force>true</sourcechecks.force> + </properties> + <repositories> + <repository> + <id>objectweb</id> + <name>ObjectWeb repo</name> + <url>http://maven.objectweb.org/maven2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca.kernel</groupId> + <artifactId>core</artifactId> + <version>0.1-pre-spec-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca.services.idl</groupId> + <artifactId>wsdl</artifactId> + <version>${sca.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca.services.databinding</groupId> + <artifactId>databinding-sdo</artifactId> + <version>${sca.version}</version> + <scope>compile</scope> + </dependency> + + <!-- Celtix --> + <dependency> + <groupId>org.objectweb.celtix</groupId> + <artifactId>celtix-rt</artifactId> + <version>${celtix.version}</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymockclassextension</artifactId> + </dependency> + <dependency> + <groupId>woodstox</groupId> + <artifactId>wstx-asl</artifactId> + </dependency> + </dependencies> +</project> diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java new file mode 100644 index 0000000000..238fbe97b0 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusService.java @@ -0,0 +1,35 @@ +/* + * 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.binding.celtix; + +import org.objectweb.celtix.Bus; + +/** + * A system service that returns the active Celtix <code>Bus</code> for the runtime + * + * @version $Rev$ $Date$ + */ +public interface BusService { + + /** + * Returns the active bus + */ + Bus getBus(); + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java new file mode 100644 index 0000000000..6b02dd0b15 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/BusServiceImpl.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.celtix; + +import java.util.Map; +import java.util.WeakHashMap; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.EagerInit; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.BusException; + +/** + * The default implementation of the Celtix Bus system service + * + * @version $Rev$ $Date$ + */ +@Scope("COMPOSITE") +@EagerInit +public class BusServiceImpl implements BusService { + protected WSDLDefinitionRegistry wsdlRegistry; + private Bus bus; + + public BusServiceImpl(@Property(override = "may")WSDLDefinitionRegistry wsdlRegistry) throws BusException { + this.wsdlRegistry = wsdlRegistry; + Map<String, Object> properties = new WeakHashMap<String, Object>(); + properties.put("celtix.WSDLManager", new TuscanyWSDLManager(wsdlRegistry)); + bus = Bus.init(new String[0], properties); + } + + public Bus getBus() { + return bus; + } + + /** + * Shuts down the bus, called when the runtime stops the Celtix system composite + * + * @throws BusException + */ + @Destroy + public void stop() throws BusException { + bus.shutdown(true); + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java new file mode 100644 index 0000000000..7eec916261 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java @@ -0,0 +1,100 @@ +/* + * 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.binding.celtix; + +import java.util.Map; +import java.util.WeakHashMap; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.ReferenceBinding; +import org.apache.tuscany.spi.component.ServiceBinding; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.model.BoundReferenceDefinition; +import org.apache.tuscany.spi.model.BoundServiceDefinition; + +import commonj.sdo.helper.TypeHelper; +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.objectweb.celtix.Bus; + +/** + * Builds a {@link org.apache.tuscany.spi.component.ServiceBinding} or {@link org.apache.tuscany.spi.component.ReferenceBinding} + * configured with the Celtix binding + * + * @version $Rev$ $Date$ + */ +public class CeltixBindingBuilder extends BindingBuilderExtension<WebServiceBindingDefinition> { + + private Bus bus; + + public ServiceBinding build(CompositeComponent parent, + BoundServiceDefinition boundServiceDefinition, + WebServiceBindingDefinition bindingDefinition, + DeploymentContext deploymentContext) { + TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName()); + if (typeHelper == null) { + typeHelper = TypeHelper.INSTANCE; + } + if (bus == null) { + bus = getBus(bindingDefinition.getWSDLDefinitionRegistry()); + } + return new CeltixServiceBinding( + boundServiceDefinition.getName(), + parent, + bindingDefinition, + bus, + typeHelper); + } + + public ReferenceBinding build(CompositeComponent parent, + BoundReferenceDefinition boundReferenceDefinition, + WebServiceBindingDefinition wsBinding, + DeploymentContext deploymentContext) { + TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName()); + if (typeHelper == null) { + typeHelper = TypeHelper.INSTANCE; + } + if (bus == null) { + bus = getBus(wsBinding.getWSDLDefinitionRegistry()); + } + return new CeltixReferenceBinding( + boundReferenceDefinition.getName(), + parent, + wsBinding, + bus, + typeHelper); + } + + protected Class<WebServiceBindingDefinition> getBindingType() { + return WebServiceBindingDefinition.class; + } + + private Bus getBus(WSDLDefinitionRegistry wsdlDefinitionRegistry) { + Bus celtixBus = null; + try { + Map<String, Object> properties = new WeakHashMap<String, Object>(); + properties.put("celtix.WSDLManager", new TuscanyWSDLManager(wsdlDefinitionRegistry)); + celtixBus = Bus.init(new String[0], properties); + } catch (Exception e) { + e.printStackTrace(); + } + return celtixBus; + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java new file mode 100644 index 0000000000..3982d9c879 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java @@ -0,0 +1,245 @@ +/* + * 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.binding.celtix; + +import java.io.IOException; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import javax.jws.WebParam; +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.namespace.QName; +import javax.xml.ws.Holder; + +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import commonj.sdo.helper.TypeHelper; +import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.BusException; +import org.objectweb.celtix.bindings.ClientBinding; +import org.objectweb.celtix.bindings.DataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; +import org.objectweb.celtix.ws.addressing.EndpointReferenceType; +import org.objectweb.celtix.wsdl.EndpointReferenceUtils; +import org.xmlsoap.schemas.wsdl.http.AddressType; + + +/** + * Responsible for dispatching a service operation invocation on a reference to the active Celtix <code>Bus</code> + * + * @version $Rev$ $Date$ + */ +public class CeltixInvoker implements TargetInvoker { + + private WSDLMetaDataCache wsdlCache; + + private ClientBinding clientBinding; + + private String operationName; + + private TypeHelper typeHelper; + + public CeltixInvoker(String operationName, + Bus bus, + Port port, + Service wsdlService, + Definition wsdlDef, + TypeHelper theTypeHelper) throws BuilderException { + this.wsdlCache = new WSDLMetaDataCache(wsdlDef, port); + this.operationName = operationName; + this.typeHelper = theTypeHelper; + // Definition wsdlDef = wsBinding.getWSDLDefinition(); + // wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort()); + + try { + String key = wsdlDef.getDocumentBaseURI(); + URL url = new URL(key); + + QName qName = wsdlService.getQName(); + EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, qName, port.getName()); + + String bindingId = null; + Binding binding = port.getBinding(); + if (null != binding) { + List list = binding.getExtensibilityElements(); + if (!list.isEmpty()) { + bindingId = ((ExtensibilityElement) list.get(0)).getElementType().getNamespaceURI(); + } + } + if (bindingId == null) { + List<?> list = port.getExtensibilityElements(); + for (Object ep : list) { + ExtensibilityElement ext = (ExtensibilityElement) ep; + if (ext instanceof SOAPAddress) { + bindingId = ((SOAPAddress) ext).getLocationURI(); + } + if (ext instanceof AddressType) { + bindingId = ((AddressType) ext).getLocation(); + } + } + + } + clientBinding = bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference); + } catch (MalformedURLException e) { + throw new InvokerCreationException(e); + } catch (BusException e) { + throw new InvokerCreationException(e); + } catch (WSDLException e) { + throw new InvokerCreationException(e); + } catch (IOException e) { + throw new InvokerCreationException(e); + } + } + + /** + * Invoke an operation on the external Web service. + * + * @param args the Java object arguments to the WS operation + * @return the response from the WS as a Java object + */ + public Object invokeTarget(final Object args, final short sequence) throws InvocationTargetException { + WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName); + if (opInfo == null) { + // REVISIT - really map the operation name to a WSDL operation + for (String opName : wsdlCache.getAllOperationInfo().keySet()) { + if (operationName.equalsIgnoreCase(opName)) { + opInfo = wsdlCache.getOperationInfo(opName); + break; + } + } + } + + ObjectMessageContext objMsgContext = clientBinding.createObjectContext(); + + boolean hasInOut = false; + int inOutCount = 0; + Object realArgs[]; + Object argsArray[]; + if (args.getClass().isArray()) { + argsArray = (Object[]) args; + realArgs = new Object[Array.getLength(args)]; + } else { + argsArray = new Object[0]; + realArgs = new Object[0]; + } + + if (opInfo.getParamsLength() == 0) { + // REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case. + // Bug in Celtix + realArgs = argsArray; + } else { + for (int x = 0; x < argsArray.length; x++) { + if (opInfo.getWebParam(x).mode() == WebParam.Mode.IN) { + realArgs[x] = argsArray[x]; + } else { + realArgs[x] = new Holder<Object>(argsArray[x]); + inOutCount++; + hasInOut = true; + } + } + } + objMsgContext.setMessageObjects(realArgs); + boolean isOneway = opInfo.isOneWay(); + DataBindingCallback callback = new SCADataBindingCallback(opInfo, hasInOut, typeHelper); + try { + if (isOneway) { + clientBinding.invokeOneWay(objMsgContext, callback); + } else { + objMsgContext = clientBinding.invoke(objMsgContext, callback); + } + } catch (IOException e) { + throw new InvocationTargetException(e); + } + + if (objMsgContext.getException() != null) { + // REVISIT - Exceptions + /* + * if (isValidException(objMsgContext)) { throw + * (Exception)objMsgContext.getException(); } else { throw new + * ProtocolException(objMsgContext.getException()); } + */ + throw new InvocationTargetException(objMsgContext.getException()); + } + + if (hasInOut) { + Object ret[] = new Object[inOutCount + 1]; + ret[0] = objMsgContext.getReturn(); + inOutCount = 1; + for (int x = 0; x < argsArray.length; x++) { + if (opInfo.getWebParam(x).mode() != WebParam.Mode.IN) { + Holder<?> holder = (Holder<?>) realArgs[x]; + ret[inOutCount] = holder.value; + inOutCount++; + } + } + return ret; + } + return objMsgContext.getReturn(); + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new UnsupportedOperationException(); + } + + public CeltixInvoker clone() throws CloneNotSupportedException { + try { + return (CeltixInvoker) super.clone(); + } catch (CloneNotSupportedException e) { + // will not happen + return null; + } + } + + public boolean isCacheable() { + return true; + } + + public void setCacheable(boolean cacheable) { + + } + + public boolean isOptimizable() { + return false; + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java new file mode 100644 index 0000000000..c596701880 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixReferenceBinding.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.celtix; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.xml.namespace.QName; + +import static org.osoa.sca.Version.XML_NAMESPACE_1_0; + +import org.apache.tuscany.spi.builder.BuilderException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ReferenceBindingExtension; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import commonj.sdo.helper.TypeHelper; +import org.objectweb.celtix.Bus; + +/** + * The implementation of a {@link org.apache.tuscany.spi.component.ReferenceBinding} configured with the Celtix binding + * + * @version $Rev$ $Date$ + */ +public class CeltixReferenceBinding<T> extends ReferenceBindingExtension { + private static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws"); + + private Bus bus; + private Port port; + private Definition wsdlDef; + private Service wsdlService; + private TypeHelper typeHelper; + + public CeltixReferenceBinding(String name, + CompositeComponent parent, + WebServiceBindingDefinition binding, + Bus theBus, + TypeHelper theTypeHelper) { + super(name, parent); + this.wsdlDef = binding.getWSDLDefinition(); + this.port = binding.getWSDLPort(); + this.wsdlService = binding.getWSDLService(); + this.bus = theBus; + this.typeHelper = theTypeHelper; + } + + public QName getBindingType() { + return BINDING_WS; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + try { + return new CeltixInvoker(operation.getName(), bus, port, wsdlService, wsdlDef, typeHelper); + } catch (BuilderException e) { + // fixme + throw new CeltixServiceInitException(e); + } + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java new file mode 100644 index 0000000000..96996e73c1 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceBinding.java @@ -0,0 +1,281 @@ +/* + * 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.binding.celtix; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; +import javax.jws.soap.SOAPBinding; +import javax.wsdl.Binding; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPBody; +import javax.xml.namespace.QName; +import javax.xml.ws.WebServiceProvider; + +import org.osoa.sca.annotations.Destroy; +import static org.osoa.sca.Version.XML_NAMESPACE_1_0; + +import org.apache.tuscany.spi.CoreRuntimeException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; + +import commonj.sdo.helper.TypeHelper; +import org.apache.tuscany.binding.celtix.io.SCAServerDataBindingCallback; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.bindings.BindingFactory; +import org.objectweb.celtix.bindings.DataBindingCallback; +import org.objectweb.celtix.bindings.ServerBinding; +import org.objectweb.celtix.bindings.ServerBindingEndpointCallback; +import org.objectweb.celtix.bindings.ServerDataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; +import org.objectweb.celtix.ws.addressing.AttributedURIType; +import org.objectweb.celtix.ws.addressing.EndpointReferenceType; +import org.objectweb.celtix.wsdl.EndpointReferenceUtils; +import org.xmlsoap.schemas.wsdl.http.AddressType; + + +/** + * An implementation of a {@link Service} configured with the Celtix binding + * + * @version $Rev$ $Date$ + */ +public class CeltixServiceBinding extends ServiceBindingExtension implements ServerBindingEndpointCallback { + private static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws"); + + private Bus bus; + private Port port; + private Definition wsdlDef; + private Service wsdlService; + private WSDLMetaDataCache wsdlCache; + private TypeHelper typeHelper; + + private Map<QName, ServerDataBindingCallback> opMap = + new ConcurrentHashMap<QName, ServerDataBindingCallback>(); + + + public CeltixServiceBinding(String theName, + CompositeComponent parent, + WebServiceBindingDefinition binding, + Bus bus, + TypeHelper theTypeHelper) { + super(theName, parent); + this.wsdlDef = binding.getWSDLDefinition(); + this.port = binding.getWSDLPort(); + this.wsdlService = binding.getWSDLService(); + this.bus = bus; + this.wsdlCache = new WSDLMetaDataCache(wsdlDef, port); + this.typeHelper = theTypeHelper; + } + + public void start() { + super.start(); + initOperationMap(); + startServerBinding(); + } + + private void startServerBinding() { + String key = wsdlDef.getDocumentBaseURI(); + URL url; + try { + url = new URL(key); + } catch (MalformedURLException e) { + throw new CeltixServiceInitException(e); + } + + QName qName = wsdlService.getQName(); + String portName = port.getName(); + EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, qName, portName); + + AttributedURIType address = new AttributedURIType(); + + String bindingId = null; + Binding binding = port.getBinding(); + if (null != binding) { + List list = binding.getExtensibilityElements(); + if (!list.isEmpty()) { + bindingId = ((ExtensibilityElement) list.get(0)).getElementType().getNamespaceURI(); + } + } + List<?> list = port.getExtensibilityElements(); + for (Object ep : list) { + ExtensibilityElement ext = (ExtensibilityElement) ep; + if (ext instanceof SOAPAddress) { + if (bindingId == null) { + bindingId = ((SOAPAddress) ext).getLocationURI(); + } + address.setValue(((SOAPAddress) ext).getLocationURI()); + } + if (ext instanceof AddressType) { + if (bindingId == null) { + bindingId = ((AddressType) ext).getLocation(); + } + address.setValue(((AddressType) ext).getLocation()); + } + } + if (reference.getAddress() == null) { + //REVIST - bug in Celtix that the HTTP transport won't find the address correctly + reference.setAddress(address); + } + ClassLoader previousLoader = null; + try { + //FIXME: This hack is because SAAJImpl uses Thread.currentThread().getContextClassLoader(), + //this classloader is different from current classLoader. + previousLoader = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + BindingFactory bindingFactory = bus.getBindingManager().getBindingFactory(bindingId); + ServerBinding serverBinding = bindingFactory.createServerBinding(reference, this); + serverBinding.activate(); + } catch (Exception e) { + throw new CeltixServiceInitException(e); + } finally { + if (previousLoader != null) { + Thread.currentThread().setContextClassLoader(previousLoader); + } + } + } + + private void initOperationMap() { + List ops = port.getBinding().getBindingOperations(); + for (Object op1 : ops) { + BindingOperation op = (BindingOperation) op1; + BindingInput bindingInput = op.getBindingInput(); + List elements = bindingInput.getExtensibilityElements(); + QName qn = new QName(wsdlDef.getTargetNamespace(), op.getName()); + + //In case soap:body namespace is different from targetNamespace + for (Object element : elements) { + if (SOAPBody.class.isInstance(element)) { + SOAPBody body = (SOAPBody) element; + if (body.getNamespaceURI() != null) { + qn = new QName(body.getNamespaceURI(), op.getName()); + } + } + } + + ServerDataBindingCallback cb = getDataBindingCallback(qn, null, DataBindingCallback.Mode.PARTS); + opMap.put(qn, cb); + if (!"".equals(cb.getRequestWrapperQName().getLocalPart())) { + opMap.put(cb.getRequestWrapperQName(), cb); + } + } + } + + @Destroy + public void stop() throws CoreRuntimeException { + super.stop(); + } + + public ServerDataBindingCallback getDataBindingCallback(QName operationName, + ObjectMessageContext objContext, + DataBindingCallback.Mode mode) { + if (opMap.containsKey(operationName)) { + return opMap.get(operationName); + } + WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName.getLocalPart()); + if (opInfo == null) { + //REVISIT - really map the operation name to a WSDL operation + for (String opName : wsdlCache.getAllOperationInfo().keySet()) { + if (operationName.getLocalPart().equalsIgnoreCase(opName)) { + opInfo = wsdlCache.getOperationInfo(opName); + break; + } + } + } + boolean inout = false; + + // Class<?> serviceInterface = this.getInterface(); + // Method meth = getMethod(serviceInterface, operationName.getLocalPart()); + + // Object proxy = null; +// try { +// // proxy = this.getServiceInstance(); +// } catch (TargetException e) { +// throw new CeltixServiceInitException(e); +// } + + return new SCAServerDataBindingCallback(opInfo, + inout, + operationName.getLocalPart(), + getInboundWire(), + typeHelper); + } + +// protected Method getMethod(Class<?> serviceInterface, String operationName) { +// // Note: this doesn't support overloaded operations +// Method[] methods = serviceInterface.getMethods(); +// for (Method m : methods) { +// if (m.getName().equals(operationName)) { +// return m; +// } +// // tolerate WSDL with capatalized operation name +// StringBuilder sb = new StringBuilder(operationName); +// sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); +// if (m.getName().equals(sb.toString())) { +// return m; +// } +// } +// // FIXME +// throw new CeltixServiceInitException("no operation named " + operationName +// + " found on service interface: " + serviceInterface.getName()); +// } + + public DataBindingCallback getFaultDataBindingCallback(ObjectMessageContext objContext) { + // REVISIT - what to do about faults + return null; + } + + public Map<QName, ? extends DataBindingCallback> getOperations() { + return opMap; + } + + public SOAPBinding.Style getStyle() { + return wsdlCache.getStyle(); + } + + public DataBindingCallback.Mode getServiceMode() { + return DataBindingCallback.Mode.PARTS; + } + + public WebServiceProvider getWebServiceProvider() { + //not needed I think + return null; + } + + public Executor getExecutor() { + //Let the transport handle it (or it goes to the Bus default wq + //if the transport cannot handle it + return null; + } + + + public QName getBindingType() { + return BINDING_WS; + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java new file mode 100644 index 0000000000..28c4dfaf2a --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/CeltixServiceInitException.java @@ -0,0 +1,43 @@ +/* + * 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.binding.celtix; + +import org.apache.tuscany.spi.CoreRuntimeException; + +/** + * Denotes an exception starting a {@link CeltixServiceBinding} instance + * + * @version $Rev$ $Date$ + */ +public class CeltixServiceInitException extends CoreRuntimeException { + public CeltixServiceInitException() { + } + + public CeltixServiceInitException(String message) { + super(message); + } + + public CeltixServiceInitException(String message, Throwable cause) { + super(message, cause); + } + + public CeltixServiceInitException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java new file mode 100644 index 0000000000..e08a3193d8 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/InvokerCreationException.java @@ -0,0 +1,43 @@ +/* + * 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.binding.celtix; + +import org.apache.tuscany.spi.builder.BuilderException; + +/** + * Thrown when an error is encountered creating a {@link CeltixInvoker} + * + * @version $Rev$ $Date$ + */ +public class InvokerCreationException extends BuilderException { + public InvokerCreationException() { + } + + public InvokerCreationException(String message) { + super(message); + } + + public InvokerCreationException(String message, Throwable cause) { + super(message, cause); + } + + public InvokerCreationException(Throwable cause) { + super(cause); + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java new file mode 100644 index 0000000000..18efe80da5 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/TuscanyWSDLManager.java @@ -0,0 +1,89 @@ +/* + * 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.binding.celtix; + +import java.io.IOException; +import java.net.URL; +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensionRegistry; +import javax.wsdl.factory.WSDLFactory; + +import org.w3c.dom.Element; +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; + +import org.objectweb.celtix.wsdl.WSDLManager; + +/** + * + * @version $Rev$ $Date$ + */ +public class TuscanyWSDLManager implements WSDLManager { + WSDLDefinitionRegistry wsdlDefinitionRegistry; + + public TuscanyWSDLManager(WSDLDefinitionRegistry w) { + wsdlDefinitionRegistry = w; + } + + public WSDLFactory getWSDLFactory() { + //Not supported + return null; + } + + public ExtensionRegistry getExtenstionRegistry() { + return wsdlDefinitionRegistry.getExtensionRegistry(); + } + + public Definition getDefinition(URL url) throws WSDLException { + try { + return wsdlDefinitionRegistry.loadDefinition(null, url); + } catch (IOException e) { + //FIXME + throw new WSDLException("", "", e); + } + } + + public Definition getDefinition(String url) throws WSDLException { + try { + //The namespace is the wsdl targetNamesapce, it is only used + //when the wsdl is created into cache. we are ok here to set it to null. + //FIXME pass the current ResourceLoader + return wsdlDefinitionRegistry.loadDefinition(null, new URL(url)); + } catch (IOException e) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, e.getMessage()); + } + } + + public Definition getDefinition(Element el) throws WSDLException { + throw new UnsupportedOperationException(); + } + + public Definition getDefinition(Class<?> sei) throws WSDLException { + throw new UnsupportedOperationException(); + } + + public void addDefinition(Object key, Definition wsdl) { + throw new UnsupportedOperationException(); + } + + public void shutdown() { + } + + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java new file mode 100644 index 0000000000..4efd039c26 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingDefinition.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.celtix; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.apache.tuscany.spi.model.BindingDefinition; + +/** + * Represents a Celtix binding configuration in an assembly + * + * @version $Rev$ $Date$ + */ +public class WebServiceBindingDefinition extends BindingDefinition { + + private Definition definition; + private Port port; + private Service service; + //private String portURI; + private String uri; + //We have to use WebServiceBindingDefinition to pass WSDLDefinitionRegistry to BindingBuilder + private WSDLDefinitionRegistry wsdlDefinitionRegistry; + + public WebServiceBindingDefinition(Definition definition, Port port, String uri, String portURI, Service service) { + this.definition = definition; + this.port = port; + this.uri = uri; + //this.portURI = portURI; + this.service = service; + } + + public Port getWSDLPort() { + return port; + } + + public Service getWSDLService() { + return service; + } + + public void setWSDLPort(Port value) { + port = value; + } + + public Definition getWSDLDefinition() { + return definition; + } + + public void setWSDLDefinition(Definition def) { + definition = def; + } + + public WSDLDefinitionRegistry getWSDLDefinitionRegistry() { + return wsdlDefinitionRegistry; + } + + public void setWSDLDefinitionRegistry(WSDLDefinitionRegistry theWsdlDefinitionRegistry) { + wsdlDefinitionRegistry = theWsdlDefinitionRegistry; + } + +// public void setPortURI(String uri) { +// portURI = uri; +// } + + public String getURI() { + return uri; + } + + public void setURI(String theUri) { + this.uri = theUri; + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java new file mode 100644 index 0000000000..804cdc09fd --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java @@ -0,0 +1,197 @@ +/* + * 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.binding.celtix; + + +import java.io.IOException; +import java.net.URL; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.xml.sax.InputSource; +import static org.osoa.sca.Version.XML_NAMESPACE_1_0; +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Scope; + +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.model.ModelObject; +import org.apache.tuscany.spi.loader.LoaderRegistry; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl; +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl.Monitor; + +/** + * Parses a <code>WebServiceBindingDefinition</code> entry in an assembly XML file + * + * @version $Rev$ $Date$ + */ +@Scope("COMPOSITE") +public class WebServiceBindingLoader extends LoaderExtension<WebServiceBindingDefinition> { + public static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws"); + + protected WSDLDefinitionRegistry wsdlRegistry; + + @Constructor({"registry"}) + public WebServiceBindingLoader(@Autowire LoaderRegistry registry) { + super(registry); + + //FIXME: this is a hack, WSDLDefinitionRegistry should not be created here + if (wsdlRegistry == null) { + try { + wsdlRegistry = new WSDLDefinitionRegistryImpl(); + Monitor monitor = new Monitor() { + public void readingWSDL(String namespace, URL location) { + } + + public void cachingDefinition(String namespace, URL location) { + } + }; + + ((WSDLDefinitionRegistryImpl) wsdlRegistry).setMonitor(monitor); + } catch (javax.wsdl.WSDLException e) { + //do nothing + } + } + } + + public QName getXMLType() { + return BINDING_WS; + } + + public WebServiceBindingDefinition load(CompositeComponent parent, + ModelObject object, + XMLStreamReader reader, + DeploymentContext deploymentContext) + throws XMLStreamException, LoaderException { + // not sure what uri was here ? String uri = reader.getAttributeValue(null, "uri"); + String uri = null; + String endpointAttribute = reader.getAttributeValue(null, "endpoint"); + //String portURI = reader.getAttributeValue(null, "port"); + String wsdlLocation = reader.getAttributeValue(null, "location"); + try { + return createBinding(uri, endpointAttribute, wsdlLocation, deploymentContext); + } catch (Exception e) { + + throw new LoaderException(e); + } + } + + private WebServiceBindingDefinition createBinding(String port, String portURI, String wsdlLocation, + DeploymentContext deploymentContext) + throws WSDLException, IOException { + List<Definition> definitions = null; + // FIXME wsdlRegistry.getDefinitionsForNamespace(portNamespace, + // resourceLoader); + // Get the WSDL port namespace and name + if (port == null && portURI != null) { + int h = portURI.indexOf('#'); + String portNamespace = portURI.substring(0, h); + String serviceName; + String portName; + + String fragment = portURI.substring(h + 1); + if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) { + fragment = fragment.substring(14, fragment.length() - 1); + int slash = fragment.indexOf('/'); + if (slash != -1) { + serviceName = fragment.substring(0, slash); + portName = fragment.substring(slash + 1); + } else { + serviceName = null; + portName = fragment; + } + } else { + serviceName = null; + portName = fragment; + } + + // FIXME need to find out how to get wsdl and what context to use --- terrible hack attack! + // URL wsdlurl = Thread.currentThread().getContextClassLoader().getResource(wsdlLocation); + if (null == wsdlLocation) { + throw new RuntimeException("Failed to determin wsdl location on binding. " + + "Try specifying 'location' attribute on binding."); + } + URL wsdlurl = deploymentContext.getClassLoader().getResource(wsdlLocation); + if (wsdlurl == null) { + throw new RuntimeException("Failed to load wsdl from '" + wsdlLocation + "'"); + } + + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader reader = factory.newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + InputSource input = new InputSource(wsdlurl.openStream()); + Definition wsdlDef = reader.readWSDL(wsdlurl.toString(), input); + definitions = new LinkedList<Definition>(); + definitions.add(wsdlDef); + // FIXME all the above needs to better addressed. + + //FIXME: if a global wsdl cached is used, we need to do a registration here + String namespace = wsdlDef.getTargetNamespace(); + wsdlRegistry.loadDefinition(namespace, wsdlurl); + + Definition definition = null; + Port thePort = null; + Service service = null; + for (Definition def : definitions) { + + // Find the port with the given name + for (Service serv : (Collection<Service>) def.getServices().values()) { + QName sqn = serv.getQName(); + if (serviceName != null + && !serviceName.equals(sqn.getLocalPart())) { + continue; + } + + Port p = serv.getPort(portName); + if (p != null) { + service = serv; + definition = def; + thePort = p; + break; + } + } + } + if (thePort == null) { + throw new IllegalArgumentException("Cannot find WSDL port " + portURI); + + } + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(definition, thePort, port, portURI, service); + wsBinding.setWSDLDefinitionRegistry(wsdlRegistry); + return wsBinding; + } + // FIXME - return a broken binding for now + return new WebServiceBindingDefinition(null, null, null, portURI, null); + + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java new file mode 100644 index 0000000000..7a14ab33fc --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java @@ -0,0 +1,205 @@ +/* + * 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.binding.celtix.io; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import org.w3c.dom.Node; +import org.w3c.dom.bootstrap.DOMImplementationRegistry; +import static org.w3c.dom.bootstrap.DOMImplementationRegistry.PROPERTY; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSOutput; +import org.w3c.dom.ls.LSSerializer; + +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.model.DataType; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLDocument; + +import org.apache.tuscany.core.databinding.impl.TransformationContextImpl; +import org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument; +import org.objectweb.celtix.bindings.DataReader; +import org.objectweb.celtix.context.ObjectMessageContext; + +public class NodeDataReader implements DataReader<Node> { + + private SCADataBindingCallback callback; + + public NodeDataReader(SCADataBindingCallback cb) { + callback = cb; + } + + public Object read(int idx, Node input) { + return read(null, idx, input); + } + + public Object read(QName name, int idx, Node input) { + try { + InputStream in = getNodeStream(input); + XMLInputFactory staxFactory = XMLInputFactory.newInstance(); + XMLStreamReader reader = staxFactory.createXMLStreamReader(in); + + XMLStreamReader2XMLDocument transformer = new XMLStreamReader2XMLDocument(); + TransformationContext context = new TransformationContextImpl(); + DataType<QName> binding = new DataType<QName>(DataObject.class, null); + binding.setMetadata(TypeHelper.class.getName(), callback.getTypeHelper()); + context.setTargetDataType(binding); + XMLDocument document = transformer.transform(reader, context); + + boolean isWrapped = false; + return toObjects(document, isWrapped); + } catch (Exception e) { + //REVISIT: better handling of exceptions + } + return null; + } + + public void readWrapper(ObjectMessageContext objCtx, boolean isOutBound, Node input) { + try { + QName wrapperName; + if (isOutBound) { + wrapperName = callback.getOperationInfo().getResponseWrapperQName(); + } else { + wrapperName = callback.getOperationInfo().getRequestWrapperQName(); + } + + Node nd = input.getFirstChild(); + while (nd != null + && !wrapperName.getNamespaceURI().equals(nd.getNamespaceURI()) + && !wrapperName.getLocalPart().equals(nd.getLocalName())) { + nd = nd.getNextSibling(); + } + + //REVISIT - This is SUCH a HACK. This needs to be done with StAX or something + //a bit better than streaming and reparsing + InputStream in = getNodeStream(nd); + XMLInputFactory staxFactory = XMLInputFactory.newInstance( + "javax.xml.stream.XMLInputFactory", getClass().getClassLoader()); + XMLStreamReader reader = staxFactory.createXMLStreamReader(in); + + XMLStreamReader2XMLDocument transformer = new XMLStreamReader2XMLDocument(); + TransformationContext context = new TransformationContextImpl(); + DataType<QName> binding = new DataType<QName>(DataObject.class, null); + binding.setMetadata(TypeHelper.class.getName(), callback.getTypeHelper()); + context.setTargetDataType(binding); + XMLDocument document = transformer.transform(reader, context); + + //boolean isWrapped = true; + Object[] objects = toObjects(document, true); + + if (callback.hasInOut()) { + //REVISIT - inOuts + } else { + if (isOutBound) { + objCtx.setReturn(objects[0]); + } else { + objCtx.setMessageObjects(objects); + } + } + } catch (Exception e) { + //REVISIT: better handling of exceptions + } + } + + /** + * Convert a typed DataObject to Java objects + * + * @param document + * @param isWrapped + * @return the array of Objects from the DataObject + */ + public static Object[] toObjects(XMLDocument document, boolean isWrapped) { + DataObject dataObject = document.getRootObject(); + if (isWrapped) { + List ips = dataObject.getInstanceProperties(); + Object[] os = new Object[ips.size()]; + for (int i = 0; i < ips.size(); i++) { + os[i] = dataObject.get((Property) ips.get(i)); + } + return os; + } else { + Object object = dataObject; + Type type = dataObject.getType(); + if (type.isSequenced()) { + object = dataObject.getSequence().getValue(0); + } + return new Object[]{object}; + } + } + + byte[] getNodeBytes(Node node) + throws ClassCastException, ClassNotFoundException, InstantiationException, IllegalAccessException { + + //This is also a hack, the JDK should already have this set, but it doesn't + DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); + if (registry == null) { + System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + } + DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); + if (impl == null) { + System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); + } + LSOutput output = impl.createLSOutput(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + output.setByteStream(bout); + LSSerializer writer = impl.createLSSerializer(); + writer.write(node, output); + + return bout.toByteArray(); + } + + InputStream getNodeStream(Node node) + throws ClassCastException, ClassNotFoundException, + InstantiationException, IllegalAccessException { + + DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); + if (registry == null) { + //This is also a hack, the JDK should already have this set, but it doesn't + System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + } + DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); + if (impl == null) { + System.setProperty(PROPERTY, "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); + } + LSOutput output = impl.createLSOutput(); + RawByteArrayOutputStream bout = new RawByteArrayOutputStream(); + output.setByteStream(bout); + LSSerializer writer = impl.createLSSerializer(); + writer.write(node, output); + + return new ByteArrayInputStream(bout.getBytes(), 0, bout.size()); + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java new file mode 100644 index 0000000000..d870cafa87 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java @@ -0,0 +1,322 @@ +/* + * 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.binding.celtix.io; + +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.objectweb.celtix.bindings.DataWriter; +import org.objectweb.celtix.context.ObjectMessageContext; + +public class NodeDataWriter implements DataWriter<Node> { + private static final String XML_NS = "http://www.w3.org/2000/xmlns/"; + private SCADataBindingCallback callback; + + public NodeDataWriter(SCADataBindingCallback cb) { + callback = cb; + } + + public void write(Object obj, Node output) { + write(obj, null, output); + } + + public void write(Object obj, QName elName, Node output) { + boolean isWrapped = false; + + XMLDocument document = toXMLDocument(callback.getTypeHelper(), new Object[]{obj}, elName, isWrapped); + // HACK: [rfeng] We should use the transformer in an interceptor + XMLDocument2XMLStreamReader transformer = new XMLDocument2XMLStreamReader(); + XMLStreamReader reader = transformer.transform(document, null); + + try { + //CeltixFire supports Stax, we should not need to do following anymore. + readDocElements(output, reader, true, null); + } catch (XMLStreamException e) { + throw new InvocationRuntimeException(e.getMessage()); + } + } + + public void writeWrapper(ObjectMessageContext objCtx, boolean isOutbound, Node output) { + boolean isWrapped = true; + QName wrapperName; + if (isOutbound) { + wrapperName = callback.getOperationInfo().getResponseWrapperQName(); + } else { + wrapperName = callback.getOperationInfo().getRequestWrapperQName(); + } + + XMLDocument document = toXMLDocument( + callback.getTypeHelper(), objCtx.getMessageObjects(), wrapperName, isWrapped); + // HACK: [rfeng] We should use the transformer in an interceptor + XMLDocument2XMLStreamReader transformer = new XMLDocument2XMLStreamReader(); + XMLStreamReader reader = transformer.transform(document, null); + + try { + readDocElements(output, reader, true, null); + } catch (XMLStreamException e) { + e.printStackTrace(); + throw new InvocationRuntimeException(e.getMessage()); + } + } +/* + private DataObject toWrappedDataObject(TypeHelper typeHelper, + Object ret, + Object[] os, + QName typeQN) { + XSDHelper xsdHelper = new XSDHelperImpl(typeHelper); + Property property = xsdHelper.getGlobalProperty(typeQN.getNamespaceURI(), + typeQN.getLocalPart(), true); + DataObject dataObject = new DataFactoryImpl(typeHelper).create(property.getType()); + List ips = dataObject.getInstanceProperties(); + int offset = 0; + if (ret != null) { + dataObject.set(0, ret); + offset = 1; + } + for (int i = offset; i < ips.size(); i++) { + if (os[i - offset] instanceof Holder) { + Holder<?> holder = (Holder<?>)os[i - offset]; + dataObject.set(i, holder.value); + } else { + dataObject.set(i, os[i - offset]); + } + } + return dataObject; + } +*/ + + /** + * Convert objects to typed DataObject + * + * @param typeHelper + * @param os + * @param elementQName + * @param isWrapped + * @return the DataObject + */ + private static XMLDocument toXMLDocument(TypeHelper typeHelper, + Object[] os, + QName elementQName, + boolean isWrapped) { + XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); + + Property property = xsdHelper.getGlobalProperty( + elementQName.getNamespaceURI(), elementQName.getLocalPart(), true); + if (null == property) { + throw new InvocationRuntimeException( + "Type '" + elementQName.toString() + "' not found in registered SDO types."); + } + DataObject dataObject; + if (isWrapped) { + DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper); + dataObject = dataFactory.create(property.getType()); + List ips = dataObject.getInstanceProperties(); + for (int i = 0; i < ips.size(); i++) { + dataObject.set(i, os[i]); + } + } else { + Object value = os[0]; + Type type = property.getType(); + if (!type.isDataType()) { + dataObject = (DataObject) value; + } else { + dataObject = SDOUtil.createDataTypeWrapper(type, value); + } + } + + XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper); + return xmlHelper.createDocument(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart()); + + } + + //REVISIT: We should not need to do following anymore with CeltixFire. + //As CeltixFire supports stax directly. + + /** + * @param parent + * @param reader + * @param repairing + * @param stopAt: stop at the specified element + * @throws XMLStreamException + */ + public static void readDocElements(Node parent, XMLStreamReader reader, boolean repairing, QName stopAt) + throws XMLStreamException { + Document doc = getDocument(parent); + + int event = reader.getEventType(); + + while (reader.hasNext()) { + switch (event) { + case XMLStreamConstants.START_ELEMENT: + if (startElement(parent, reader, repairing, stopAt) == null) { + return; + } + if (parent instanceof Document && stopAt != null) { + if (reader.hasNext()) { + reader.next(); + } + return; + } + break; + case XMLStreamConstants.END_ELEMENT: + return; + case XMLStreamConstants.NAMESPACE: + break; + case XMLStreamConstants.ATTRIBUTE: + break; + case XMLStreamConstants.CHARACTERS: + if (parent != null) { + parent.appendChild(doc.createTextNode(reader.getText())); + } + + break; + case XMLStreamConstants.COMMENT: + if (parent != null) { + parent.appendChild(doc.createComment(reader.getText())); + } + + break; + case XMLStreamConstants.CDATA: + parent.appendChild(doc.createCDATASection(reader.getText())); + + break; + case XMLStreamConstants.PROCESSING_INSTRUCTION: + parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData())); + + break; + case XMLStreamConstants.ENTITY_REFERENCE: + parent.appendChild(doc.createProcessingInstruction(reader.getPITarget(), reader.getPIData())); + + break; + default: + break; + } + + if (reader.hasNext()) { + event = reader.next(); + } + } + } + + private static Document getDocument(Node parent) { + return (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); + } + + /** + * @param parent + * @param reader + * @return + * @throws XMLStreamException + */ + private static Element startElement(Node parent, XMLStreamReader reader, boolean repairing, QName stopAt) + throws XMLStreamException { + Document doc = getDocument(parent); + + if (stopAt != null && stopAt.getNamespaceURI().equals(reader.getNamespaceURI()) + && stopAt.getLocalPart().equals(reader.getLocalName())) { + return null; + } + + Element e = doc.createElementNS(reader.getNamespaceURI(), reader.getLocalName()); + + if (reader.getPrefix() != null) { + e.setPrefix(reader.getPrefix()); + } + + parent.appendChild(e); + + for (int ns = 0; ns < reader.getNamespaceCount(); ns++) { + String uri = reader.getNamespaceURI(ns); + String prefix = reader.getNamespacePrefix(ns); + + declare(e, uri, prefix); + } + + for (int att = 0; att < reader.getAttributeCount(); att++) { + String name = reader.getAttributeLocalName(att); + String prefix = reader.getAttributePrefix(att); + if (prefix != null && prefix.length() > 0) { + name = prefix + ":" + name; + } + + Attr attr = doc.createAttributeNS(reader.getAttributeNamespace(att), name); + attr.setValue(reader.getAttributeValue(att)); + e.setAttributeNode(attr); + } + + reader.next(); + + readDocElements(e, reader, repairing, stopAt); + + if (repairing && !isDeclared(e, reader.getNamespaceURI(), reader.getPrefix())) { + declare(e, reader.getNamespaceURI(), reader.getPrefix()); + } + + return e; + } + + private static void declare(Element node, String uri, String prefix) { + if (prefix != null && prefix.length() > 0) { + node.setAttributeNS(XML_NS, "xmlns:" + prefix, uri); + } else { + if (uri != null /* && uri.length() > 0 */) { + node.setAttributeNS(XML_NS, "xmlns", uri); + } + } + } + + private static boolean isDeclared(Element e, String namespaceURI, String prefix) { + Attr att; + if (prefix != null && prefix.length() > 0) { + att = e.getAttributeNodeNS(XML_NS, "xmlns:" + prefix); + } else { + att = e.getAttributeNode("xmlns"); + } + + if (att != null && att.getNodeValue().equals(namespaceURI)) { + return true; + } + + if (e.getParentNode() instanceof Element) { + return isDeclared((Element) e.getParentNode(), namespaceURI, prefix); + } + + return false; + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java new file mode 100644 index 0000000000..057481041b --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java @@ -0,0 +1,30 @@ +/* + * 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.binding.celtix.io; + +import java.io.ByteArrayOutputStream; + +/** + * Just to allow raw access to the byte[] to avoid a copy + */ +class RawByteArrayOutputStream extends ByteArrayOutputStream { + public byte[] getBytes() { + return buf; + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java new file mode 100644 index 0000000000..47d130383f --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.celtix.io; + +import org.w3c.dom.Node; + +import commonj.sdo.helper.TypeHelper; +import org.objectweb.celtix.bindings.DataReader; +import org.objectweb.celtix.bindings.DataWriter; +import org.objectweb.celtix.bus.bindings.AbstractWSDLOperationDataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; + + +/** + * @version $Rev$ $Date$ + */ +public class SCADataBindingCallback extends AbstractWSDLOperationDataBindingCallback { + + protected boolean hasInOut; + protected TypeHelper typeHelper; + + public SCADataBindingCallback(WSDLOperationInfo op, boolean inout, TypeHelper theTypeHelper) { + super(op); + this.hasInOut = inout; + this.typeHelper = theTypeHelper; + } + + public boolean hasInOut() { + return hasInOut; + } + + public Mode getMode() { + return Mode.PARTS; + } + + public Class<?>[] getSupportedFormats() { + return new Class<?>[]{Node.class}; + } + + public TypeHelper getTypeHelper() { + return typeHelper; + } + + @SuppressWarnings("unchecked") + public <T> DataWriter<T> createWriter(Class<T> cls) { + if (cls == Node.class) { + return (DataWriter<T>) new NodeDataWriter(this); + } + return null; + } + + @SuppressWarnings("unchecked") + public <T> DataReader<T> createReader(Class<T> cls) { + if (cls == Node.class) { + return (DataReader<T>) new NodeDataReader(this); + } + //REVISIT - need to figure out what to do with Faults + return null; + } + + public void initObjectContext(ObjectMessageContext octx) { + //REVISIT - is this even used? + } + + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java new file mode 100644 index 0000000000..056c571ec4 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.celtix.io; + +import java.lang.reflect.InvocationTargetException; +import java.util.Map; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.MessageImpl; + +import commonj.sdo.helper.TypeHelper; +import org.objectweb.celtix.bindings.ServerDataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; + + +/** + * @version $Rev$ $Date$ + */ +public class SCAServerDataBindingCallback extends SCADataBindingCallback + implements ServerDataBindingCallback { + String operationName; + InboundWire wire; + + public SCAServerDataBindingCallback(WSDLOperationInfo op, + boolean inout, + String operationName, + InboundWire wire, + TypeHelper theTypeHelper) { + super(op, inout, theTypeHelper); + this.operationName = operationName; + this.wire = wire; + } + + + public void invoke(ObjectMessageContext octx) throws InvocationTargetException { + Object ret; + try { + InboundInvocationChain chain = null; + for (Map.Entry<Operation<?>, InboundInvocationChain> entry : wire.getInvocationChains().entrySet()) { + if (entry.getKey().getName().equals(operationName)) { + chain = entry.getValue(); + break; + } + } + MessageImpl msg = new MessageImpl(); + msg.setBody(octx.getMessageObjects()); + ret = chain.getHeadInterceptor().invoke(msg); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new InvocationTargetException(e); + } + octx.setReturn(ret); + } + +// public void initObjectContext(ObjectMessageContext octx) { +// Object o[] = new Object[method.getParameterTypes().length]; +// //REVIST - holders? +// octx.setMessageObjects(o); +// } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..62ce396a5a --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,31 @@ +<?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. +--> +<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.binding.celtix.WebServiceBinding"> + + <component name="ws.implementationLoader"> + <system:implementation.system class="org.apache.tuscany.binding.celtix.WebServiceBindingLoader" /> + </component> + + <component name="ws.componentBuilder"> + <system:implementation.system class="org.apache.tuscany.binding.celtix.CeltixBindingBuilder" /> + </component> + +</composite> diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java new file mode 100644 index 0000000000..cba83a7792 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/BootstrapTestCase.java @@ -0,0 +1,35 @@ +/* + * 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.binding.celtix; + +import junit.framework.TestCase; + +/** + * @version $Rev$ $Date$ + */ +public class BootstrapTestCase extends TestCase { + + public void testReference() throws Exception { +// BusServiceImpl busService = new BusServiceImpl(); +// WSDLDefinitionRegistry wsdlRegistry = new WSDLDefinitionRegistryImpl(); +// busService.setWsdlRegistry(wsdlRegistry); +// busService.init(); +// CeltixReference reference = new CeltixReference("reference",); + } +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java new file mode 100644 index 0000000000..235144ffbb --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java @@ -0,0 +1,134 @@ +/* + * 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.binding.celtix; + +import java.net.URL; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import org.xml.sax.InputSource; + +import junit.framework.TestCase; +import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback; +import org.easymock.classextension.EasyMock; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.bindings.BindingManager; +import org.objectweb.celtix.bus.bindings.soap.SOAPBindingFactory; +import org.objectweb.celtix.bus.bindings.soap.SOAPClientBinding; +import org.objectweb.celtix.context.ObjectMessageContextImpl; +import org.objectweb.celtix.ws.addressing.EndpointReferenceType; + +/** + * @version $Rev$ $Date$ + */ +public class CeltixInvokerTestCase extends TestCase { + + public void testProcessingInputWithoutInOut() throws Exception { + String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl"; + String operationName = "greetMe"; + ObjectMessageContextImpl inputCtx = new ObjectMessageContextImpl(); + CeltixInvoker invoker = createCeltixInvoker(wsdlLocation, + operationName, inputCtx); + + Object[] args = new Object[1]; + args[0] = new String("hello"); + invoker.invokeTarget(args, CeltixInvoker.NONE); + + // Check the input object after processing is correct + // Should be no change for input if only IN parameters involved + Object[] myrtn = (Object[]) inputCtx.getMessageObjects(); + + assertEquals("hello", myrtn[0]); + } + + public void testProcessingInputWithInOut() throws Exception { + String wsdlLocation = "/wsdl/hello_world_doc_lit_inout.wsdl"; + String operationName = "greetMe"; + ObjectMessageContextImpl inputCtx = new ObjectMessageContextImpl(); + CeltixInvoker invoker = createCeltixInvoker(wsdlLocation, + operationName, inputCtx); + + Object[] args = new Object[1]; + String inputvalue = new String("hello"); + args[0] = inputvalue; + Object result = invoker.invokeTarget(args, CeltixInvoker.NONE); + + // Check the input object after processing is correct + // input should be wrapped as Holder type if it is INOUT parameter + Object[] myrtn = (Object[]) inputCtx.getMessageObjects(); + + //FIXME: this does not work for the wrapped doc/lit case due to a bug in Celtix + //assertTrue("input is not Holder type", myrtn[0] instanceof Holder); + } + + // NOTE: For convenience this method presumes the soap service name is + // SOAPService and port name is SoapPort + private CeltixInvoker createCeltixInvoker(String wsdlLocation, + String operationName, + ObjectMessageContextImpl inputCtx) + throws Exception { + + // Make following call to return a mocked SOAPClientBinding: + // bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference) + SOAPClientBinding clientBinding = EasyMock + .createMock(SOAPClientBinding.class); + clientBinding.createObjectContext(); + EasyMock.expectLastCall().andReturn(inputCtx); + clientBinding.invoke(EasyMock.isA(ObjectMessageContextImpl.class), + EasyMock.isA(SCADataBindingCallback.class)); + EasyMock.expectLastCall().andReturn(new ObjectMessageContextImpl()); + EasyMock.replay(clientBinding); + + SOAPBindingFactory bindingFactory = EasyMock.createNiceMock(SOAPBindingFactory.class); + bindingFactory.createClientBinding(EasyMock.isA(EndpointReferenceType.class)); + EasyMock.expectLastCall().andReturn(clientBinding); + EasyMock.replay(bindingFactory); + + BindingManager bindingManager = EasyMock.createNiceMock(BindingManager.class); + String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/"; + bindingManager.getBindingFactory(bindingId); + EasyMock.expectLastCall().andReturn(bindingFactory); + + Bus bus = EasyMock.createNiceMock(Bus.class); + bus.getBindingManager(); + EasyMock.expectLastCall().andReturn(bindingManager); + EasyMock.replay(bindingManager); + EasyMock.replay(bus); + + // Create WSDL Definition + URL url = getClass().getResource(wsdlLocation); + assertNotNull("Could not find wsdl " + url.toString(), url); + + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader reader = factory.newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + InputSource input = new InputSource(url.openStream()); + Definition wsdlDef = reader.readWSDL(url.toString(), input); + QName qName = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService"); + Service wsdlService = wsdlDef.getService(qName); + Port port = wsdlService.getPort("SoapPort"); + + return new CeltixInvoker(operationName, bus, port, wsdlService, wsdlDef, null); + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java new file mode 100644 index 0000000000..c667ed2ba2 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java @@ -0,0 +1,152 @@ +/* + * 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.binding.celtix; + +import java.lang.reflect.Type; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import org.xml.sax.InputSource; + +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundInvocationChain; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; +import org.apache.tuscany.spi.wire.WireService; + +import junit.framework.TestCase; +import org.easymock.classextension.EasyMock; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.bindings.BindingManager; +import static org.objectweb.celtix.bindings.DataBindingCallback.Mode.PARTS; +import org.objectweb.celtix.bindings.ServerBindingEndpointCallback; +import org.objectweb.celtix.bindings.ServerDataBindingCallback; +import org.objectweb.celtix.bus.bindings.soap.SOAPBindingFactory; +import org.objectweb.celtix.bus.bindings.soap.SOAPServerBinding; +import org.objectweb.celtix.context.ObjectMessageContextImpl; +import org.objectweb.celtix.ws.addressing.EndpointReferenceType; + +/** + * @version $Rev$ $Date$ + */ +public class CeltixServiceTestCase extends TestCase { + + public void testGetDataBindingCallback() throws Exception { + CeltixServiceBinding celtixService = createCeltixService(); + Message msg = new MessageImpl(); + msg.setBody("Hello Celtix"); + Interceptor interceptor = EasyMock.createMock(Interceptor.class); + EasyMock.expect(interceptor.invoke(EasyMock.isA(Message.class))).andReturn(msg); + EasyMock.replay(interceptor); + InboundInvocationChain chain = EasyMock.createMock(InboundInvocationChain.class); + EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor); + EasyMock.replay(chain); + Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>(); + Operation<?> op = new Operation<Type>("greetMe", null, null, null); + chains.put(op, chain); + InboundWire wire = EasyMock.createMock(InboundWire.class); + EasyMock.expect(wire.getInvocationChains()).andReturn(chains); + EasyMock.replay(wire); + celtixService.setInboundWire(wire); + QName operationName = new QName("greetMe"); + ObjectMessageContextImpl ctx = new ObjectMessageContextImpl(); + ctx.setMessageObjects(new String[]{"Celtix"}); + ServerDataBindingCallback callback1 = celtixService.getDataBindingCallback(operationName, ctx, PARTS); + assertNotNull(callback1); + + callback1.invoke(ctx); + Message rtn = (Message) ctx.getReturn(); + assertEquals("Hello Celtix", rtn.getBody()); + + } + + @SuppressWarnings({"unchecked"}) + private CeltixServiceBinding createCeltixService() throws Exception { + //Make following call to return a mocked SOAPClientBinding: + //bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference) + SOAPServerBinding serverBinding = EasyMock.createMock(SOAPServerBinding.class); + serverBinding.activate(); + EasyMock.replay(serverBinding); + + //ServerBindingEndpointCallback callback = EasyMock.createNiceMock(ServerBindingEndpointCallback.class); + + SOAPBindingFactory bindingFactory = EasyMock.createNiceMock(SOAPBindingFactory.class); + bindingFactory.createServerBinding(EasyMock.isA(EndpointReferenceType.class), + EasyMock.isA(ServerBindingEndpointCallback.class)); + EasyMock.expectLastCall().andReturn(serverBinding); + EasyMock.replay(bindingFactory); + + BindingManager bindingManager = EasyMock.createNiceMock(BindingManager.class); + String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/"; + bindingManager.getBindingFactory(bindingId); + EasyMock.expectLastCall().andReturn(bindingFactory); + + Bus bus = EasyMock.createNiceMock(Bus.class); + bus.getBindingManager(); + EasyMock.expectLastCall().andReturn(bindingManager); + EasyMock.replay(bindingManager); + EasyMock.replay(bus); + + //Create WSDL Definition + String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl"; + URL url = getClass().getResource(wsdlLocation); + assertNotNull("Could not find wsdl " + url.toString(), url); + + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader reader = factory.newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + InputSource input = new InputSource(url.openStream()); + Definition wsdlDef = reader.readWSDL(url.toString(), input); + Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http", + "SOAPService")); + Port port = wsdlService.getPort("SoapPort"); + + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService); + + //Create mocked InboundWire, for ServiceBindingExtension.getInterface() + InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class); + JavaServiceContract contract = new JavaServiceContract(Greeter.class); + EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes(); + EasyMock.replay(inboundWire); + + //Create mocked WireService, for ServiceBindingExtension.getServiceInstance() + WireService wireService = EasyMock.createNiceMock(WireService.class); + wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class)); + EasyMock.expectLastCall().andReturn(new GreeterImpl()).anyTimes(); + EasyMock.replay(wireService); + + CeltixServiceBinding celtixService = new CeltixServiceBinding("name", null, wsBinding, bus, null); + //Not sure how InboundWire is set to CeltixServiceBinding, is the following way correct? + celtixService.setInboundWire(inboundWire); + celtixService.start(); + + return celtixService; + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java new file mode 100644 index 0000000000..56de472774 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java @@ -0,0 +1,32 @@ +/* + * 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.binding.celtix; + +public interface Greeter { + java.lang.String sayHi(); + + java.lang.String greetMe( + java.lang.String requestType + ); + + void greetMeOneWay( + java.lang.String requestType + ); + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java new file mode 100644 index 0000000000..38237ad81a --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/java/org/apache/tuscany/binding/celtix/GreeterImpl.java @@ -0,0 +1,33 @@ +/* + * 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.binding.celtix; + +public class GreeterImpl implements Greeter { + public java.lang.String sayHi() { + return "sayHi"; + } + + public java.lang.String greetMe(String requestType) { + return "Hello " + requestType; + } + + public void greetMeOneWay(String requestType) { + } + +} diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl new file mode 100644 index 0000000000..e8767988f3 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world.wsdl @@ -0,0 +1,181 @@ +<?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. +--> +<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://objectweb.org/hello_world_soap_http" + xmlns:x1="http://objectweb.org/hello_world_soap_http/types" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <wsdl:types> + <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" + xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://objectweb.org/hello_world_soap_http/types" + elementFormDefault="qualified"> + <simpleType name="MyStringType"> + <restriction base="string"> + <maxLength value="30" /> + </restriction> + </simpleType> + + <element name="sayHi"> + <complexType/> + </element> + <element name="sayHiResponse"> + <complexType> + <sequence> + <element name="responseType" type="string"/> + </sequence> + </complexType> + </element> + <element name="greetMe"> + <complexType> + <sequence> + <element name="requestType" type="tns:MyStringType"/> + </sequence> + </complexType> + </element> + <element name="greetMeResponse"> + <complexType> + <sequence> + <element name="responseType" type="string"/> + </sequence> + </complexType> + </element> + <element name="greetMeOneWay"> + <complexType> + <sequence> + <element name="requestType" type="string"/> + </sequence> + </complexType> + </element> + <element name="pingMe"> + <complexType/> + </element> + <element name="pingMeResponse"> + <complexType/> + </element> + <element name="faultDetail"> + <complexType> + <sequence> + <element name="minor" type="short"/> + <element name="major" type="short"/> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + <wsdl:message name="sayHiRequest"> + <wsdl:part element="x1:sayHi" name="in"/> + </wsdl:message> + <wsdl:message name="sayHiResponse"> + <wsdl:part element="x1:sayHiResponse" name="out"/> + </wsdl:message> + <wsdl:message name="greetMeRequest"> + <wsdl:part element="x1:greetMe" name="in"/> + </wsdl:message> + <wsdl:message name="greetMeResponse"> + <wsdl:part element="x1:greetMeResponse" name="out"/> + </wsdl:message> + <wsdl:message name="greetMeOneWayRequest"> + <wsdl:part element="x1:greetMeOneWay" name="in"/> + </wsdl:message> + <wsdl:message name="pingMeRequest"> + <wsdl:part name="in" element="x1:pingMe"/> + </wsdl:message> + <wsdl:message name="pingMeResponse"> + <wsdl:part name="out" element="x1:pingMeResponse"/> + </wsdl:message> + <wsdl:message name="pingMeFault"> + <wsdl:part name="faultDetail" element="x1:faultDetail"/> + </wsdl:message> + + <wsdl:portType name="Greeter"> + <wsdl:operation name="sayHi"> + <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/> + <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/> + </wsdl:operation> + + <wsdl:operation name="greetMe"> + <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/> + <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/> + </wsdl:operation> + + <wsdl:operation name="greetMeOneWay"> + <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/> + </wsdl:operation> + + <wsdl:operation name="pingMe"> + <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/> + <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/> + <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + + <wsdl:operation name="sayHi"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="sayHiRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="sayHiResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="greetMe"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="greetMeRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="greetMeResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="greetMeOneWay"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="greetMeOneWayRequest"> + <soap:body use="literal"/> + </wsdl:input> + </wsdl:operation> + + <wsdl:operation name="pingMe"> + <soap:operation style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + <wsdl:fault name="pingMeFault"> + <soap:fault name="pingMeFault" use="literal"/> + </wsdl:fault> + </wsdl:operation> + + </wsdl:binding> + <wsdl:serviceDefinition name="SOAPService"> + <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort"> + <soap:address location="http://localhost:9000/SoapContext/SoapPort"/> + </wsdl:port> + </wsdl:serviceDefinition> +</wsdl:definitions> + diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl new file mode 100644 index 0000000000..d1488f987a --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://objectweb.org/hello_world_soap_http" + xmlns:x1="http://objectweb.org/hello_world_soap_http/types" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <wsdl:types> + <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" + xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://objectweb.org/hello_world_soap_http/types" + elementFormDefault="qualified"> + <simpleType name="MyStringType"> + <restriction base="string"> + <maxLength value="30" /> + </restriction> + </simpleType> + + <element name="sayHi"> + <complexType/> + </element> + <element name="sayHiResponse"> + <complexType> + <sequence> + <element name="responseType" type="string"/> + </sequence> + </complexType> + </element> + <element name="greetMe"> + <complexType> + <sequence> + <element name="requestType" type="tns:MyStringType"/> + </sequence> + </complexType> + </element> + <element name="greetMeResponse"> + <complexType> + <sequence> + <element name="responseType" type="string"/> + </sequence> + </complexType> + </element> + <element name="greetMeOneWay"> + <complexType> + <sequence> + <element name="requestType" type="string"/> + </sequence> + </complexType> + </element> + <element name="pingMe"> + <complexType/> + </element> + <element name="pingMeResponse"> + <complexType/> + </element> + <element name="faultDetail"> + <complexType> + <sequence> + <element name="minor" type="short"/> + <element name="major" type="short"/> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + <wsdl:message name="sayHiRequest"> + <wsdl:part element="x1:sayHi" name="in"/> + </wsdl:message> + <wsdl:message name="sayHiResponse"> + <wsdl:part element="x1:sayHiResponse" name="out"/> + </wsdl:message> + <wsdl:message name="greetMeRequest"> + <wsdl:part element="x1:greetMe" name="in"/> + </wsdl:message> + <wsdl:message name="greetMeResponse"> + <wsdl:part element="x1:greetMeResponse" name="out"/> + </wsdl:message> + <wsdl:message name="greetMeOneWayRequest"> + <wsdl:part element="x1:greetMeOneWay" name="in"/> + </wsdl:message> + + <wsdl:portType name="Greeter"> + <wsdl:operation name="sayHi"> + <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/> + <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/> + </wsdl:operation> + + <wsdl:operation name="greetMe"> + <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/> + <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/> + </wsdl:operation> + + <wsdl:operation name="greetMeOneWay"> + <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/> + </wsdl:operation> + + </wsdl:portType> + <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + + <wsdl:operation name="sayHi"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="sayHiRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="sayHiResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="greetMe"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="greetMeRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="greetMeResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="greetMeOneWay"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="greetMeOneWayRequest"> + <soap:body use="literal"/> + </wsdl:input> + </wsdl:operation> + + </wsdl:binding> + <wsdl:service name="SOAPService"> + <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort"> + <soap:address location="http://localhost:9000/SoapContext/SoapPort"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> + diff --git a/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl new file mode 100644 index 0000000000..76f6d8df09 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://objectweb.org/hello_world_soap_http" + xmlns:x1="http://objectweb.org/hello_world_soap_http/types" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <wsdl:types> + <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" + xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://objectweb.org/hello_world_soap_http/types" + elementFormDefault="qualified"> + <simpleType name="MyStringType"> + <restriction base="string"> + <maxLength value="30" /> + </restriction> + </simpleType> + + <element name="sayHi"> + <complexType/> + </element> + <element name="sayHiResponse"> + <complexType> + <sequence> + <element name="responseType" type="string"/> + </sequence> + </complexType> + </element> + <element name="greetMe"> + <complexType> + <sequence> + <element name="requestType" type="tns:MyStringType"/> + </sequence> + </complexType> + </element> + <element name="greetMeResponse"> + <complexType> + <sequence> + <element name="responseType" type="string"/> + </sequence> + </complexType> + </element> + <element name="greetMeOneWay"> + <complexType> + <sequence> + <element name="requestType" type="string"/> + </sequence> + </complexType> + </element> + <element name="pingMe"> + <complexType/> + </element> + <element name="pingMeResponse"> + <complexType/> + </element> + <element name="faultDetail"> + <complexType> + <sequence> + <element name="minor" type="short"/> + <element name="major" type="short"/> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + <wsdl:message name="sayHiRequest"> + <wsdl:part element="x1:sayHi" name="in"/> + </wsdl:message> + <wsdl:message name="sayHiResponse"> + <wsdl:part element="x1:sayHiResponse" name="out"/> + </wsdl:message> + <wsdl:message name="greetMeRequest"> + <wsdl:part element="x1:greetMe" name="in"/> + </wsdl:message> + <wsdl:message name="greetMeResponse"> + <wsdl:part element="x1:greetMe" name="out"/> + </wsdl:message> + <wsdl:message name="greetMeOneWayRequest"> + <wsdl:part element="x1:greetMeOneWay" name="in"/> + </wsdl:message> + <wsdl:message name="pingMeRequest"> + <wsdl:part name="in" element="x1:pingMe"/> + </wsdl:message> + <wsdl:message name="pingMeResponse"> + <wsdl:part name="out" element="x1:pingMeResponse"/> + </wsdl:message> + <wsdl:message name="pingMeFault"> + <wsdl:part name="faultDetail" element="x1:faultDetail"/> + </wsdl:message> + + <wsdl:portType name="Greeter"> + <wsdl:operation name="sayHi"> + <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/> + <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/> + </wsdl:operation> + + <wsdl:operation name="greetMe"> + <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/> + <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/> + </wsdl:operation> + + <wsdl:operation name="greetMeOneWay"> + <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/> + </wsdl:operation> + + <wsdl:operation name="pingMe"> + <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/> + <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/> + <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + + <wsdl:operation name="sayHi"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="sayHiRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="sayHiResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="greetMe"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="greetMeRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="greetMeResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="greetMeOneWay"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="greetMeOneWayRequest"> + <soap:body use="literal"/> + </wsdl:input> + </wsdl:operation> + + <wsdl:operation name="pingMe"> + <soap:operation style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + <wsdl:fault name="pingMeFault"> + <soap:fault name="pingMeFault" use="literal"/> + </wsdl:fault> + </wsdl:operation> + + </wsdl:binding> + <wsdl:service name="SOAPService"> + <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort"> + <soap:address location="http://localhost:9000/SoapContext/SoapPort"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> + diff --git a/sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml b/sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml new file mode 100644 index 0000000000..df8a9483d5 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/binding/tuscany-checkstyle.xml @@ -0,0 +1,288 @@ +<?xml version="1.0"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> + +<!-- +Checks to make sure the code meets the Tuscany coding guidelines +http://java.sun.com/docs/codeconv/index.html + +It also enforces aa bunch of other "BestPractices like method +lengths, if/try depths, etc... + +--> + +<module name="Checker"> + <property name="severity" + value="${checkstyle.severity}" + default="warning"/> + + <!-- Checks whether files end with a new line. --> + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> + <!-- + <module name="NewlineAtEndOfFile"/> + --> + + <!-- Checks that property files contain the same keys. --> + <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> + <module name="Translation"/> + + <!--<module name="StrictDuplicateCode"/>--> + + <module name="TreeWalker"> + + <!-- Checks for Javadoc comments. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html --> + <!-- + <module name="PackageHtml"/> + <module name="JavadocMethod"/> + <module name="JavadocType"/> + <module name="JavadocVariable"/> + <module name="JavadocStyle"/> + --> + + + <!-- Checks for Naming Conventions. --> + <!-- See http://checkstyle.sf.net/config_naming.html --> + <module name="AbstractClassName"> + <property name="format" + value="^Abstract.*$|^.*Factory$|^.*Bus$|^.*ConfigurationRepository$|^.*Base$|^Exception$|^.*Builder$"/> + </module> + <module name="ConstantName"/> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"/> + <module name="MethodName"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + + <!-- Header checks --> + <!-- <module name="Header"/> --> + <!-- <module name="RegexpHeader"/> --> + + + <!-- Checks for imports --> + <!-- See http://checkstyle.sf.net/config_import.html --> + <module name="AvoidStarImport"> + <property name="excludes" + value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework"/> + </module> + <module name="IllegalImport"/> + <!-- defaults to sun.* packages --> + <module name="RedundantImport"/> + <module name="UnusedImports"/> + <module name="ImportOrder"> + <property name="groups" value="java,javax,org.w3c,org.xml,w3c"/> + <property name="ordered" value="true"/> + </module> + <!-- + <module name="ImportControl"> + <property name="file" value="etc/import-control.xml"/> + </module> + --> + + + <!-- Checks for Size Violations. --> + <!-- See http://checkstyle.sf.net/config_sizes.html --> + <module name="AnonInnerLength"> + <property name="max" value="40"/> + </module> + <module name="ExecutableStatementCount"> + <property name="max" value="50"/> + </module> + <module name="FileLength"/> + <module name="LineLength"> + <property name="max" value="115"/> + </module> + <module name="MethodLength"> + <property name="max" value="150"/> + <property name="countEmpty" value="false"/> + </module> + <module name="ParameterNumber"> + <property name="max" value="7"/> + </module> + + <!-- Checks for whitespace --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <module name="EmptyForIteratorPad"/> + <module name="EmptyForInitializerPad"/> + <module name="MethodParamPad"/> + <module name="NoWhitespaceAfter"> + <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/> + </module> + <module name="NoWhitespaceBefore"/> + <module name="OperatorWrap"/> + <module name="ParenPad"/> + <module name="TypecastParenPad"/> + <module name="TabCharacter"/> + <module name="WhitespaceAfter"> + <property name="tokens" value="COMMA, SEMI"/> + </module> + <module name="WhitespaceAround"> + <property name="tokens" + value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/> + </module> + + + <!-- Modifier Checks --> + <!-- See http://checkstyle.sf.net/config_modifiers.html --> + <module name="ModifierOrder"/> + <module name="RedundantModifier"/> + + + <!-- Checks for blocks. You know, those {}'s --> + <!-- See http://checkstyle.sf.net/config_blocks.html --> + <module name="AvoidNestedBlocks"> + <property name="allowInSwitchCase" value="true"/> + </module> + <module name="EmptyBlock"> + <property name="option" value="text"/> + </module> + <module name="LeftCurly"/> + <module name="NeedBraces"/> + <module name="RightCurly"/> + + + <!-- Checks for common coding problems --> + <!-- See http://checkstyle.sf.net/config_coding.html --> + <!--<module name="ArrayTrailingComma"/>--> + <!--<module name="AvoidInlineConditionals"/>--> + <module name="CovariantEquals"/> + <module name="DoubleCheckedLocking"/> + <module name="EmptyStatement"/> + <module name="EqualsHashCode"/> + <!--<module name="FinalLocalVariable"/>--> + <module name="HiddenField"> + <property name="ignoreConstructorParameter" value="true"/> + <property name="ignoreSetter" value="true"/> + <property name="ignoreAbstractMethods" value="true"/> + </module> + <module name="IllegalInstantiation"/> + <!--<module name="IllegalToken"/>--> + <!--<module name="IllegalTokenText"/>--> + <!--<module name="InnerAssignment"/>--> + <!--<module name="MagicNumber"/>--> + <module name="MissingSwitchDefault"/> + <module name="ModifiedControlVariable"/> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + <module name="StringLiteralEquality"/> + <module name="NestedIfDepth"> + <property name="max" value="3"/> + </module> + <module name="NestedTryDepth"> + <property name="max" value="3"/> + </module> + <module name="SuperClone"/> + <module name="SuperFinalize"/> + <!--<module name="IllegalCatch"/>--> + <module name="IllegalThrows"> + <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/> + </module> + <!--<module name="RedundantThrows"/>--> + <module name="PackageDeclaration"/> + <module name="JUnitTestCase"/> + <module name="ReturnCount"> + <property name="max" value="6"/> + </module> + + <module name="IllegalType"> + <property name="format" value="^xxx$"/> + </module> + <module name="DeclarationOrder"/> + <!--<module name="ParameterAssignment"/>--> + <module name="ExplicitInitialization"/> + <module name="DefaultComesLast"/> + <!--<module name="MissingCtor"/>--> + <module name="FallThrough"/> + <!--<module name="MultipleStringLiterals"/>--> + <module name="MultipleVariableDeclarations"/> + <!--<module name="RequireThis"/>--> + <module name="UnnecessaryParentheses"/> + + + <!-- Checks for class design --> + <!-- See http://checkstyle.sf.net/config_design.html --> + <!--<module name="DesignForExtension"/>--> + <module name="FinalClass"/> + <module name="HideUtilityClassConstructor"/> + <module name="InterfaceIsType"/> + <module name="MutableException"/> + <module name="ThrowsCount"> + <property name="max" value="5"/> + </module> + <module name="VisibilityModifier"> + <property name="protectedAllowed" value="true"/> + <property name="packageAllowed" value="true"/> + </module> + + + <!-- Metrics checks. --> + <!-- See http://checkstyle.sf.net/config_metrics.html --> + <module name="BooleanExpressionComplexity"> + <property name="max" value="6"/> + </module> + <!--<module name="ClassDataAbstractionCoupling"/>--> + <!--<module name="ClassFanOutComplexity"/>--> + <!--<module name="CyclomaticComplexity"/>--> + <!--<module name="NPathComplexity"/>--> + <module name="JavaNCSS"> + <property name="methodMaximum" value="75"/> + </module> + + + <!-- Miscellaneous other checks. --> + <!-- See http://checkstyle.sf.net/config_misc.html --> + <!-- + <module name="ArrayTypeStyle"/> + <module name="FinalParameters"/> + --> + <!-- + <module name="GenericIllegalRegexp"> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + --> + <module name="TodoComment"> + <property name="format" value="WARNING"/> + </module> + + <module name="UpperEll"/> + + <!--Assert statement may have side effects:--> + <module name="DescendantToken"> + <property name="tokens" value="LITERAL_ASSERT"/> + <property name="limitedTokens" + value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/> + <property name="maximumNumber" value="0"/> + </module> + + <!--<module name="UncommentedMain"/>--> + <module name="TrailingComment"/> + <module name="Indentation"> + <property name="caseIndent" value="0"/> + </module> + <!--<module name="RequiredRegexp">--> + </module> + +</module> diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off new file mode 100644 index 0000000000..697232e97f --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/pom.xml.off @@ -0,0 +1,70 @@ +<?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.samples.sca</groupId> + <artifactId>parent</artifactId> + <version>1.0-incubator-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <artifactId>sample-helloworldws-celtix</artifactId> + <packaging>jar</packaging> + <name>Tuscany HelloWorld Celtix Web Service Sample</name> + <description>A sample HelloWorld Web Service.</description> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca.kernel</groupId> + <artifactId>core</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>test</artifactId> + <version>${tuscanyVersion}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca.services.bindings</groupId> + <artifactId>celtix</artifactId> + <version>${pom.version}</version> + <scope>provided</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>helloworld.HelloWorldClient</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm new file mode 100644 index 0000000000..6d3210d097 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/readme.htm @@ -0,0 +1,141 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> + <!-- * 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. --> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta http-equiv="Content-Style-Type" content="text/css"> + <title>Tuscany Hello World Celtix Web Service Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --><!-- maven --> + <style type="text/css" media="all"> + @import url("../../../../css/maven-base.css"); + @import url("../../../../css/maven-theme.css"); + @import url("../../../../css/site.css"); + </style> + <link rel="stylesheet" href="./css/print.css" type="text/css" media="print"> + <!-- end maven --> +</head> + <body> + <h2>Tuscany Hello World Celtix Web service Sample</h2> <h3>Overview</h3> + <p> + The Tuscany hello world Celtix Web service sample shows using the Tuscany SCA runtime as a standalone web service. + </p> + <h3>Location</h3> This sample is located in the samples\sca\helloworldws-celtix + directory.<br> + + + <h3>Setup</h3>This sample depends on the Tuscany runtime, Celtix, and the sample jar, + + <span style="font-weight: bold;"> + sample-helloworldws-celtix-incubating-M1.jar + </span> + +, all of these must be available on the classpath to run the sample. + +<h3>Running</h3> + + In the directory samples/sca/helloworldws-celtix use the JDK 1.5 java command to run the class helloworld.HelloWorldServer + + <pre>Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre> + <pre>Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre> + + <h3>Code Overview</h3> The source files are physically organized as shown below:<br> + <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"> + <tbody> + <tr> + <td> + <pre> + +---main + +---java + ¦ +---helloworld + ¦ HelloWorldServer.java + ¦ HelloWorldImpl.java + ¦ HelloWorldService.java + +---resources + ¦ sca.module + +---wsdl + helloworld.wsdl + </pre> + </td> + </tr> + </tbody> + </table> + <br> + <br> + <table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2"> + <tbody> + <tr> + <td>HelloWorldServer.java</td> + <td>Main method to startup the Tuscany runtime which will startup the services defined in sca.module</td> + </tr> + <tr> + <td style="vertical-align: top;">HelloWorldService.java</td> + <td>Defines the Java interface implemented by the component.</td> + </tr> + <tr> + <td style="vertical-align: top;">HelloWorldImpl.java</td> + <td>Implements the SCA component. Uses the SCA service annotation + tag on the class to show what SCA interface is being implemented.</td> + </tr> + <tr> + <td style="vertical-align: top; height: 62px;">sca.module</td> + <td style="height: 62px;">Defines the SCA module, entryPoint and component. + Defines for the HelloWorldServiceComponent component and the Java class that + implements the component For the entryPoint it defines WSDL for the service, the + Java interface provided by the service, and wires the service to the HelloWorldServiceComponent</td> + </tr> + <tr> + <td>helloworld.wsdl</td> + <td>WSDL for the service.</td> + </tr> + </tbody> + </table> + + <h3>Instrumentation</h3> + You can instrument Celtix runtime using Celtix management facilities. + Information in the Celtix configuration file is used to configure the behavior of Celtix management facilities. + When JMX is enabled, Celtix instrumentation info is exported through the JMX MBeanServer. To enable JMX ( + JMX is disabled in Celtix by default), you need to pass in a Celtix configuration file by running the sample using command below: + <br> + <br> + + In the directory samples/sca/helloworldws-celtix use the JDK 1.5 java command to run the class helloworld.HelloWorldServer + + <pre>Linux: java -Dceltix.config.file=file:///<Tuscany-installation-dir>/samples/sca/helloworldws-celtix/server.xml -cp ../../../lib/tuscany-runtime-incubating-M1.jar:../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre> + <pre>Windows: java -Dceltix.config.file=file:///<Tuscany-installation-dir>/samples/sca/helloworldws-celtix/server.xml -cp ../../../lib/tuscany-runtime-incubating-M1.jar;../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer</pre> + +<Tuscany-installation-dir> is the location where Tuscany installed. + <br> + <br> + +You can use jconsole, which comes with JDK1.5, to explore the Celtix managed components: + + <pre>jconsole</pre> + + The server JMX Service URL is: + <pre>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server</pre> + + +NOTE: Enter the JMX service URL as above, leave the username and password empty in this sample. + <br> + <br> + +Further information about Celtix instrumentation can be found from Celtix "Using Celtix Management" manual and Celtix management sample. + + +<br> + </body> +</html>
\ No newline at end of file diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat new file mode 100755 index 0000000000..fa24c84328 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/run.bat @@ -0,0 +1,10 @@ +echo on +rem set java_debug_set=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y +mkdir target\standalone +pushd target\standalone +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\standalone\1.0-SNAPSHOT\standalone-1.0-SNAPSHOT-bin.zip" +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\celtix\1.0-SNAPSHOT\celtix-1.0-SNAPSHOT-bin.zip" +popd +move target\standalone\extension\*.jar target\standalone\boot +copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\celtix\1.0-SNAPSHOT\celtix-1.0-SNAPSHOT.jar" target\standalone\extension +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldws-celtix\1.0-SNAPSHOT\sample-helloworldws-celtix-1.0-SNAPSHOT.jar" %* diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml new file mode 100644 index 0000000000..94c9efe897 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/server.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE beans SYSTEM + "http://celtix.objectweb.org/configuration/spring/celtix-spring-beans.dtd"> + +<beans + xmlns:ct="http://celtix.objectweb.org/configuration/types" + xmlns:sec="http://celtix.objectweb.org/bus/configuration/security" + xmlns:im-conf="http://celtix.objectweb.org/bus/instrumentation/instrumentation-config" + xmlns:im="http://celtix.objectweb.org/bus/instrumentation" +> + + <bean id="celtix.Instrumentation" + class="org.objectweb.celtix.bus.instrumentation.instrumentation_config.spring.InstrumentationConfigBean"> + <property name="instrumentationControl"> + <value> + <im:instrumentation> + <im:InstrumentationEnabled>true</im:InstrumentationEnabled> + <im:JMXEnabled>true</im:JMXEnabled> + </im:instrumentation> + </value> + </property> + <property name="MBServer"> + <value> + <im:MBServer> + <im:JMXConnector> + <im:Threaded>true</im:Threaded> + <im:Daemon>false</im:Daemon> + <im:JMXServiceURL>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server</im:JMXServiceURL> + </im:JMXConnector> + </im:MBServer> + </value> + </property> + </bean> +</beans> + diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..f9781fb48d --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to create an SCA runtime, start it, locate the Eager Init service and invoke it. + */ +public final class HelloWorldClient { + private HelloWorldClient() { + } + + public static void main(String[] args) throws Exception { + String name = "World"; + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + + // Locate the Eager init service + HelloWorldService helloWorldService = + compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + + // Invoke the HelloWorld service + String value = helloWorldService.getGreetings(name); + + System.out.println(value); + System.out.flush(); + + } +} diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0de3c70303 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8f23acd645 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + String getGreetings(String name); + +} diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..281cdd37ab --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,41 @@ +<?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. + --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworldws"> + + <service name="HelloWorldWebService" target="http:///foo"> + <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/ --> + <interface.java interface="helloworld.HelloWorldService"/> + + +<!--FIXME the location attribute is a really bad hack here! does not follow to spec at all +--> + <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" + conformanceURIs="http://ws-i.org/profiles/basic/1.1" + location="wsdl/helloworld.wsdl" + /> + + <reference>HelloWorldServiceComponent</reference> + </service> + + <component name="HelloWorldServiceComponent"> + <implementation.java class="helloworld.HelloWorldImpl"/> + </component> + +</composite> diff --git a/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..21781bfc7f --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/samples/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,77 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + --> +<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="helloworld"> + + <wsdl:types> + <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="getGreetings"> + <complexType> + <sequence> + <element name="name" type="xsd:string"/> + </sequence> + </complexType> + </element> + + <element name="getGreetingsResponse"> + <complexType> + <sequence> + <element name="getGreetingsReturn" type="xsd:string"/> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + + <wsdl:message name="getGreetingsRequest"> + <wsdl:part element="tns:getGreetings" name="parameters"/> + </wsdl:message> + + <wsdl:message name="getGreetingsResponse"> + <wsdl:part element="tns:getGreetingsResponse" name="parameters"/> + </wsdl:message> + + <wsdl:portType name="HelloWorld"> + <wsdl:operation name="getGreetings"> + <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/> + <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="getGreetings"> + <wsdlsoap:operation soapAction=""/> + <wsdl:input name="getGreetingsRequest"> + <wsdlsoap:body use="literal"/> + </wsdl:input> + <wsdl:output name="getGreetingsResponse"> + <wsdlsoap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + + <wsdl:service name="HelloWorldService"> + <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort"> + <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldWebService"/> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> diff --git a/sandbox/old/contrib/binding-celtix/sunjars/build.xml b/sandbox/old/contrib/binding-celtix/sunjars/build.xml new file mode 100644 index 0000000000..e6fec45356 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/sunjars/build.xml @@ -0,0 +1,56 @@ +<?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 name="CeltixSunJarsInstaller"> + <target name="checkinstalled"> + <condition property="already.installed" > + <and> + <available file="${localRepository}/javax/annotation/jsr250-api/2.0-JAXWS-2.0-EA3/jsr250-api-2.0-JAXWS-2.0-EA3.jar"/> + <available file="${localRepository}/javax/jws/jsr181-api/2.0-JAXWS-2.0-EA3/jsr181-api-2.0-JAXWS-2.0-EA3.jar"/> + <available file="${localRepository}/javax/xml/jaxws-api/2.0-JAXWS-2.0-EA3/jaxws-api-2.0-JAXWS-2.0-EA3.jar"/> + <available file="${localRepository}/com/sun/xml/saaj-impl/1.3/saaj-impl-1.3.jar"/> + <available file="${localRepository}/javax/xml/saaj-api/1.3/saaj-api-1.3.jar"/> + </and> + </condition> + <condition property="maven.suffix" value=""> + <os family="unix"/> + </condition> + <condition property="maven.suffix" value=".bat"> + <os family="windows"/> + </condition> + </target> + + <target name="installJars" depends="checkinstalled" unless="already.installed"> + <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> + <arg line="install:install-file -DgroupId=javax.annotation -DartifactId=jsr250-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jsr250-api-2.0-JAXWS-2.0-EA3.jar"/> + </exec> + <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> + <arg line="install:install-file -DgroupId=javax.jws -DartifactId=jsr181-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jsr181-api-2.0-JAXWS-2.0-EA3.jar"/> + </exec> + <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> + <arg line="install:install-file -DgroupId=javax.xml -DartifactId=jaxws-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jaxws-api-2.0-JAXWS-2.0-EA3.jar"/> + </exec> + <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> + <arg line="install:install-file -DgroupId=javax.xml -DartifactId=saaj-api -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/saaj-api-1.3.jar"/> + </exec> + <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> + <arg line="install:install-file -DgroupId=com.sun.xml -DartifactId=saaj-impl -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/saaj-impl-1.3.jar"/> + </exec> + </target> +</project> diff --git a/sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off b/sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off new file mode 100644 index 0000000000..6ec8efb384 --- /dev/null +++ b/sandbox/old/contrib/binding-celtix/sunjars/pom.xml.off @@ -0,0 +1,102 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.tuscany.sca.services.bindings</groupId> + <artifactId>parent</artifactId> + <version>1.0-incubator-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>sunjars</artifactId> + <packaging>pom</packaging> + <name>Project to install the Sun jars</name> + + <properties> + <celtix.version>1.0</celtix.version> + </properties> + <repositories> + <repository> + <id>objectweb</id> + <name>ObjectWeb repo</name> + <url>http://maven.objectweb.org/maven2</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <build> + <plugins> + <!-- This is a "hack" to overcome the Sun jar issue. Basically, we download a + complete celtix install kit (epl version) and then extract the Sun jars that we + need and install them. We use the dependency plugin to download it from the + objectweb snapshot mirror, then use antrun to fork a build.xml that will conditionally + call mvn to install the jars if they aren't already there. --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>dependency-maven-plugin</artifactId> + <executions> + <execution> + <id>getdeps</id> + <phase>validate</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/celtix-install</outputDirectory> + <artifactItems> + <artifactItem> + <groupId>org.objectweb.celtix</groupId> + <artifactId>celtix-distribution</artifactId> + <version>${celtix.version}</version> + <classifier>bin-epl</classifier> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>install</id> + <phase>install</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <ant target="installJars"> + <property name="localRepository" value="${settings.localRepository}"/> + </ant> + </tasks> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> |