From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/extensions/axis2/binding/.ruleset | 190 +++ .../sca/extensions/axis2/binding/LICENSE.txt | 202 +++ .../sca/extensions/axis2/binding/NOTICE.txt | 14 + .../sca/extensions/axis2/binding/pom.xml | 146 ++ .../axis2/binding/src/main/assembly/axis2.xml | 38 + .../binding/axis2/Axis2AsyncTargetInvoker.java | 94 ++ .../tuscany/binding/axis2/Axis2BindingBuilder.java | 331 +++++ .../axis2/Axis2BindingBuilderRuntimeException.java | 65 + .../axis2/Axis2BindingRunTimeException.java | 48 + .../axis2/Axis2CallbackInvocationHandler.java | 50 + .../binding/axis2/Axis2OneWayTargetInvoker.java | 72 + .../binding/axis2/Axis2ReferenceBinding.java | 194 +++ .../binding/axis2/Axis2ReferenceCallback.java | 56 + .../axis2/Axis2ReferenceCallbackTargetInvoker.java | 114 ++ .../tuscany/binding/axis2/Axis2ServiceBinding.java | 390 ++++++ .../axis2/Axis2ServiceCallbackTargetInvoker.java | 120 ++ .../axis2/Axis2ServiceInMessageReceiver.java | 68 + .../Axis2ServiceInOutAsyncMessageReceiver.java | 91 ++ .../Axis2ServiceInOutSyncMessageReceiver.java | 117 ++ .../tuscany/binding/axis2/Axis2ServiceServlet.java | 211 +++ .../tuscany/binding/axis2/Axis2TargetInvoker.java | 186 +++ .../tuscany/binding/axis2/TuscanyDispatcher.java | 79 ++ .../binding/axis2/WebServiceBindingDefinition.java | 210 +++ .../binding/axis2/WebServiceBindingLoader.java | 244 ++++ .../axis2/util/TuscanyAxisConfigurator.java | 44 + .../axis2/util/WebServiceOperationMetaData.java | 491 +++++++ .../binding/axis2/util/WebServicePortMetaData.java | 377 ++++++ .../main/resources/META-INF/sca/binding.axis2.scdl | 48 + .../src/main/resources/META-INF/sca/default.scdl | 49 + .../resources/META-INF/sca/extension.composite | 22 + .../tuscany/binding/axis2/engine/config/axis2.xml | 306 +++++ .../binding/axis2/Axis2BindingBuilderTestCase.java | 229 ++++ .../binding/axis2/Axis2ReferenceTestCase.java | 111 ++ .../binding/axis2/Axis2ServiceTestCase.java | 153 +++ .../org/apache/tuscany/binding/axis2/Greeter.java | 31 + .../tuscany/binding/axis2/GreetingCallback.java | 24 + .../axis2/WebServicebindingLoaderTestCase.java | 187 +++ .../test/resources/wsdl/hello_world_doc_lit.wsdl | 151 +++ .../sca/extensions/axis2/databinding/.ruleset | 172 +++ .../sca/extensions/axis2/databinding/LICENSE.txt | 202 +++ .../sca/extensions/axis2/databinding/NOTICE.txt | 14 + .../sca/extensions/axis2/databinding/pom.xml | 78 ++ .../databinding/axiom/AxiomDataBinding.java | 67 + .../databinding/axiom/AxiomExceptionHandler.java | 60 + .../tuscany/databinding/axiom/AxiomHelper.java | 64 + .../databinding/axiom/OMElement2Object.java | 40 + .../databinding/axiom/OMElement2String.java | 62 + .../axiom/OMElement2XMLStreamReader.java | 50 + .../databinding/axiom/OMElementWrapperHandler.java | 70 + .../databinding/axiom/Object2OMElement.java | 55 + .../databinding/axiom/String2OMElement.java | 60 + .../axiom/XMLStreamReader2OMElement.java | 63 + .../resources/META-INF/sca/databinding.axiom.scdl | 57 + .../src/main/resources/META-INF/sca/default.scdl | 56 + .../resources/META-INF/sca/extension.composite | 22 + .../axiom/AxiomExceptionHandlerTestCase.java | 107 ++ .../databinding/axiom/OMElementTestCase.java | 103 ++ .../axis2/databinding/src/test/resources/ipo.xml | 33 + .../axis2/databinding/src/test/resources/ipo.xsd | 118 ++ .../databinding/src/test/resources/order.wsdl | 58 + .../sca/extensions/axis2/itests/old-style/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/OldStyleReference.composite | 37 + .../src/main/resources/OldStyleService.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../apache/tuscany/sca/itest/OldStyleTestCase.java | 65 + .../sca/extensions/axis2/itests/pom.xml | 41 + .../axis2/itests/service-explicit-uri/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/client.composite | 36 + .../src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../sca/itest/ServiceExplicitURITestCase.java | 65 + .../axis2/itests/service-relative-uri/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/client.composite | 36 + .../src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../sca/itest/ServiceRelativeURITestCase.java | 65 + .../sca/extensions/axis2/itests/simplest/pom.xml | 89 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../simplest/src/main/resources/client.composite | 36 + .../simplest/src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../apache/tuscany/sca/itest/SimplestTestCase.java | 65 + .../extensions/axis2/itests/wsdl-binidng/pom.xml | 90 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/java/helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/client.composite | 37 + .../src/main/resources/service.composite | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 80 ++ .../apache/tuscany/sca/itest/HelloWorldServer.java | 49 + .../sca/itest/WsdlElementBindingTestCase.java | 67 + .../extensions/axis2/plugins/java2wsdl/LICENSE.txt | 1407 ++++++++++++++++++++ .../extensions/axis2/plugins/java2wsdl/NOTICE.txt | 14 + .../sca/extensions/axis2/plugins/java2wsdl/pom.xml | 46 + .../java2wsdl/plugin/Java2WSDLGeneratorMojo.java | 153 +++ .../sca/extensions/axis2/plugins/pom.xml | 39 + .../extensions/axis2/plugins/wsdl2java/LICENSE.txt | 1407 ++++++++++++++++++++ .../extensions/axis2/plugins/wsdl2java/NOTICE.txt | 14 + .../sca/extensions/axis2/plugins/wsdl2java/pom.xml | 46 + .../wsdl2java/plugin/WSDL2JavaGeneratorMojo.java | 152 +++ .../tools/wsdl2java/plugin/WSDLFileOption.java | 92 ++ .../sca/extensions/axis2/pom.xml | 181 +++ .../axis2/samples/calculator-ws/LICENSE.txt | 202 +++ .../axis2/samples/calculator-ws/NOTICE.txt | 14 + .../extensions/axis2/samples/calculator-ws/pom.xml | 76 ++ .../axis2/samples/calculator-ws/readme.html | 103 ++ .../src/main/resources/calculator.wsdl | 58 + .../src/main/webapp/WEB-INF/default.scdl | 35 + .../calculator-ws/src/main/webapp/WEB-INF/web.xml | 22 + .../samples/calculator-ws/src/main/webapp/calc.jsp | 43 + .../calculator-ws/src/main/webapp/index.html | 5 + .../axis2/samples/helloworld-async-ws/.ruleset | 172 +++ .../axis2/samples/helloworld-async-ws/pom.xml | 76 ++ .../axis2/samples/helloworld-async-ws/readme.htm | 66 + .../axis2/samples/helloworld-async-ws/setup.bat | 16 + .../main/java/helloworld/HelloWorldCallback.java | 27 + .../src/main/java/helloworld/HelloWorldImpl.java | 63 + .../main/java/helloworld/HelloWorldService.java | 43 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/wsdl/helloworld.wsdl | 180 +++ .../src/main/webapp/META-INF/sca/default.scdl | 48 + .../webapp/META-INF/tuscany/binding.axis2.scdl | 44 + .../webapp/META-INF/tuscany/databinding.axiom.scdl | 51 + .../webapp/META-INF/tuscany/databinding.sdo.scdl | 60 + .../webapp/META-INF/tuscany/interface.wsdl.scdl | 44 + .../src/main/webapp/META-INF/tuscany/webapp.scdl | 149 +++ .../src/main/webapp/WEB-INF/web.xml | 51 + .../samples/helloworld-async-wsclient/pom.xml | 80 ++ .../samples/helloworld-async-wsclient/run.bat | 53 + .../helloworld-async-wsclient/run_celtix.bat | 16 + .../main/java/helloworld/HelloWorldCallback.java | 27 + .../src/main/java/helloworld/HelloWorldClient.java | 40 + .../src/main/java/helloworld/HelloWorldLocal.java | 33 + .../main/java/helloworld/HelloWorldService.java | 38 + .../helloworld/HelloWorldServiceComponent.java | 58 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/META-INF/sca/default.scdl | 46 + .../src/main/resources/logging.properties | 29 + .../src/main/resources/wsdl/helloworld.wsdl | 152 +++ .../java/helloworld/HelloWorldWSAsyncClient.java | 46 + .../META-INF/tuscany/test-extensions.scdl | 28 + .../axis2/samples/helloworld-om-ws/pom.xml | 94 ++ .../axis2/samples/helloworld-om-ws/readme.htm | 48 + .../axis2/samples/helloworld-om-ws/setup.bat | 16 + .../main/java/helloworld/om/HelloWorldImpl.java | 45 + .../main/java/helloworld/om/HelloWorldServer.java | 28 + .../main/java/helloworld/om/HelloWorldService.java | 36 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/helloworldws-om.composite | 34 + .../src/main/resources/wsdl/helloworld-om.wsdl | 78 ++ .../helloworld/om/HelloWorldServerTestCase.java | 44 + .../axis2/samples/helloworld-om-wsclient/pom.xml | 95 ++ .../axis2/samples/helloworld-om-wsclient/run.bat | 53 + .../main/java/helloworld/om/HelloWorldClient.java | 84 ++ .../main/java/helloworld/om/HelloWorldService.java | 34 + .../helloworld/om/HelloWorldServiceComponent.java | 47 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/helloworldwsclient-om.composite | 34 + .../src/main/resources/logging.properties | 27 + .../src/main/resources/wsdl/helloworld-om.wsdl | 78 ++ .../helloworld/om/HelloWorldClientTestCase.java | 72 + .../java/helloworld/om/HelloWorldServerTest.java | 44 + .../axis2/samples/helloworld-oneway-ws/pom.xml | 136 ++ .../src/main/java/greeter/GreeterImpl.java | 31 + .../src/main/java/greeter/GreeterService.java | 31 + .../src/main/resources/wsdl/greeter.wsdl | 64 + .../src/main/webapp/META-INF/sca/default.scdl | 40 + .../webapp/META-INF/tuscany/binding.axis2.scdl | 44 + .../webapp/META-INF/tuscany/databinding.axiom.scdl | 51 + .../webapp/META-INF/tuscany/databinding.sdo.scdl | 60 + .../webapp/META-INF/tuscany/interface.wsdl.scdl | 44 + .../src/main/webapp/META-INF/tuscany/webapp.scdl | 148 ++ .../src/main/webapp/WEB-INF/web.xml | 51 + .../samples/helloworld-oneway-wsclient/pom.xml | 96 ++ .../src/main/java/greeter/GreeterClient.java | 36 + .../src/main/java/greeter/GreeterImpl.java | 37 + .../src/main/java/greeter/GreeterLocal.java | 24 + .../src/main/java/greeter/GreeterService.java | 30 + .../src/main/resources/META-INF/sca/default.scdl | 42 + .../src/main/resources/wsdl/greeter.wsdl | 64 + .../test/java/greeter/GreeterWSOneWayClient.java | 58 + .../META-INF/tuscany/test-extensions.scdl | 28 + .../extensions/axis2/samples/helloworld-ws/pom.xml | 83 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../src/main/java/helloworld/HelloWorldServer.java | 28 + .../main/java/helloworld/HelloWorldService.java | 33 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/helloworldws.composite | 33 + .../src/main/resources/system.composite | 36 + .../src/main/resources/wsdl/helloworld.wsdl | 79 ++ .../java/helloworld/HelloWorldServerTestCase.java | 48 + .../axis2/samples/helloworld-wsclient/pom.xml | 87 ++ .../src/main/java/helloworld/HelloWorldClient.java | 41 + .../main/java/helloworld/HelloWorldService.java | 28 + .../helloworld/HelloWorldServiceComponent.java | 43 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/helloworldwsclient.composite | 37 + .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 79 ++ .../java/helloworld/HelloWorldClientTestCase.java | 65 + .../test/java/helloworld/HelloWorldServerTest.java | 46 + .../axis2/samples/loanapplication-ws/pom.xml | 85 ++ .../java/loanappconversation/LoanApplication.java | 35 + .../main/java/loanappconversation/LoanService.java | 40 + .../java/loanappconversation/LoanServiceImpl.java | 69 + .../main/resources/wsdl/loanappconversation.wsdl | 271 ++++ .../src/main/webapp/WEB-INF/default.scdl | 41 + .../src/main/webapp/WEB-INF/web.xml | 51 + .../axis2/samples/loanapplication-wsclient/pom.xml | 85 ++ .../LoanAppConversationClient.java | 57 + .../java/loanappconversation/LoanApplication.java | 35 + .../main/java/loanappconversation/LoanClient.java | 30 + .../java/loanappconversation/LoanClientImpl.java | 63 + .../main/java/loanappconversation/LoanService.java | 40 + .../src/main/resources/META-INF/sca/default.scdl | 40 + .../main/resources/wsdl/loanappconversation.wsdl | 271 ++++ .../LoanAppConversationTestCase.java | 63 + .../sca/extensions/axis2/samples/pom.xml | 121 ++ .../sca/extensions/axis2/tools/java2wsdl/pom.xml | 164 +++ .../java2wsdl/generate/GenerationParameters.java | 435 ++++++ .../tools/java2wsdl/generate/Java2WSDL.java | 81 ++ .../java2wsdl/generate/Java2WSDLGenerator.java | 46 + .../generate/Java2WSDLGeneratorFactory.java | 89 ++ .../java2wsdl/generate/Java2WSDLGeneratorImpl.java | 239 ++++ .../tools/java2wsdl/generate/SchemaBuilder.java | 524 ++++++++ .../java2wsdl/generate/TuscanyJava2OMBuilder.java | 521 ++++++++ .../generate/TuscanyJava2WSDLBuilder.java | 81 ++ .../generate/TuscanyJava2WSDLConstants.java | 51 + .../generate/TuscanyJava2WSDLOptionsValidator.java | 74 + .../java2wsdl/generate/TuscanySchemaGenerator.java | 410 ++++++ .../tools/java2wsdl/generate/TuscanyTypeTable.java | 225 ++++ .../generate/TuscanyWSDLTypesGenerator.java | 373 ++++++ .../tools/java2wsdl/generate/WSDLGenEvent.java | 38 + .../tools/java2wsdl/generate/WSDLGenListener.java | 39 + .../tuscany/tools/java2wsdl/util/XMLNameUtil.java | 143 ++ .../wsdl2java/generate/JavaInterfaceEmitter.java | 222 +++ .../wsdl2java/generate/JavaInterfaceGenerator.java | 230 ++++ .../generate/RemotableInterfaceWritter.java | 53 + .../generate/SDODataBindingCodegenExtension.java | 63 + .../generate/SDODataBindingTypeMappingEntry.java | 51 + .../wsdl2java/generate/WSDL2JavaGenerator.java | 349 +++++ .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../java2wsdl/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/RemotableInterfaceTemplate.xsl | 116 ++ .../tools/java2wsdl/generate/CustomerValue.java | 43 + .../java2wsdl/generate/CustomerWithAccount.java | 49 + .../generate/TuscanyJava2WSDLTestCase.java | 108 ++ .../tools/java2wsdl/generate/account/Account.java | 53 + .../java2wsdl/generate/customer/Customer.java | 30 + .../java2wsdl/generate/extra/GoldCustomer.java | 36 + .../generate/WSDL2JavaGeneratorTestCase.java | 44 + .../java/org/soapinterop/CreditScoreDocLit.java | 25 + .../src/test/resources/AccountService.wsdl | 242 ++++ .../src/test/resources/CreditScoreDocLit.wsdl | 76 ++ .../java2wsdl/src/test/resources/helloworld.wsdl | 121 ++ .../java2wsdl/src/test/resources/interopdoc.wsdl | 180 +++ .../java2wsdl/src/test/resources/sequences.xsd | 100 ++ .../sca/extensions/axis2/tools/pom.xml | 131 ++ .../sca/extensions/axis2/tools/wsdl2java/pom.xml | 164 +++ .../java2wsdl/generate/GenerationParameters.java | 435 ++++++ .../tools/java2wsdl/generate/Java2WSDL.java | 81 ++ .../java2wsdl/generate/Java2WSDLGenerator.java | 46 + .../generate/Java2WSDLGeneratorFactory.java | 89 ++ .../java2wsdl/generate/Java2WSDLGeneratorImpl.java | 239 ++++ .../tools/java2wsdl/generate/SchemaBuilder.java | 524 ++++++++ .../java2wsdl/generate/TuscanyJava2OMBuilder.java | 521 ++++++++ .../generate/TuscanyJava2WSDLBuilder.java | 81 ++ .../generate/TuscanyJava2WSDLConstants.java | 51 + .../generate/TuscanyJava2WSDLOptionsValidator.java | 74 + .../java2wsdl/generate/TuscanySchemaGenerator.java | 410 ++++++ .../tools/java2wsdl/generate/TuscanyTypeTable.java | 225 ++++ .../generate/TuscanyWSDLTypesGenerator.java | 373 ++++++ .../tools/java2wsdl/generate/WSDLGenEvent.java | 38 + .../tools/java2wsdl/generate/WSDLGenListener.java | 39 + .../tuscany/tools/java2wsdl/util/XMLNameUtil.java | 143 ++ .../wsdl2java/generate/JavaInterfaceEmitter.java | 222 +++ .../wsdl2java/generate/JavaInterfaceGenerator.java | 230 ++++ .../generate/RemotableInterfaceWritter.java | 53 + .../generate/SDODataBindingCodegenExtension.java | 63 + .../generate/SDODataBindingTypeMappingEntry.java | 51 + .../wsdl2java/generate/WSDL2JavaGenerator.java | 357 +++++ .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++++++++++++++++ .../wsdl2java/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../main/resources/RemotableInterfaceTemplate.xsl | 116 ++ .../tools/java2wsdl/generate/CustomerValue.java | 43 + .../java2wsdl/generate/CustomerWithAccount.java | 49 + .../generate/TuscanyJava2WSDLTestCase.java | 108 ++ .../tools/java2wsdl/generate/account/Account.java | 53 + .../java2wsdl/generate/customer/Customer.java | 30 + .../java2wsdl/generate/extra/GoldCustomer.java | 36 + .../generate/WSDL2JavaGeneratorTestCase.java | 65 + .../java/org/soapinterop/CreditScoreDocLit.java | 25 + .../src/test/resources/AccountService.wsdl | 242 ++++ .../src/test/resources/CreditScoreDocLit.wsdl | 76 ++ .../wsdl2java/src/test/resources/helloworld.wsdl | 121 ++ .../wsdl2java/src/test/resources/interopdoc.wsdl | 180 +++ .../wsdl2java/src/test/resources/sequences.xsd | 100 ++ 326 files changed, 41950 insertions(+) create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml create mode 100755 branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd create mode 100644 branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm create mode 100755 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml create mode 100755 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl create mode 100644 branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd (limited to 'branches/sca-java-integration/sca/extensions/axis2') diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset b/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset new file mode 100644 index 0000000000..70a035bc01 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset @@ -0,0 +1,190 @@ + + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/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/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt b/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/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/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml new file mode 100755 index 0000000000..d54d0558ad --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml @@ -0,0 +1,146 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-axis2 + Apache Tuscany Binding for Axis2 + Implementation of the SCA Web Services binding using Axis2 + + + + org.apache.tuscany.sca.kernel + tuscany-spi + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + ${scaKernelVersion} + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${extensionVersion} + runtime + + + + javax.servlet + servlet-api + 2.5 + + + + org.apache.axis2 + axis2-kernel + + + + org.apache.ws.commons.axiom + axiom-api + + + + org.apache.ws.commons.axiom + axiom-impl + + + + incubator-woden + woden + + + + org.codehaus.woodstox + wstx-asl + + + + commons-logging + commons-logging + + + + org.apache.neethi + neethi + + + + org.apache.ws.commons.schema + XmlSchema + + + + commons-httpclient + commons-httpclient + + + + javax.mail + mail + + + + backport-util-concurrent + backport-util-concurrent + + + + commons-codec + commons-codec + + + + httpcomponents-httpcore + jakarta-httpcore + + + + + org.easymock + easymock + + + + junit + junit + 4.2 + test + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml new file mode 100644 index 0000000000..7c835caa5c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml @@ -0,0 +1,38 @@ + + + + bin + false + + zip + tar.gz + + + + + extension + + org.apache.tuscany.bindings:axis2 + + 644 + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java new file mode 100644 index 0000000000..90f37ba5fa --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.LinkedList; +import java.util.concurrent.CountDownLatch; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; + +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; + +public class Axis2AsyncTargetInvoker extends Axis2TargetInvoker { + + private Axis2ReferenceCallbackTargetInvoker callbackInvoker; + + public Axis2AsyncTargetInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory, WorkContext workContext) { + super(serviceClient, wsdlOperationName, options, soapFactory, workContext); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + throw new InvocationTargetException(new InvocationRuntimeException("Operation not supported")); + } + + private Object invokeTarget(final Object payload, LinkedList callbackRoutingChain) + throws InvocationTargetException { + try { + Object[] args = (Object[]) payload; + OperationClient operationClient = createOperationClient(args); + callbackInvoker.setCallbackRoutingChain(callbackRoutingChain); + Axis2ReferenceCallback callback = new Axis2ReferenceCallback(callbackInvoker); + operationClient.setCallback(callback); + + // FIXME Synchronize with callback thread to get return value + CountDownLatch doneSignal = new CountDownLatch(1); + callbackInvoker.setSignal(doneSignal); + + operationClient.execute(false); + + try { + doneSignal.await(); + } catch(InterruptedException e) { + e.printStackTrace(); + } + + // FIXME returning value from callback thread + Object response = callbackInvoker.getReturnPayload(); + return response; + } catch (AxisFault e) { + throw new InvocationTargetException(e); + } + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), msg.getCallbackRoutingChain()); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public void setCallbackTargetInvoker(Axis2ReferenceCallbackTargetInvoker callbackInvoker) { + this.callbackInvoker = callbackInvoker; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java new file mode 100755 index 0000000000..56725fdf3e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java @@ -0,0 +1,331 @@ +/* + * 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.axis2; + +import java.net.URI; + +import javax.wsdl.Port; +import javax.wsdl.PortType; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector; +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.builder.BuilderConfigException; +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.component.WorkContext; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.BindingBuilderExtension; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.idl.InvalidServiceContractException; +import org.apache.tuscany.spi.model.AbstractReferenceDefinition; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.model.ServiceDefinition; +import org.apache.tuscany.spi.wire.IncompatibleServiceContractException; + +/** + * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.ReferenceBinding} configured + * with the Axis2 binding + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings("deprecation") +public class Axis2BindingBuilder extends BindingBuilderExtension { + private static final String OM_DATA_BINDING = OMElement.class.getName(); + + // TODO: what to do about the base URI? + private static final String BASE_URI = "http://localhost:8080/"; + + private ServletHost servletHost; + + private ConfigurationContext configContext; + + private InterfaceWSDLIntrospector introspector; + + private WorkContext workContext; + + private WSDLDefinitionRegistry wsdlReg; + + public Axis2BindingBuilder() throws BuilderConfigException { + initAxis(); + } + + @Autowire(required = false) + public void setServletHost(ServletHost servletHost) { + this.servletHost = servletHost; + } + + /** + * @param introspector the introspector to set + */ + @Autowire + public void setIntrospector(InterfaceWSDLIntrospector introspector) { + this.introspector = introspector; + } + + @Autowire + public void setWorkContext(WorkContext workContext) { + this.workContext = workContext; + } + + @Autowire + public void setWSDLDefinitionRegistry(WSDLDefinitionRegistry wsdlReg) { + this.wsdlReg = wsdlReg; + } + + @SuppressWarnings("unchecked") + public ServiceBinding build( + CompositeComponent parent, + ServiceDefinition serviceDefinition, + WebServiceBindingDefinition wsBinding, DeploymentContext deploymentContext) { + + try { + // Set the default databinding + ServiceContract outboundContract = serviceDefinition.getServiceContract(); + if (outboundContract instanceof WSDLServiceContract) { + outboundContract.setDataBinding(OM_DATA_BINDING); + } + + // TODO: TUSCANY-1148, with no wsdl only works with + if (wsBinding.getWSDLDefinition() == null) { + if (outboundContract instanceof WSDLServiceContract) { + String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI(); + wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns)); + } else { + throw new IllegalStateException(" with no WSDL requires using "); + } + } + + // FIXME: We need to define how the WSDL PortType is honored in the case that + // both the service.ws and interface.wsdl are in place. + // The WSDL portType from the WSDL Port decides the incoming SOAP message format + // There are also cases that interface.java is used. + + ServiceContract inboundContract; + Port port = wsBinding.getWSDLPort(); + if (port == null) { + // FIXME: [rfeng] No WSDL is referenced by service.ws, we need to create one from + // the outbound service contract if it's JavaServiceContract + inboundContract = outboundContract; + } + + PortType portType = wsBinding.getWSDLPort().getBinding().getPortType(); + inboundContract = introspector.introspect(portType); + + // FIXME: + inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass()); + inboundContract.setDataBinding(OM_DATA_BINDING); + inboundContract.setCallbackName(serviceDefinition.getServiceContract().getCallbackName()); + inboundContract.setInteractionScope(serviceDefinition.getServiceContract().getInteractionScope()); + try { + wireService.checkCompatibility(inboundContract, outboundContract, true); + } catch (IncompatibleServiceContractException e) { + throw new Axis2BindingBuilderRuntimeException(e); + } + + String axisServiceName; + if (wsBinding.isSpec10Compliant()) { + wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, serviceDefinition.getTarget(), serviceDefinition.getName(), parent)); + axisServiceName = wsBinding.getActualURI().getPath(); + if (axisServiceName != null && axisServiceName.length() > 1 && axisServiceName.startsWith("/")) { + axisServiceName = axisServiceName.substring(1); + } + } else { + axisServiceName = serviceDefinition.getName(); + } + + ServiceBinding serviceBinding = + new Axis2ServiceBinding(axisServiceName, outboundContract, inboundContract, parent, wsBinding, + servletHost, configContext, workContext); + return serviceBinding; + + } catch (InvalidServiceContractException e) { + throw new Axis2BindingBuilderRuntimeException(e); + } + } + + @SuppressWarnings("unchecked") + public ReferenceBinding build( + CompositeComponent parent, + AbstractReferenceDefinition boundReferenceDefinition, + WebServiceBindingDefinition wsBinding, + DeploymentContext deploymentContext) { + + // Set the default binding + ServiceContract inboundContract = boundReferenceDefinition.getServiceContract(); + if (inboundContract instanceof WSDLServiceContract) { + inboundContract.setDataBinding(OM_DATA_BINDING); + } + + // TODO: TUSCANY-1148, with no wsdl only works with + if (wsBinding.getWSDLDefinition() == null) { + if (inboundContract instanceof WSDLServiceContract) { + String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI(); + wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns)); + } else { + throw new IllegalStateException(" with no WSDL requires using "); + } + } + + // FIXME: We need to define how the WSDL PortType is honored in the case that + // both the binding.ws and interface.wsdl are in place + // The WSDL portType from the WSDL Port decides the incoming SOAP message format + + ServiceContract outboundContract = inboundContract; + Port port = wsBinding.getWSDLPort(); + if (port == null) { + // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from + // the inbound service contract if it's JavaServiceContract + outboundContract = inboundContract; + } + PortType portType = port.getBinding().getPortType(); + try { + outboundContract = introspector.introspect(portType); + } catch (InvalidServiceContractException e) { + new Axis2BindingBuilderRuntimeException(e); + } + + // Set the default databinding + outboundContract.setDataBinding(OM_DATA_BINDING); + //FIXME ... need to figure out how to specify scope on wsdl. + outboundContract.setInteractionScope(inboundContract.getInteractionScope()); + + try { + wireService.checkCompatibility(inboundContract, outboundContract, true); + } catch (IncompatibleServiceContractException e) { + throw new Axis2BindingBuilderRuntimeException(e); + } + + if (wsBinding.isSpec10Compliant()) { + wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, null, boundReferenceDefinition.getName(), null)); + } + + return new Axis2ReferenceBinding(boundReferenceDefinition.getName(), parent, wsBinding, + inboundContract, outboundContract, workContext); + + } + + protected Class getBindingType() { + return WebServiceBindingDefinition.class; + } + + protected void initAxis() throws BuilderConfigException { + // TODO: consider having a system component wrapping the Axis2 ConfigContext + try { + this.configContext = new TuscanyAxisConfigurator().getConfigurationContext(); + } catch (AxisFault e) { + throw new BuilderConfigException(e); + } + } + + /** + * Compute the endpoint URI based on section 2.1.1 of the WS binding spec + * 1. The URIs in the endpoint(s) of the referenced WSDL, which may be relative + * 2. The URI specified by the wsa:Address element of the wsa:EndpointReference, which may be relative + * 3. The explicitly stated URI in the "uri" attribute of the binding.ws element, which may be relative, + * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec + * If the has no wsdlElement but does have a uri attribute then the uri takes precidence + * over any implicitly used WSDL. + * @param parent + */ + protected URI computeActualURI(WebServiceBindingDefinition wsBinding, String baseURI, URI componentURI, String bindingName, CompositeComponent parent) { + URI wsdlURI = null; + if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) { + // explicitly points at a wsdl port, may be a relative URI + wsdlURI = wsBinding.getPortURI(); + } + if (wsdlURI != null && wsdlURI.isAbsolute()) { + if (wsBinding.getURI() != null && (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null)) { + throw new IllegalArgumentException("binding URI cannot be used with absolute WSDL endpoint URI"); + } + return URI.create(wsdlURI.toString()); + } + + // there is no wsdl port endpoint URI or that URI is relative + + URI bindingURI = null; + if (wsBinding.getURI() != null) { + bindingURI = URI.create(wsBinding.getURI()); + } + + if (bindingURI != null && bindingURI.isAbsolute()) { + if (wsdlURI != null) { + return URI.create(bindingURI + "/" + wsdlURI).normalize(); + } else { + return bindingURI; + } + } + + if (componentURI == null) { // null for references + wsdlURI = wsBinding.getPortURI(); + if (bindingURI != null) { + return URI.create(wsdlURI + "/" + bindingURI).normalize(); + } else { + return wsdlURI; + } + } + + + // TODO: TUSCANY-xxx, how to tell if component has multiple services using ? + // boolean singleService = (parent != null) && (((Component)parent.getChild(componentURI.toString())).getInboundWires().size() == 1); + // if (bindingURI == null && !singleService) { + + if (bindingURI == null) { + bindingURI = URI.create(bindingName); + } + + if (componentURI.isAbsolute()) { + if (bindingURI == null && wsdlURI == null) { + return componentURI; + } else if (wsdlURI == null) { + return URI.create(componentURI + "/" + bindingURI).normalize(); + } else if (bindingURI == null) { + return URI.create(componentURI + "/" + wsdlURI).normalize(); + } else { + return URI.create(componentURI + "/" + bindingURI + "/" + wsdlURI).normalize(); + } + } + + String actualURI = ""; + + if (bindingURI == null) { + actualURI = baseURI + "/" + componentURI + "/"; + } else { + actualURI = baseURI + "/" + componentURI + "/" + bindingURI + "/"; + } + + if (wsdlURI != null) { + actualURI = actualURI + wsdlURI.toString(); + } + + if (actualURI.endsWith("/")) { + actualURI = actualURI.substring(0, actualURI.length() -1); + } + + // normalize to handle any . or .. occurances + return URI.create(actualURI).normalize(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java new file mode 100644 index 0000000000..a5743668a4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.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.axis2; + + +/** + * Base class for Exceptions raised during the loading process. Loader implementations should throw a subclass of this + * to indicate the actual problem. + * + * @version $Rev$ $Date$ + */ +public class Axis2BindingBuilderRuntimeException extends Axis2BindingRunTimeException { + private static final long serialVersionUID = -7459051598906813461L; + private String resourceURI; + + public Axis2BindingBuilderRuntimeException() { + } + + public Axis2BindingBuilderRuntimeException(String message) { + super(message); + } + + public Axis2BindingBuilderRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public Axis2BindingBuilderRuntimeException(Throwable cause) { + super(cause); + } + + /** + * Returns the location of the resource that was being loaded. + * + * @return the location of the resource that was being loaded + */ + public String getResourceURI() { + return resourceURI; + } + + /** + * Sets the location of the resource that was being loaded. + * + * @param resourceURI the location of the resource that was being loaded + */ + public void setResourceURI(String resourceURI) { + this.resourceURI = resourceURI; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java new file mode 100644 index 0000000000..cd957c2ec6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java @@ -0,0 +1,48 @@ +/* + * 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.axis2; + +import org.apache.tuscany.api.TuscanyRuntimeException; + +/** + * Denotes an error creating a new object instance + * + * @version $Rev$ $Date$ + */ +public class Axis2BindingRunTimeException extends TuscanyRuntimeException { + private static final long serialVersionUID = -6423113430265944499L; + + public Axis2BindingRunTimeException() { + super(); + } + + public Axis2BindingRunTimeException(String message) { + super(message); + } + + public Axis2BindingRunTimeException(String message, Throwable cause) { + super(message, cause); + } + + public Axis2BindingRunTimeException(Throwable cause) { + super(cause); + } + +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java new file mode 100644 index 0000000000..e9aefa7320 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java @@ -0,0 +1,50 @@ +/* + * 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.axis2; + +import java.util.LinkedList; +import java.util.Map; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.AbstractOutboundInvocationHandler; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.TargetInvoker; + +public class Axis2CallbackInvocationHandler extends AbstractOutboundInvocationHandler { + + private InboundWire inboundWire; + + public Axis2CallbackInvocationHandler(InboundWire inboundWire) { + this.inboundWire = inboundWire; + } + + public Object invoke(Operation operation, Object[] args, LinkedList callbackRoutingChain) throws Throwable { + Object targetAddress = callbackRoutingChain.removeFirst(); + if (targetAddress == null) { + throw new AssertionError("Popped a null from address from stack"); + } + //TODO optimize as this is slow in local invocations + Map, OutboundInvocationChain> sourceCallbackInvocationChains = + inboundWire.getSourceCallbackInvocationChains(targetAddress); + OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation); + TargetInvoker invoker = chain.getTargetInvoker(); + return invoke(chain, invoker, args, null, callbackRoutingChain); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java new file mode 100644 index 0000000000..23d0fa56de --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.binding.axis2; + +import java.lang.reflect.InvocationTargetException; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; + +public class Axis2OneWayTargetInvoker extends Axis2TargetInvoker { + + protected static final OMElement RESPONSE = null; + + public Axis2OneWayTargetInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory, WorkContext workContext) { + + super(serviceClient, wsdlOperationName, options, soapFactory, workContext); + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + try { + Object[] args = (Object[]) payload; + OperationClient operationClient = createOperationClient(args); + + operationClient.execute(false); + + // REVIEW it seems ok to return null + return RESPONSE; + } catch (AxisFault e) { + throw new InvocationTargetException(e); + } catch (Throwable t) { + throw new Axis2BindingRunTimeException(t); + } + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java new file mode 100755 index 0000000000..b0ee16ba3a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java @@ -0,0 +1,194 @@ +/* + * 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.axis2; + +import java.util.Collection; +import javax.wsdl.Definition; +import javax.xml.namespace.QName; + +import static org.osoa.sca.Constants.SCA_NS; + +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.WorkContext; +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 org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; + +/** + * Axis2Reference uses Axis2 to invoke a remote web service + */ +public class Axis2ReferenceBinding extends ReferenceBindingExtension { + private static final QName BINDING_WS = new QName(SCA_NS, "binding.ws"); + + private WebServicePortMetaData wsPortMetaData; + private ServiceClient serviceClient; + private WorkContext workContext; + + @SuppressWarnings("unchecked") + public Axis2ReferenceBinding(String theName, + CompositeComponent parent, + WebServiceBindingDefinition wsBinding, + ServiceContract contract, + ServiceContract bindingServiceContract, + WorkContext workContext) { + super(theName, parent); + this.bindingServiceContract = bindingServiceContract; + this.workContext = workContext; + try { + Definition wsdlDefinition = wsBinding.getWSDLDefinition(); + if (wsBinding.isSpec10Compliant()) { + wsPortMetaData = + new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getActualURI().toString(), false); + } else { + wsPortMetaData = + new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false); + } + serviceClient = createServiceClient(wsdlDefinition, wsPortMetaData); + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + } + + public QName getBindingType() { + return BINDING_WS; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) { + Axis2TargetInvoker invoker; + try { + boolean operationHasCallback = contract.getCallbackName() != null; + if (operationHasCallback) { + // FIXME: SDODataBinding needs to pass in TypeHelper and classLoader + // as parameters. + Axis2AsyncTargetInvoker asyncInvoker = + (Axis2AsyncTargetInvoker) createOperationInvoker(serviceClient, + operation, + wsPortMetaData, + true, + false); + // FIXME: This makes the (BIG) assumption that there is only one + // callback method + // Relaxing this assumption, however, does not seem to be trivial, + // it may depend on knowledge + // of what actual callback method was invoked by the service at the + // other end + Operation callbackOperation = findCallbackOperation(); + Axis2CallbackInvocationHandler invocationHandler = + new Axis2CallbackInvocationHandler(inboundWire); + Axis2ReferenceCallbackTargetInvoker callbackInvoker = + new Axis2ReferenceCallbackTargetInvoker(callbackOperation, inboundWire, invocationHandler); + asyncInvoker.setCallbackTargetInvoker(callbackInvoker); + + invoker = asyncInvoker; + } else { + boolean isOneWay = operation.isNonBlocking(); + invoker = createOperationInvoker(serviceClient, operation, wsPortMetaData, false, isOneWay); + } + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + return invoker; + } + + private Operation findCallbackOperation() { + ServiceContract contract = inboundWire.getServiceContract(); + Operation callbackOperation = null; + Collection callbackOperations = contract.getCallbackOperations().values(); + if (callbackOperations.size() != 1) { + throw new Axis2BindingRunTimeException("Can only handle one callback operation"); + } else { + callbackOperation = (Operation) callbackOperations.iterator().next(); + } + return callbackOperation; + } + + /** + * Create an Axis2 ServiceClient + */ + private ServiceClient createServiceClient(Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData) + throws AxisFault { + + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); + ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); + QName serviceQName = wsPortMetaData.getServiceName(); + String portName = wsPortMetaData.getPortName().getLocalPart(); + AxisService axisService = + AxisService.createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options()); + return new ServiceClient(configurationContext, axisService); + } + + /** + * Create and configure an Axis2TargetInvoker for each operations + */ + private Axis2TargetInvoker createOperationInvoker(ServiceClient serviceClient, + Operation m, + WebServicePortMetaData wsPortMetaData, + boolean hasCallback, + boolean isOneWay) throws AxisFault { + SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory(); + String portTypeNS = wsPortMetaData.getPortTypeName().getNamespaceURI(); + + String methodName = m.getName(); + + WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName); + + Options options = new Options(); + options.setTo(new EndpointReference(wsPortMetaData.getEndpoint())); + options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE); + + String wsdlOperationName = operationMetaData.getBindingOperation().getOperation().getName(); + + String soapAction = wsPortMetaData.getOperationMetaData(wsdlOperationName).getSOAPAction(); + if (soapAction != null && soapAction.length() > 1) { + options.setAction(soapAction); + } + + options.setTimeOutInMilliSeconds(5 * 60 * 1000); + + QName wsdlOperationQName = new QName(portTypeNS, wsdlOperationName); + + Axis2TargetInvoker invoker; + if (hasCallback) { + invoker = + new Axis2AsyncTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext); + } else if (isOneWay) { + invoker = + new Axis2OneWayTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext); + } else { + invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext); + } + + return invoker; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java new file mode 100644 index 0000000000..ca129ca1cc --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java @@ -0,0 +1,56 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.client.async.AsyncResult; +import org.apache.axis2.client.async.Callback; +import org.apache.axis2.context.MessageContext; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.TargetInvoker; + +public class Axis2ReferenceCallback extends Callback { + + private Axis2ReferenceCallbackTargetInvoker targetInvoker; + + public Axis2ReferenceCallback(Axis2ReferenceCallbackTargetInvoker targetInvoker) { + this.targetInvoker = targetInvoker; + } + + public void onComplete(AsyncResult result) { + MessageContext responseMC = result.getResponseMessageContext(); + OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement(); + try { + targetInvoker.invokeTarget(new Object[] {responseOM}, TargetInvoker.NONE); + } catch (InvocationTargetException e) { + // FIXME what is the appropriate exception here? + throw new InvocationRuntimeException(e); + } + } + + public void setComplete(boolean complete) { + super.setComplete(complete); + } + + public void onError(Exception e) { + throw new InvocationRuntimeException(e); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java new file mode 100644 index 0000000000..cdc975b54e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java @@ -0,0 +1,114 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.LinkedList; +import java.util.concurrent.CountDownLatch; + +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +public class Axis2ReferenceCallbackTargetInvoker implements TargetInvoker { + + private Operation operation; + private InboundWire inboundWire; + private LinkedList callbackRoutingChain; + private boolean cacheable; + Axis2CallbackInvocationHandler invocationHandler; + private CountDownLatch signal; + private Object returnPayload; + + public Axis2ReferenceCallbackTargetInvoker(Operation operation, + InboundWire inboundWire, + Axis2CallbackInvocationHandler invocationHandler) { + + this.operation = operation; + this.inboundWire = inboundWire; + this.invocationHandler = invocationHandler; + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + Object[] args; + if (payload != null && !payload.getClass().isArray()) { + args = new Object[]{payload}; + returnPayload = payload; + } else { + args = (Object[]) payload; + returnPayload = args[0]; + } + // FIXME synchronize with forward thread to return value + signal.countDown(); + try { + return invocationHandler.invoke(operation, args, callbackRoutingChain); + } catch (Throwable t) { + t.printStackTrace(); + throw new InvocationTargetException(t); + } + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBodyWithFault(e.getCause()); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public boolean isCacheable() { + return cacheable; + } + + public void setCacheable(boolean cacheable) { + this.cacheable = cacheable; + } + + public boolean isOptimizable() { + return isCacheable(); // we only need to check if the scopes are correct + } + + public Axis2ReferenceCallbackTargetInvoker clone() throws CloneNotSupportedException { + Axis2ReferenceCallbackTargetInvoker invoker = (Axis2ReferenceCallbackTargetInvoker) super.clone(); + invoker.operation = this.operation; + invoker.inboundWire = this.inboundWire; + invoker.callbackRoutingChain = this.callbackRoutingChain; + invoker.cacheable = this.cacheable; + invoker.invocationHandler = this.invocationHandler; + return invoker; + } + + public void setCallbackRoutingChain(LinkedList callbackRoutingChain) { + this.callbackRoutingChain = callbackRoutingChain; + } + + public void setSignal(CountDownLatch signal) { + this.signal = signal; + } + + public Object getReturnPayload() { + return returnPayload; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java new file mode 100755 index 0000000000..d7e04ca917 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java @@ -0,0 +1,390 @@ +/* + * 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.axis2; + +import static org.osoa.sca.Constants.SCA_NS; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CountDownLatch; + +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.description.WSDLToAxisServiceBuilder; +import org.apache.axis2.engine.MessageReceiver; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; +import org.apache.tuscany.spi.builder.BuilderConfigException; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.component.TargetInvokerCreationException; +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.extension.ServiceBindingExtension; +import org.apache.tuscany.spi.host.ServletHost; +import org.apache.tuscany.spi.model.InteractionScope; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.Interceptor; +import org.apache.tuscany.spi.wire.InvocationChain; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.MessageImpl; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.osoa.sca.annotations.Destroy; + +// org.apache.tuscany.spi.model +/** + * An implementation of a {@link ServiceBindingExtension} configured with the Axis2 binding + * + * @version $Rev$ $Date$ + */ +public class Axis2ServiceBinding extends ServiceBindingExtension { + private static final QName BINDING_WS = new QName(SCA_NS, "binding.ws"); + + private ServiceContract serviceContract; + + private ServletHost servletHost; + + private ConfigurationContext configContext; + + private WebServiceBindingDefinition binding; + + private Map invCtxMap = new HashMap(); + + private String serviceName; + + private WorkContext workContext; + + private Boolean conversational = null; + + private Set seenConversations = Collections.synchronizedSet(new HashSet()); + + public Axis2ServiceBinding(String theName, + ServiceContract serviceContract, + ServiceContract serviceBindingContract, + CompositeComponent parent, + WebServiceBindingDefinition binding, + ServletHost servletHost, + ConfigurationContext configContext, + WorkContext workContext) { + + super(theName, parent); + + this.serviceContract = serviceContract; + this.bindingServiceContract = serviceBindingContract; + this.binding = binding; + this.servletHost = servletHost; + this.configContext = configContext; + this.serviceName = theName; + this.workContext = workContext; + } + + public void start() { + super.start(); + + try { + configContext.getAxisConfiguration().addService(createAxisService(binding)); + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + + Axis2ServiceServlet servlet = new Axis2ServiceServlet(); + servlet.init(configContext); + configContext.setContextRoot(getName()); + if (binding.isSpec10Compliant()) { + // TODO: TUSCANY-xxx, sort out what to do with system base URI etc + servletHost.registerMapping(binding.getActualURI().getPath(), servlet); + } else { + servletHost.registerMapping("/services/" + getName(), servlet); + } + } + + @Destroy + public void stop() { + if (binding.isSpec10Compliant()) { + servletHost.unregisterMapping(binding.getActualURI().getPath()); + } else { + servletHost.unregisterMapping("/services/" + getName()); + } + try { + configContext.getAxisConfiguration().removeService(getName()); + } catch (AxisFault e) { + throw new Axis2BindingRunTimeException(e); + } + super.stop(); + } + + private AxisService createAxisService(WebServiceBindingDefinition wsBinding) throws AxisFault { + Definition definition = wsBinding.getWSDLDefinition(); + WebServicePortMetaData wsdlPortInfo = + new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false); + + // TODO investigate if this is 20 wsdl what todo? + WSDLToAxisServiceBuilder builder = + new WSDL11ToAxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort() + .getName()); + builder.setServerSide(true); + AxisService axisService = builder.populateService(); + + axisService.setName(this.getName()); + axisService.setServiceDescription("Tuscany configured AxisService for service: '" + this.getName() + + "'"); + + // Use the existing WSDL + Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null); + wsdlParam.setValue(definition); + axisService.addParameter(wsdlParam); + Parameter userWSDL = new Parameter("useOriginalwsdl", "true"); + axisService.addParameter(userWSDL); + + PortType wsdlPortType = wsdlPortInfo.getPortType(); + for (Object o : wsdlPortType.getOperations()) { + Operation wsdlOperation = (Operation) o; + String operationName = wsdlOperation.getName(); + QName operationQN = new QName(definition.getTargetNamespace(), operationName); + + org.apache.tuscany.spi.model.Operation op = serviceContract.getOperations().get(operationName); + + MessageReceiver msgrec = null; + boolean opIsNonBlocking = op.isNonBlocking(); + if (serviceContract.getCallbackName() != null) { + msgrec = new Axis2ServiceInOutAsyncMessageReceiver(this, op); + } else if (opIsNonBlocking) { + msgrec = new Axis2ServiceInMessageReceiver(this, op); + } else { + msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op); + } + + AxisOperation axisOp = axisService.getOperation(operationQN); + if (opIsNonBlocking) { + axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_ONLY); + } else { + axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_OUT); + } + axisOp.setMessageReceiver(msgrec); + } + + return axisService; + } + + public Object invokeTarget(org.apache.tuscany.spi.model.Operation op, Object[] args, Object messageId, + String conversationID) + throws InvocationTargetException { + InvocationChain chain = inboundWire.getInvocationChains().get(op); + Interceptor headInterceptor = chain.getHeadInterceptor(); + String oldConversationID = (String) workContext.getIdentifier(Scope.CONVERSATION); + if (isConversational() && conversationID != null) { + workContext.setIdentifier(Scope.CONVERSATION, conversationID); + } else { + workContext.clearIdentifier(Scope.CONVERSATION); + } + try { + if (headInterceptor == null) { + // short-circuit the dispatch and invoke the target directly + TargetInvoker targetInvoker = chain.getTargetInvoker(); + if (targetInvoker == null) { + throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]"); + } + return targetInvoker.invokeTarget(args, TargetInvoker.NONE); + } else { + + Message msg = new MessageImpl(); + msg.setTargetInvoker(chain.getTargetInvoker()); + msg.pushFromAddress(getFromAddress()); + if (messageId != null) { + msg.setMessageId(messageId); + } + msg.setBody(args); + Message resp; + + if (isConversational()) { + + + int opSeq = op.getConversationSequence(); + if (opSeq == org.apache.tuscany.spi.model.Operation.CONVERSATION_END) { + assert seenConversations + .contains(conversationID) : "End of conversation called when no conversation existed"; + msg.setConversationSequence(TargetInvoker.END); + seenConversations.remove(conversationID); //if a fault occurs does the conversation end? + //how do I know if a component called locally another opeation that ended this conversation? + + } else { + boolean ec = seenConversations.contains(conversationID); + if (ec) { + + msg.setConversationSequence(TargetInvoker.CONTINUE); + } else { + seenConversations.add(conversationID); + msg.setConversationSequence(TargetInvoker.START); + } + } + + } + // dispatch the wire down the chain and get the response + resp = headInterceptor.invoke(msg); + Object body = resp.getBody(); + if (resp.isFault()) { + throw new InvocationTargetException((Throwable) body); + } + return body; + } + } finally { + if (null != oldConversationID) { + workContext.setIdentifier(Scope.CONVERSATION, conversationID); + } else { + workContext.clearIdentifier(Scope.CONVERSATION); + } + } + } + + protected Object getFromAddress() { + return this.serviceName; + } + + /** + * Get the Method from an interface matching the WSDL operation name + */ + protected Method getMethod(Class serviceInterface, String operationName) throws BuilderConfigException { + // 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; + } + } + throw new BuilderConfigException("no operation named " + operationName + + " found on service interface: " + + serviceInterface.getName()); + } + + public QName getBindingType() { + return BINDING_WS; + } + + public TargetInvoker createTargetInvoker(ServiceContract contract, org.apache.tuscany.spi.model.Operation operation) + throws TargetInvokerCreationException { + if (!operation.isCallback()) { + throw new UnsupportedOperationException(); + } else { + return new Axis2ServiceCallbackTargetInvoker(this); + } + } + + public void addMapping(Object msgId, InvocationContext invCtx) { + this.invCtxMap.put(msgId, invCtx); + } + + public InvocationContext retrieveMapping(Object msgId) { + return this.invCtxMap.get(msgId); + } + + public void removeMapping(Object msgId) { + this.invCtxMap.remove(msgId); + } + + /** + * @param inMC + * @return + */ + protected static String getConversationID(MessageContext inMC) { + String conversationID = null; + Iterator i = inMC.getEnvelope().getHeader() + .getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing", "From")); + for (; i.hasNext();) { + Object a = i.next(); + if (a instanceof OMElement) { + OMElement ao = (OMElement) a; + for (Iterator rpI = + ao.getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing", "ReferenceParameters")); + rpI.hasNext();) { + OMElement rpE = (OMElement) rpI.next(); + for ( + Iterator cidI = rpE.getChildrenWithName(WebServiceBindingDefinition.CONVERSATION_ID_REFPARM_QN); + cidI.hasNext();) { + OMElement cidE = (OMElement) cidI.next(); + conversationID = cidE.getText(); + } + } + + } + + } + return conversationID; + } + + protected class InvocationContext { + public MessageContext inMessageContext; + + public org.apache.tuscany.spi.model.Operation operation; + + public SOAPFactory soapFactory; + + public CountDownLatch doneSignal; + + public InvocationContext(MessageContext messageCtx, + org.apache.tuscany.spi.model.Operation operation, + SOAPFactory soapFactory, + CountDownLatch doneSignal) { + this.inMessageContext = messageCtx; + this.operation = operation; + this.soapFactory = soapFactory; + this.doneSignal = doneSignal; + } + } + + WorkContext getWorkContext() { + return workContext; + } + + boolean isConversational() { + if (conversational == null) { + conversational = serviceContract.getInteractionScope() == InteractionScope.CONVERSATIONAL; + + } + return conversational; + } + + @Override + public boolean allowsPassByReference() { + return true; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java new file mode 100644 index 0000000000..7ec4a13669 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java @@ -0,0 +1,120 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.engine.AxisEngine; +import org.apache.axis2.util.Utils; +import org.apache.tuscany.binding.axis2.Axis2ServiceBinding.InvocationContext; + +public class Axis2ServiceCallbackTargetInvoker implements TargetInvoker { + + private Axis2ServiceBinding service; + + protected static final OMElement RESPONSE = null; + + public Axis2ServiceCallbackTargetInvoker(Axis2ServiceBinding service) { + this.service = service; + } + + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + throw new InvocationTargetException(new InvocationRuntimeException("Operation not supported")); + } + + private Object invokeTarget(final Object payload, Object correlationId) throws InvocationTargetException { + try { + // Use current correlation id as index to retrieve inv context + InvocationContext invCtx = service.retrieveMapping(correlationId); + + MessageContext outMC = Utils.createOutMessageContext(invCtx.inMessageContext); + outMC.getOperationContext().addMessageContext(outMC); + + OMElement responseOM; + if (payload != null && !payload.getClass().isArray()) { + responseOM = (OMElement) payload; + } else { + responseOM = (OMElement) ((Object[]) payload)[0]; + } + SOAPEnvelope soapEnvelope = invCtx.soapFactory.getDefaultEnvelope(); + soapEnvelope.getBody().addChild(responseOM); + outMC.setEnvelope(soapEnvelope); + outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); + + AxisEngine engine = + new AxisEngine( + invCtx.inMessageContext.getOperationContext().getServiceContext().getConfigurationContext()); + engine.send(outMC); + + invCtx.doneSignal.countDown(); + + service.removeMapping(correlationId); + } catch (AxisFault e) { + throw new InvocationTargetException(e); + } catch (Throwable t) { + throw new Axis2BindingRunTimeException(t); + } + + return RESPONSE; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object correlationId = msg.getCorrelationId(); + if (correlationId == null) { + throw new InvocationRuntimeException("Missing correlation id"); + } + Object resp = invokeTarget(msg.getBody(), correlationId); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Axis2ServiceCallbackTargetInvoker clone() throws CloneNotSupportedException { + try { + return (Axis2ServiceCallbackTargetInvoker) 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/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java new file mode 100644 index 0000000000..53b85ea887 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java @@ -0,0 +1,68 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInMessageReceiver; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; + +public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver { + + protected Operation operation; + + private Axis2ServiceBinding axis2Service; + + public Axis2ServiceInMessageReceiver(Axis2ServiceBinding service, Operation operation) { + this.axis2Service = service; + this.operation = operation; + } + + public Axis2ServiceInMessageReceiver() { + + } + + @Override + public void invokeBusinessLogic(MessageContext inMC) throws AxisFault { + try { + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + String conversationID = axis2Service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null; + + axis2Service.invokeTarget(operation, args, null, conversationID); + + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new InvocationRuntimeException(e); + } catch (Throwable t) { + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new Axis2BindingRunTimeException(t); + } + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java new file mode 100644 index 0000000000..9d7b711701 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java @@ -0,0 +1,91 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.CountDownLatch; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractMessageReceiver; +import org.apache.tuscany.binding.axis2.Axis2ServiceBinding.InvocationContext; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.MessageId; + +public class Axis2ServiceInOutAsyncMessageReceiver extends AbstractMessageReceiver { + + private Operation operation; + + private Axis2ServiceBinding service; + + public Axis2ServiceInOutAsyncMessageReceiver(Axis2ServiceBinding service, + Operation operation) { + this.operation = operation; + this.service = service; + } + + public Axis2ServiceInOutAsyncMessageReceiver() { + } + + public final void receive(final MessageContext messageCtx) { + try { + Object messageId = messageCtx.getMessageID(); + if (messageId == null) { + messageId = new MessageId(); + } + + // Now use message id as index to context to be used by callback + // target invoker + CountDownLatch doneSignal = new CountDownLatch(1); + InvocationContext invCtx = + service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx), doneSignal); + service.addMapping(messageId, invCtx); + + invokeBusinessLogic(messageCtx, messageId); + + try { + doneSignal.await(); + } catch(InterruptedException e) { + e.printStackTrace(); + } + } catch (AxisFault e) { + // log.error(e); + } + } + + private void invokeBusinessLogic(MessageContext inMC, Object messageId) throws AxisFault { + try { + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + String conversationID = service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null; + service.invokeTarget(operation, args, messageId, conversationID); + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof Exception) { + throw AxisFault.makeFault((Exception)t); + } + throw new InvocationRuntimeException(e); + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java new file mode 100644 index 0000000000..8af613450d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java @@ -0,0 +1,117 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; + +public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver { + + protected Operation operation; + + private Axis2ServiceBinding axis2Service; + + public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceBinding service, Operation operation) { + this.axis2Service = service; + this.operation = operation; + } + + public Axis2ServiceInOutSyncMessageReceiver() { + + } + + @Override + public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault { + QName envQName = null; + try { + envQName= inMC.getEnvelope().getQName(); + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] args = new Object[] {requestOM}; + + String conversationID = axis2Service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null; + + OMElement responseOM = (OMElement)axis2Service.invokeTarget(operation, args, null, conversationID); + + + SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope(); + if(null != responseOM ){ + soapEnvelope.getBody().addChild(responseOM); + } + outMC.setEnvelope(soapEnvelope); + outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); + + } catch (InvocationTargetException e) { + // e.printStackTrace(); + throw processMessageFault(envQName.getNamespaceURI(), e.getCause()); + } catch(InvocationRuntimeException e){ + // e.printStackTrace(); + throw processMessageFault(envQName.getNamespaceURI(), e.getCause()); + } catch (AxisFault e) { + // e.printStackTrace(); + throw e; + } catch (Exception e) { + // e.printStackTrace(); + throw AxisFault.makeFault(e); + } + } + + /** + * @param envQName + * @param e + * @throws AxisFault + */ + private AxisFault processMessageFault(String nsURI, Throwable t) { + + if (t instanceof ServiceFaultException) { //Business fault. + OMElement faultdetail = null; + String reason = ""; + + ServiceFaultException sfe = (ServiceFaultException)t; + reason= sfe.getMessage(); + reason = reason == null ? "" : reason; + Object finfo = sfe.getFaultInfo(); + + if (finfo instanceof OMElement) { + faultdetail = (OMElement)finfo; + + } + QName faultCode= new QName(nsURI , + org.apache.axiom.soap.SOAP12Constants.SOAP_FAULT_VALUE_SENDER); + return new AxisFault(faultCode, reason, null, null, faultdetail); + + + } else if ( t instanceof Exception) { + return AxisFault.makeFault((Exception) t); + } + + + return new AxisFault(t); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java new file mode 100644 index 0000000000..74b79de3ed --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java @@ -0,0 +1,211 @@ +/* + * 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.axis2; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Set; +import java.util.Vector; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.transport.http.AxisServlet; + +/** + * This overrides the servlet init of the AxisServlet so Tuscany can use + * a single Axis2 ConfigurationContext instance shared between AxisServlet + * instances for each SCA service with a ws binding. + * TODO: need to review if thats really what we want to be doing + */ +public class Axis2ServiceServlet extends AxisServlet { + + private static final long serialVersionUID = 1L; + + private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig(); + + private boolean inited; + + public void init(ConfigurationContext configContext) { + this.configContext = configContext; + try { + super.init(DUMMY_CONFIG); + } catch (ServletException e) { + throw new RuntimeException(e); + } + } + + /** + * We've setup the Servlet by passing in a ConfigurationContext on our init method + * override this method to just return that + */ + @Override + protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException { + return this.configContext; + } + + /** + * The AxisServlet gets NPE during init without a ServletConfig so this is a mocked up one to prevent that. + */ + private static ServletConfig createDummyServletConfig() { + ServletConfig sc = new ServletConfig() { + + public String getServletName() { + return "TuscanyAxis2DummyServlet"; + } + + public ServletContext getServletContext() { + return new ServletContext() { + + public ServletContext getContext(String uripath) { + return null; + } + + public String getContextPath() { + return null; + } + + public int getMajorVersion() { + return 0; + } + + public int getMinorVersion() { + return 0; + } + + public String getMimeType(String file) { + return null; + } + + public Set getResourcePaths(String path) { + return Collections.emptySet(); + } + + public URL getResource(String path) throws MalformedURLException { + if("/".equals(path)) { + // HACK: To avoid NPE + return new URL("/axis2"); + } + return null; + } + + public InputStream getResourceAsStream(String path) { + return null; + } + + public RequestDispatcher getRequestDispatcher(String path) { + return null; + } + + public RequestDispatcher getNamedDispatcher(String arg0) { + return null; + } + + public Servlet getServlet(String arg0) throws ServletException { + return null; + } + + public Enumeration getServlets() { + return null; + } + + public Enumeration getServletNames() { + return null; + } + + public void log(String arg0) { + } + + public void log(Exception arg0, String arg1) { + } + + public void log(String arg0, Throwable arg1) { + } + + public String getRealPath(String arg0) { + return null; + } + + public String getServerInfo() { + return null; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return null; + } + + public Object getAttribute(String arg0) { + return null; + } + + public Enumeration getAttributeNames() { + return null; + } + + public void setAttribute(String arg0, Object arg1) { + } + + public void removeAttribute(String arg0) { + } + + public String getServletContextName() { + return null; + } + }; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return new Vector().elements(); + } + }; + return sc; + } + + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + // HACK: Get the correct context root which is not available during init() call + if (!inited) { + synchronized (configContext) { + configContext.setContextRoot(request.getContextPath()); + inited = true; + } + } + super.service(request, response); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java new file mode 100755 index 0000000000..52768b973c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java @@ -0,0 +1,186 @@ +/* + * 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.axis2; + +import java.lang.reflect.InvocationTargetException; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.component.WorkContext; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.model.Scope; +import org.apache.tuscany.spi.wire.InvocationRuntimeException; +import org.apache.tuscany.spi.wire.Message; +import org.apache.tuscany.spi.wire.TargetInvoker; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPBody; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axiom.soap.SOAPHeader; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.AddressingConstants; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.wsdl.WSDLConstants; + +/** + * Axis2TargetInvoker uses an Axis2 OperationClient to invoke a remote web + * service + */ +public class Axis2TargetInvoker implements TargetInvoker { + + private QName wsdlOperationName; + + private Options options; + + private SOAPFactory soapFactory; + + private ServiceClient serviceClient; + + private WorkContext workContext; + + public Axis2TargetInvoker(ServiceClient serviceClient, + QName wsdlOperationName, + Options options, + SOAPFactory soapFactory, + WorkContext workContext) { + this.wsdlOperationName = wsdlOperationName; + this.options = options; + this.soapFactory = soapFactory; + this.serviceClient = serviceClient; + this.workContext = workContext; + } + + /** + * Invoke a WS operation + * + * @param payload + * @param sequence + * @return + * @throws InvocationTargetException + */ + public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException { + try { + Object[] args = (Object[])payload; + OperationClient operationClient = createOperationClient(args); + + operationClient.execute(true); + + MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); + + return responseMC.getEnvelope().getBody().getFirstElement(); + + } catch (AxisFault e) { + // convert exception to an exception independent on Axis runtime. + Throwable cause = e.getCause(); + cause = cause == null ? e : cause; + ServiceFaultException serviceFaultException = + new ServiceFaultException(e.getMessage(), e.getDetail(), cause); + OMElement detail = e.getDetail(); + if (null != detail) { + detail.getQName(); + serviceFaultException.setLogical(detail.getQName()); + } + throw new InvocationTargetException(serviceFaultException); + + } + + } + + @SuppressWarnings("deprecation") + protected OperationClient createOperationClient(Object[] args) throws AxisFault { + SOAPEnvelope env = soapFactory.getDefaultEnvelope(); + if (args != null && args.length > 0) { + SOAPBody body = env.getBody(); + for (Object bc : args) { + if (bc instanceof OMElement) { + body.addChild((OMElement)bc); + } else { + throw new IllegalArgumentException( + "Can't handle mixed payloads betweem OMElements and other types."); + } + } + } + MessageContext requestMC = new MessageContext(); + requestMC.setEnvelope(env); + // Axis2 operationClients can not be shared so create a new one for each + // request + OperationClient operationClient = serviceClient.createClient(wsdlOperationName); + + if (workContext != null) { + String conversationId = (String)workContext.getIdentifier(Scope.CONVERSATION); + if (conversationId != null && conversationId.length() != 0) { + EndpointReference fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL); + fromEPR.addReferenceParameter(WebServiceBindingDefinition.CONVERSATION_ID_REFPARM_QN, conversationId); + options.setFrom(fromEPR); + requestMC.setFrom(fromEPR); // who knows why two ways ? + + // For now do this the brute force method. Need to figure out + // how to do axis addressing .. configure mar in flow. + SOAPEnvelope sev = requestMC.getEnvelope(); + SOAPHeader sh = sev.getHeader(); + OMElement el = + fromEPR.toOM(AddressingConstants.Final.WSA_NAMESPACE, + AddressingConstants.WSA_FROM, + AddressingConstants.WSA_DEFAULT_PREFIX); + sh.addChild(el); + } + + } + + operationClient.setOptions(options); + operationClient.addMessageContext(requestMC); + return operationClient; + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + try { + Object resp = invokeTarget(msg.getBody(), NONE); + msg.setBody(resp); + } catch (Throwable e) { + msg.setBodyWithFault(e); + } + return msg; + } + + public Axis2TargetInvoker clone() throws CloneNotSupportedException { + try { + return (Axis2TargetInvoker)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/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java new file mode 100644 index 0000000000..64ccb94193 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java @@ -0,0 +1,79 @@ +/* + * 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.axis2; + +import java.net.URI; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.HandlerDescription; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.RequestURIBasedDispatcher; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + */ +public class TuscanyDispatcher extends RequestURIBasedDispatcher { + + public static final String NAME = "TuscanyDispatcher"; + private static final Log log = LogFactory.getLog(RequestURIBasedDispatcher.class); + private static final boolean isDebugEnabled = log.isDebugEnabled(); + + /* + * (non-Javadoc) + * + * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext) + */ + public AxisService findService(MessageContext messageContext) throws AxisFault { + EndpointReference toEPR = messageContext.getTo(); + + if (toEPR != null) { + if(isDebugEnabled){ + log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress()); + } + + String path = URI.create(toEPR.getAddress()).getPath(); + + // remove the leading slash + if (path != null && path.length() > 1 && path.startsWith("/")) { + path = path.substring(1); + } + + ConfigurationContext configurationContext = messageContext.getConfigurationContext(); + AxisConfiguration registry = configurationContext.getAxisConfiguration(); + + return registry.getService(path); + + } else { + if(isDebugEnabled){ + log.debug("Attempted to check for Service using null target endpoint URI"); + } + return null; + } + } + + public void initDispatcher() { + init(new HandlerDescription(NAME)); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java new file mode 100755 index 0000000000..3f59ec0130 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java @@ -0,0 +1,210 @@ +/* + * 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.axis2; + + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.namespace.QName; + +import org.apache.tuscany.spi.model.BindingDefinition; +import org.osoa.sca.Constants; + +/** + * Represents a Celtix binding configuration in an assembly + * + * @version $Rev$ $Date$ + */ +public class WebServiceBindingDefinition extends BindingDefinition { + public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA_NS,"conversationID"); + private Definition definition; + private Port port; + private Service service; + private String uri; + private String namespace; + private String serviceName; + private String portName; + private String bindingName; + private Binding binding; + private boolean spec10Compliant; // hack just to allow any existing WS scdl to still work for now + private URI actualURI; + + /** + * @deprecated pre 1.0 binding.ws spec + */ + @Deprecated + public WebServiceBindingDefinition(Definition definition, Port port, String uri, String portURI, Service service) { + this.definition = definition; + this.port = port; + this.uri = uri; + this.service = service; + } + + public WebServiceBindingDefinition(String ns, Definition definition, String serviceName, String portName, String bindingName, String uri) { + this.namespace = ns; + this.definition = definition; + this.serviceName = serviceName; + this.portName = portName; + this.bindingName = bindingName; + this.uri = uri; + this.spec10Compliant = true; + } + + public Port getWSDLPort() { + if (port == null) { + Service service = getWSDLService(); + if (portName == null) { + Map ports = service.getPorts(); + if (ports.size() != 1) { + throw new IllegalStateException("when portName is null WSDL service must have exactly one WSDL port"); + } + port = (Port)ports.values().iterator().next(); + } else { + port = service.getPort(portName); + } + } + return port; + } + + public Service getWSDLService() { + if (service == null) { + if (definition == null) { + throw new IllegalStateException("WSDL definition is null"); + } + Map services = definition.getServices(); + if (serviceName != null) { + QName serviceQN = new QName(namespace, serviceName); + for (Object o : services.values()) { + Service s = (Service) o; + if (s.getQName().equals(serviceQN)) { + service = s; + break; + } + } + if (service == null) { + throw new IllegalStateException("no service: " + serviceQN); + } + } else { + service = (Service)services.values().iterator().next(); + } + } + return service; + } + + public void setWSDLPort(Port value) { + port = value; + } + + public Definition getWSDLDefinition() { + return definition; + } + + public void setWSDLDefinition(Definition def) { + definition = def; + } + + public String getURI() { + return uri; + } + + public URI getPortURI() { + URI portURI = null; + if (definition != null) { + Port port = getWSDLPort(); + final List wsdlPortExtensions = port.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + try { + portURI = new URI(((SOAPAddress) extension).getLocationURI()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + break; + } + } + } + return portURI; + } + + public void setURI(String theUri) { + this.uri = theUri; + } + + public Binding getBinding() { + if (binding == null) { + if (definition == null) { + throw new IllegalStateException("WSDL definition is null"); + } + QName bindingQN = new QName(namespace, bindingName); + this.binding = definition.getBinding(bindingQN); + if (binding == null) { + throw new IllegalStateException("no binding: " + bindingQN); + } + } + return binding; + } + + public String getWSDLNamepace() { + return namespace; + } + + public String getPortName() { + return portName; + } + + public String getServiceName() { + return serviceName; + } + + public String getBindingName() { + return bindingName; + } + + public boolean isSpec10Compliant() { + return spec10Compliant; + } + + public URI getActualURI() { + return actualURI; + } + + public void setActualURI(URI actualURI) { + this.actualURI = actualURI; + } + + public Object clone() { + WebServiceBindingDefinition clone = + new WebServiceBindingDefinition(this.namespace, + this.definition, + this.serviceName, + this.portName, + this.bindingName, + this.uri); + + return clone; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java new file mode 100755 index 0000000000..15b58b4305 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java @@ -0,0 +1,244 @@ +/* + * 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.axis2; + +import static org.osoa.sca.Constants.SCA_NS; + +import java.io.IOException; +import java.util.Collection; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.deployer.DeploymentContext; +import org.apache.tuscany.spi.extension.LoaderExtension; +import org.apache.tuscany.spi.loader.LoaderException; +import org.apache.tuscany.spi.loader.LoaderRegistry; +import org.apache.tuscany.spi.loader.LoaderUtil; +import org.apache.tuscany.spi.model.ModelObject; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Scope; + +/** + * Parses a WebServiceBindingDefinition entry in an assembly XML file + * + * TODO: TUSCANY-1153 support + * + * @version $Rev$ $Date$ + */ +@Scope("COMPOSITE") +@SuppressWarnings("deprecation") +public class WebServiceBindingLoader extends LoaderExtension { + public static final QName BINDING_WS = new QName(SCA_NS, "binding.ws"); + + private WSDLDefinitionRegistry wsdlDefinitionRegistry; + + @Constructor( { "loaderRegistry", "wsdlDefinitionRegistry" }) + public WebServiceBindingLoader(@Autowire LoaderRegistry loaderRegistry, + @Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) { + super(loaderRegistry); + this.wsdlDefinitionRegistry = wsdlDefinitionRegistry; + } + + public QName getXMLType() { + return BINDING_WS; + } + + public WebServiceBindingDefinition load(CompositeComponent parent, ModelObject object, XMLStreamReader reader, + DeploymentContext deploymentContext) + throws XMLStreamException, LoaderException { + + String uri = reader.getAttributeValue(null, "uri"); + String wsdlElement = reader.getAttributeValue(null, "wsdlElement"); + String wsdliLocation = reader.getAttributeValue(null, "wsdlLocation"); + + // TODO: keep these old attributes for now for backward compatability + String endpoint = reader.getAttributeValue(null, "endpoint"); + String wsdlLocation = reader.getAttributeValue(null, "location"); + + // TODO: support wsa:endpointreference + + LoaderUtil.skipToEndElement(reader); + + WebServiceBindingDefinition wsBinding; + if (endpoint != null && endpoint.length() > 0) { + // TODO: support these old attributes for now for backward compatability + try { + wsBinding = createBindingOld(uri, endpoint, wsdlLocation, deploymentContext); + } catch (Exception e) { + throw new LoaderException(e); + } + } else { + wsBinding = createWSBinding(wsdlElement, wsdliLocation, uri, deploymentContext); + } + + return wsBinding; + } + + protected WebServiceBindingDefinition createWSBinding(String wsdlElement, String wsdliLocation, String uri, DeploymentContext deploymentContext) throws LoaderException { + String ns = null; + String serviceName = null; + String portName = null; + String bindingName = null; + + if (wsdlElement != null && wsdlElement.length() > 0) { + + ns = getWSDLNamespace(wsdlElement); + + String uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.service"); + if (uriValue != null) { + serviceName = uriValue; + } else { + uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.port"); + if (uriValue != null) { + int i = uriValue.lastIndexOf('/'); + if (i == -1) { + throw new IllegalArgumentException("Missing '/' seperator between service and port in wsdl.port() in wsdlElement attribute"); + } + serviceName = uriValue.substring(0, i); + portName = uriValue.substring(i+1); + } else { + uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.endpoint"); + if (uriValue != null) { + throw new IllegalArgumentException("WSDL 2.0 not supported for '#wsdl.endpoint' in wsdlElement attribute"); + } + uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.binding"); + if (uriValue == null) { + throw new IllegalArgumentException("missing '#wsdl.service' or '#wsdl.port' or '#wsdl.endpoint'or '#wsdl.binding' in wsdlElement attribute"); + } + bindingName = uriValue; + } + } + } + + Definition definition = null; + if (wsdliLocation != null && wsdliLocation.length() > 0) { + try { + definition = wsdlDefinitionRegistry.loadDefinition(wsdliLocation, deploymentContext.getClassLoader()); + } catch (Exception e) { + throw new LoaderException("Exception loading WSDL", e); + } + } else if (ns != null ){ + definition = wsdlDefinitionRegistry.getDefinition(ns); + } + + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(ns, definition, serviceName, portName, bindingName, uri); + + return wsBinding; + } + + protected String getWSDLElementURIValue(String wsdlElement, String type) { + String value = null; + String fullType = "#" + type + "("; + int i = wsdlElement.indexOf(fullType); + if (i > -1) { + int j = wsdlElement.indexOf(')',i); + if (j < 0) { + throw new IllegalArgumentException("missing closing bracket ')' on " + fullType + " in wsdlElement attribute"); + } + value = wsdlElement.substring(i + fullType.length(), j); + } + return value; + } + + protected String getWSDLNamespace(String wsdlElement) { + String ns = null; + if (wsdlElement != null && wsdlElement.length() > 0) { + int i = wsdlElement.indexOf('#'); + if (i < 0) { + throw new IllegalArgumentException("missing '#' namespace delimiter in wsdlElement attribute"); + } + if (i == 0) { + throw new IllegalArgumentException("no namespace in wsdlElement attribute"); + } + ns = wsdlElement.substring(0, i); + } + return ns; + } + + @SuppressWarnings("unchecked") + private WebServiceBindingDefinition createBindingOld(String uri, String endpoint, String wsdlLocation, DeploymentContext deploymentContext) + throws WSDLException, IOException, LoaderException { + // Get the WSDL port namespace and name + if (endpoint != null) { + int h = endpoint.indexOf('#'); + String serviceName; + String portName; + + String namespace = endpoint.substring(0, h); + String fragment = endpoint.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! + if (null == wsdlLocation) { + throw new Axis2BindingRunTimeException( + "Failed to determine wsdl location on binding. Try specifying 'location' attribute on binding."); + } + Definition definition = + wsdlDefinitionRegistry.loadDefinition(namespace+" "+wsdlLocation, deploymentContext.getClassLoader()); + + Port thePort = null; + Service service = null; + // Find the port with the given name + for (Service serv : (Collection) definition.getServices().values()) { + QName sqn = serv.getQName(); + if (serviceName != null && !serviceName.equals(sqn.getLocalPart())) { + continue; + } + + Port p = serv.getPort(portName); + if (p != null) { + service = serv; + thePort = p; + break; + } + } + if (thePort == null) { + throw new IllegalArgumentException("Cannot find WSDL port " + endpoint); + + } + return new WebServiceBindingDefinition(definition, thePort, uri, endpoint, service); + } + // FIXME: Find the first port? + throw new LoaderException("Web Service endpoint cannot be resolved: " + endpoint); + + } + +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java new file mode 100755 index 0000000000..c0ef46fee3 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java @@ -0,0 +1,44 @@ +/* + * 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.axis2.util; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.deployment.URLBasedAxisConfigurator; +import org.apache.axis2.engine.AxisConfigurator; + +/** + * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml + *

TODO: Review: should there be a single global Axis + * ConfigurationContext + */ +public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator { + + public TuscanyAxisConfigurator() throws AxisFault { + super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/binding/axis2/engine/config/axis2.xml"), null); + } + + public ConfigurationContext getConfigurationContext() throws AxisFault { + if (configContext == null) + configContext = ConfigurationContextFactory.createConfigurationContext(this); + return configContext; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java new file mode 100755 index 0000000000..c5d3733d01 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java @@ -0,0 +1,491 @@ +/* + * 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.axis2.util; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.wsdl.Binding; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.wsdl.extensions.soap.SOAPHeader; +import javax.wsdl.extensions.soap.SOAPOperation; +import javax.xml.namespace.QName; + +/** + * Metadata for a WSDL operation + */ +@SuppressWarnings({"all"}) +public class WebServiceOperationMetaData implements Serializable { + private static final long serialVersionUID = 2425306250256227724L; + + // WSDL BindingDefinition and BindingOperation + private Binding binding; + private BindingOperation bindingOperation; + // Fields to cache derived metadata + private transient Set inputHeaderParts; + private transient Set outputHeaderParts; + private transient String style; + private transient String use; + private transient String soapAction; + private transient List signature; + private String encoding; + private transient QName rpcOperationName; + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) { + this.binding = binding; + this.bindingOperation = bindingOperation; + } + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use, + String encoding, + String soapAction) { + this.binding = binding; + this.bindingOperation = bindingOperation; + this.style = style; + this.use = use; + this.encoding = encoding; + this.soapAction = soapAction; + } + + public Set getInputHeaderParts() { + if (inputHeaderParts == null) { + // Build a set of header parts that we need to exclude + inputHeaderParts = new HashSet(); + BindingInput bindingInput = bindingOperation.getBindingInput(); + + if (bindingInput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getInput().getMessage(); + List elements = bindingInput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + inputHeaderParts.add(part); + } + } + } + } + return inputHeaderParts; + } + + public Set getOutputHeaderParts() { + if (outputHeaderParts == null) { + // Build a set of header parts that we need to exclude + outputHeaderParts = new HashSet(); + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + + if (bindingOutput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getOutput().getMessage(); + List elements = bindingOutput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + outputHeaderParts.add(part); + } + } + } + } + return outputHeaderParts; + } + + private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) { + Part part = null; + if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } else if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } + return part; + } + + public String getStyle() { + if (style == null) { + SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData + .getExtensibilityElement(bindingOperation.getExtensibilityElements(), + SOAPOperation.class); + if (soapOperation != null) { + style = soapOperation.getStyle(); + } + if (style == null) { + SOAPBinding soapBinding = WebServicePortMetaData + .getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class); + if (soapBinding != null) { + style = soapBinding.getStyle(); + } + } + if (style == null) { + style = "document"; + } + } + return style; + } + + /** + * Returns the SOAP action for the given operation. + */ + public String getSOAPAction() { + if (soapAction == null) { + final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements(); + final SOAPOperation soapOp = + WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class); + if (soapOp != null) { + soapAction = soapOp.getSoapActionURI(); + } + } + return soapAction; + } + + public QName getRPCOperationName() { + if (rpcOperationName == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + String ns = + (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI(); + String name = bindingOperation.getOperation().getName(); + rpcOperationName = new QName(ns, name); + } + return rpcOperationName; + } + + private List getSOAPBodyParts(boolean input) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input); + if (soapBody != null) { + List parts = soapBody.getParts(); + if (parts != null) { + List names = new ArrayList(); + for (Iterator i = parts.iterator(); i.hasNext();) { + Object part = i.next(); + if (part instanceof String) { + names.add((String) part); + } else if (part instanceof Part) { + names.add(((Part) part).getName()); + } + } + return names; + } else { + return null; + } + } else { + return null; + } + } + + private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) { + List elements = null; + if (input) { + BindingInput bindingInput = bindingOperation.getBindingInput(); + if (bindingInput == null) { + return null; + } + elements = bindingInput.getExtensibilityElements(); + } else { + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + if (bindingOutput == null) { + return null; + } + elements = bindingOutput.getExtensibilityElements(); + } + javax.wsdl.extensions.soap.SOAPBody soapBody = WebServicePortMetaData.getExtensibilityElement(elements, + javax.wsdl.extensions.soap.SOAPBody.class); + return soapBody; + } + + /** + * Returns the use attribute + */ + public String getUse() { + if (use == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + use = soapBody.getUse(); + } + if (use == null) { + use = "literal"; + } + } + return use; + } + + @SuppressWarnings("unchecked") + public String getEncoding() { + if (encoding == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + List styles = (List) soapBody.getEncodingStyles(); + if (styles != null && !styles.isEmpty()) { + encoding = styles.get(0); + } + } + if (encoding == null) { + encoding = ""; + } + } + return encoding; + } + + public boolean isDocLitWrapped() { + boolean flag = getStyle().equals("document") && getUse().equals("literal"); + if (!flag) { + return false; + } + Message msg = getMessage(true); + if (msg == null) { + return false; + } + List parts = msg.getOrderedParts(null); + if (parts.size() != 1) { + return false; + } + Part part = (Part) parts.get(0); + QName element = part.getElementName(); + if (element == null) { + return false; + } + return element.getLocalPart().equals(bindingOperation.getOperation().getName()); + } + + /* + * public SOAPMediator createMediator(boolean serverMode) throws SOAPException { + * // create a new mediator for each invoke for thread-safety + * boolean rpcStyle = getStyle().equals("rpc"); boolean rpcEncoded = isEncoded(); + * + * SOAPMediator mediator = null; + * + * if (!rpcStyle) { // Document mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode); + * } else { if (!rpcEncoded) mediator = new + * SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal else mediator = + * new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded } + * return mediator; } + */ + + /** + * Get the operation signature from the WSDL operation + */ + public List getOperationSignature() { + if (signature == null) { + signature = new ArrayList(); + + Operation operation = bindingOperation.getOperation(); + if (operation == null) { + return signature; + } + + final Input input = operation.getInput(); + if (input == null) { + return signature; + } + + String sstyle = getStyle(); + + if ("rpc".equals(sstyle)) { + Collection partNames = input.getMessage().getParts().values(); + for (Iterator i = partNames.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + signature.add(part.getName()); + } + } else { + /* + * WS-I Basic Profile 1.1 4.7.6 Operation Signatures Definition: operation signature + * + * The profile defines the "operation signature" to be the fully qualified name of the child element of + * SOAP body of the SOAP input + * message described by an operation in a WSDL binding. + * + * In the case of rpc-literal binding, the operation name is used as a wrapper for the part accessors. + * In the document-literal case, designed so that they meet this requirement. + * + * An endpoint that supports multiple operations must unambiguously identify the operation being + * invoked based on the input message + * that it receives. This is only possible if all the operations specified in the wsdl:binding + * associated with an endpoint have a + * unique operation signature. + * + * R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are + * different from one another. + */ + List bodyParts = getSOAPBodyParts(true); + + Collection parts = input.getMessage().getParts().values(); + // Exclude the parts to be transmitted in SOAP header + if (bodyParts == null) { + parts.removeAll(getInputHeaderParts()); + } + for (Iterator i = parts.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + if (bodyParts == null) { + // All parts + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD element + // using a QName: " + part); + } + signature.add(elementName); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD + // element using a QName: " + part); + } + signature.add(elementName); + } + + } + } + } + } + return signature; + } + + public Message getMessage(boolean isInput) { + Operation operation = bindingOperation.getOperation(); + if (operation == null) { + return null; + } + + if (isInput) { + final Input input = operation.getInput(); + return input == null ? null : input.getMessage(); + } else { + final Output output = operation.getOutput(); + return output == null ? null : output.getMessage(); + } + } + + public Part getInputPart(int index) { + Part part = null; + Message message = getMessage(true); + if (message == null) { + return part; + } + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + public Part getOutputPart(int index) { + Part part = null; + Message message = getMessage(false); + if (message == null) { + return part; + } + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + /** + * Get a list of indexes for each part in the SOAP body + * + * @param isInput + */ + public List getBodyPartIndexes(boolean isInput) { + List indexes = new ArrayList(); + + Message message = getMessage(isInput); + if (message == null) { + return indexes; + } + + List bodyParts = getSOAPBodyParts(isInput); + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + if (headerParts.contains(part)) { + continue; + } + if (bodyParts == null) { + // All parts + indexes.add(index); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + indexes.add(index); + } + } + } + return indexes; + } + + /** + * Get the corresponding index for a part in the SOAP header by element name + * + * @param elementName + * @param isInput + */ + public int getHeaderPartIndex(QName elementName, boolean isInput) { + + Message message = getMessage(isInput); + if (message == null) { + return -1; + } + + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + // Test if the part is in header section + if (headerParts.contains(part) && elementName.equals(part.getElementName())) { + return index; + } + } + return -1; + } + + public BindingOperation getBindingOperation() { + return bindingOperation; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java new file mode 100755 index 0000000000..a8d4f0f581 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java @@ -0,0 +1,377 @@ +/* + * 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.axis2.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.xml.namespace.QName; + +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; + +/** + * Metadata for a WSDL port + * + */ +public class WebServicePortMetaData { + + private Service wsdlService; + private QName wsdlServiceName; + private Port wsdlPort; + private Binding wsdlBinding; + private QName wsdlPortName; + private PortType wsdlPortType; + private QName wsdlPortTypeName; + private String endpoint; + private boolean managed; + private List allOperationMetaData; + private WSDLServiceContract interfaceType; + + /** + * Constructor + * + * @param wsdlDefinition + */ + public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) { + + // Lookup the named port + this.wsdlPort = wsdlPort; + wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName()); + Collection services = wsdlDefinition.getServices().values(); + for (Object serviceObj : services) { + Service service = (Service) serviceObj; + if (service.getPorts().containsValue(wsdlPort)) { + wsdlService = service; + wsdlServiceName = service.getQName(); + break; + } + } + + // Save the binding + wsdlBinding = wsdlPort.getBinding(); + if (wsdlBinding == null) { + throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName); + } + + // Save the portType + wsdlPortType = wsdlBinding.getPortType(); + if (wsdlPortType == null) { + throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName); + } + wsdlPortTypeName = wsdlPortType.getQName(); + + // Save the endpoint + this.endpoint = endpoint; + + // Track if this endpoint is managed or not + this.managed = managed; + } + + /** + * Constructor + * + * @param serviceName + * @param portName + * @param portTypeName + * @param endpoint + */ + public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) { + wsdlServiceName = serviceName; + wsdlPortName = new QName(serviceName.getNamespaceURI(), portName); + wsdlPortTypeName = portTypeName; + this.endpoint = endpoint; + } + + /** + * @return Returns the wsdlPort. + */ + public javax.wsdl.Port getPort() { + return wsdlPort; + } + + /** + * @return Returns the wsdlService. + */ + public QName getServiceName() { + return wsdlServiceName; + } + + /** + * @return Returns the wsdlService. + */ + public javax.wsdl.Service getService() { + return wsdlService; + } + + /** + * @return Returns the wsdlPortType. + */ + public PortType getPortType() { + return wsdlPortType; + } + + /** + * @return Returns the wsdlPortType. + */ + public QName getPortTypeName() { + return wsdlPortTypeName; + } + + /** + * @return Returns the wsdlBinding. + */ + public Binding getBinding() { + return wsdlBinding; + } + + /** + * @return Returns the wsdlPortName. + */ + public QName getPortName() { + return wsdlPortName; + } + + /** + * Returns the endpoint of a given port. + */ + public String getEndpoint() { + + // Return the specified endpoint + if (endpoint != null) { + return endpoint; + } + + // Find the target endpoint on the port + if (wsdlPort != null) { + final List wsdlPortExtensions = wsdlPort.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + return ((SOAPAddress) extension).getLocationURI(); + } + } + } + + return null; + } + + /** + * Returns the SOAP binding style. + */ + public String getStyle() { + + // Find the binding style + String style = null; + if (wsdlBinding != null) { + final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements(); + SOAPBinding soapBinding = getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class); + if (soapBinding != null) { + style = soapBinding.getStyle(); + } + } + + // Default to document + return (style == null) ? "document" : style; + } + + /** + * Returns the use attribute + */ + public String getUse() { + List list = getAllOperationMetaData(); + return list.get(0).getUse(); + } + + /** + * Returns the encoding attribute + */ + public String getEncoding() { + List list = getAllOperationMetaData(); + return list.get(0).getEncoding(); + } + + /** + * @return Returns true if this is a managed web service. + */ + public boolean isManaged() { + return managed; + } + + /** + * Returns the first extensibility element of the given type. + * + * @param elements + * @param type + */ + public static T getExtensibilityElement(List elements, Class type) { + for (Object element : elements) { + if (type.isInstance(element)) { + return type.cast(element); + } + } + return null; + } + + /** + * Returns the extensibility elements of the given type. + * + * @param elements + * @param type + * @return List + */ + public static List getExtensibilityElements(List elements, Class type) { + List result = new ArrayList(); + for (Object element : elements) { + if (type.isInstance(element)) { + result.add(type.cast(element)); + } + } + return result; + } + + /** + * Get the operation signature from the SOAP Body + * + * @return A list of QNames + */ + // public static List getOperationSignature(javax.xml.soap.SOAPBody body) { + // List signature = new ArrayList(); + // for (Iterator i = body.getChildElements(); i.hasNext();) { + // Object child = i.next(); + // if (child instanceof SOAPBodyElement) { + // Name name = ((SOAPBodyElement) child).getElementName(); + // QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix()); + // signature.add(qname); + // } + // } + // return signature; + // } + // public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) { + // List signature = new ArrayList(); + // for (Iterator i = body.getChildElements(); i.hasNext();) { + // Object child = i.next(); + // if (child instanceof SOAPBodyElement) { + // SOAPBodyElement op = ((SOAPBodyElement) child); + // for (Iterator j = op.getChildElements(); j.hasNext();) { + // Object part = i.next(); + // if (part instanceof SOAPElement) { + // SOAPElement p = (SOAPElement) part; + // signature.add(p.getLocalName()); + // } + // } + // } + // } + // return signature; + // } + // public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) { + // List s1 = getOperationSignature(body); + // // List rpcParts = getRPCOperationSignature(body); + // for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { + // WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); + // + // String style = descriptor.getStyle(); + // + // if (style.equals("document")) { + // List s2 = descriptor.getOperationSignature(); + // if (s1.equals(s2)) + // return descriptor; + // } else { + // QName op1 = (QName) s1.get(0); + // QName op2 = descriptor.getRPCOperationName(); + // if (op1.equals(op2)) { + // /* + // * // FIXME: [rfeng] We don't support method overloading + // * List partNames = getOperationSignature(binding, + // * bindingOperation); if (rpcParts.equals(partNames)) + // */ + // return descriptor; + // } + // } + // } + // return null; + // } + public List getAllOperationMetaData() { + if (allOperationMetaData == null) { + allOperationMetaData = new ArrayList(); + for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) { + final BindingOperation bindingOperation = (BindingOperation) it.next(); + if (bindingOperation.getOperation() != null) { + allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation)); + } + } + } + return allOperationMetaData; + } + + public WebServiceOperationMetaData getOperationMetaData(String operationName) { + StringBuilder sb = new StringBuilder(operationName); + sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); + String capatalizedOpName = sb.toString(); + + for (WebServiceOperationMetaData webServiceOperationMetaData : getAllOperationMetaData()) { + WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) webServiceOperationMetaData; + String opName = descriptor.getBindingOperation().getOperation().getName(); + + if (opName.equals(operationName) || opName.equals(capatalizedOpName)) { + return descriptor; + } + } + return null; + } + + /** + * Returns the WSDL service contract + * + * @return WSDLServiceContract + */ + public WSDLServiceContract getInterfaceType() { + return interfaceType; + } + + /** + * Get the WSDL operation name for a Java method name + */ + public String getWSDLOperationName(String methodName) { + StringBuilder sb = new StringBuilder(methodName); + sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); + String capatalizedOpName = sb.toString(); + for (Object o : wsdlPortType.getOperations()) { + Operation operation = (Operation) o; + String wsdlOpName = operation.getName(); + if (wsdlOpName.equals(methodName)) { + return wsdlOpName; + } + if (wsdlOpName.equals(capatalizedOpName)) { + return wsdlOpName; + } + } + return null; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl new file mode 100644 index 0000000000..ee1b8d9e81 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl @@ -0,0 +1,48 @@ + + + + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..fd5c2f5baa --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,49 @@ + + + + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..10306d8968 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml new file mode 100755 index 0000000000..e4f6d699f9 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml @@ -0,0 +1,306 @@ + + + + + + + false + false + false + false + + + + + + 30 + + + + true + + + + + + false + + admin + axis2 + + + + + + + + + + + + + + false + + + + + + + true + + + false + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java new file mode 100644 index 0000000000..4cb40b0a23 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java @@ -0,0 +1,229 @@ +/* + * 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.axis2; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; + +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.spi.component.Component; +import org.apache.tuscany.spi.component.CompositeComponent; + +/** + * Tests for the WebServicebindingLoader class + */ +@SuppressWarnings("deprecation") +public class Axis2BindingBuilderTestCase extends TestCase { + + private CompositeComponent parent; + + private static final String NAME = "MyService"; + private static final URI COMPOSITE_NAME = URI.create("MyComposite"); + private static final URI COMPOSITE_NAME2 = URI.create("MyComposite2"); + private static final String BASE_URI = "http://localhost/services"; + + public void testDefaultURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null, null, null, null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/MyService", uri.toString()); + } + + public void testDefaultURIMultiServices() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null, null, null, null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME2, NAME, parent); + assertEquals("http://localhost/services/MyComposite2/MyService", uri.toString()); + } + + public void testExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null, null, null, null, "http://foo/bar"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://foo/bar", uri.toString()); + } + + public void testExplicitWSDL() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("http://my/wsdl/uri"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://my/wsdl/uri", uri.toString()); + } + + public void testExplicitWSDLExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("http://my/wsdl/uri"), "myService", "myPort", null, "foo"); + try { + builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + + public void testExplicitWSDLBindingExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "http://my/uri"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + + // explicit URI should be used as the WSDL binding is used not the wsdl service/port + assertEquals("http://my/uri", uri.toString()); + } + + public void testExplicitWSDLBindingExplicitRelativeURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/x/y", uri.toString()); + } + + public void testExplicitWSDLBindingExplicitRelativeURIWithDot() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "x/./y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/x/y", uri.toString()); + } + + public void testExplicitWSDLBindingExplicitRelativeURIWithDots() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"), null, null, "myBinding", "../x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/x/y", uri.toString()); + } + + public void testExplicitRelativeWSDL() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/MyService/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLMultiServices() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME2, NAME, parent); + assertEquals("http://localhost/services/MyComposite2/MyService/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLWithDots() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLWithDotsMultiService() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"), "myService", "myPort", null, null); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME2, NAME, parent); + assertEquals("http://localhost/services/MyComposite2/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, "http://my/wsdl/uri"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://my/wsdl/uri/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLWithDotsExplicitURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"), "myService", "myPort", null, "http://my/wsdl/uri"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://my/wsdl/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLExplicitRelativeURI() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, "x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/MyComposite/x/y/foo/bar", uri.toString()); + } + + public void testExplicitRelativeWSDLExplicitRelativeURIWithDots() throws Exception { + Axis2BindingBuilder builder = new Axis2BindingBuilder(); + WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"), "myService", "myPort", null, "../x/y"); + URI uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME, parent); + assertEquals("http://localhost/services/x/y/foo/bar", uri.toString()); + } + + protected Definition createMockWSDL(String endpoint) { + Definition mockDef = createMock(Definition.class); + + Service wsdlService = createMock(Service.class); + expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService")); + + Port wsdlPort = createMock(Port.class); + List ees = new ArrayList(); + SOAPAddress sa = createMock(SOAPAddress.class); + expect(sa.getLocationURI()).andReturn(endpoint); + ees.add(sa); + expect(wsdlPort.getExtensibilityElements()).andReturn(ees); + + expect(wsdlService.getPort("myPort")).andReturn(wsdlPort); + + Map services = new HashMap(); + services.put("myService", wsdlService); + expect(mockDef.getServices()).andReturn(services); + + replay(mockDef); + replay(wsdlService); + replay(wsdlPort); + replay(sa); + return mockDef; + } + protected Definition createMockWSDLBinding(String endpoint) { + Definition mockDef = createMock(Definition.class); + replay(mockDef); + return mockDef; + } + + protected void setUp() { + parent = createMock(CompositeComponent.class); + Component comp1 = createMock(Component.class); + Component comp2 = createMock(Component.class); + Collection wires1 = new ArrayList(); + wires1.add("dummy1"); + Collection wires2 = new ArrayList(); + wires2.add("dummy1"); + wires2.add("dummy2"); + expect(comp1.getInboundWires()).andReturn(wires1); + expect(comp2.getInboundWires()).andReturn(wires2); + expect(parent.getChild(COMPOSITE_NAME.toString())).andReturn(comp1); + expect(parent.getChild(COMPOSITE_NAME2.toString())).andReturn(comp2); + replay(comp1); + replay(comp2); + replay(parent); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java new file mode 100755 index 0000000000..e8f1f29034 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java @@ -0,0 +1,111 @@ +/* + * 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.axis2; + +import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION; + +import java.lang.reflect.Type; +import java.net.URL; +import java.util.HashMap; + +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 junit.framework.TestCase; + +import org.apache.tuscany.idl.wsdl.WSDLServiceContract; +import org.apache.tuscany.spi.component.CompositeComponent; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.model.ServiceContract; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.TargetInvoker; +import org.apache.tuscany.spi.wire.WireService; +import org.easymock.EasyMock; +import org.xml.sax.InputSource; + +public class Axis2ReferenceTestCase extends TestCase { + + public void testInvokeService() throws Exception { + Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName"); + ServiceContract contract = new JavaServiceContract(); + Operation operation = new Operation("sayHi", null, null, null, false, null, NO_CONVERSATION); + TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(contract, operation); + assertNotNull(targetInvoker); + assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker); + } + + public void testAsyncTargetInvoker() throws Exception { + Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName"); + //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class + InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class); + JavaServiceContract contract = new JavaServiceContract(Greeter.class); + contract.setCallbackName(""); + contract.setCallbackClass(GreetingCallback.class); + Operation callbackOp = + new Operation("sayHiCallback", null, null, null, true, null, NO_CONVERSATION); + HashMap> callbackOps = new HashMap>(); + callbackOps.put("sayHiCallback", callbackOp); + contract.setCallbackOperations(callbackOps); + EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes(); + EasyMock.replay(inboundWire); + + axis2Reference.setInboundWire(inboundWire); + Operation operation = new Operation("sayHi", null, null, null, true, null, NO_CONVERSATION); + TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation); + assertNotNull(asyncTargetInvoker); + assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker); + } + + @SuppressWarnings("unchecked") + private Axis2ReferenceBinding createAxis2Reference(String webAppName, String serviceName) throws Exception { + //Create WebServiceBindingDefinition + 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 a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance. + WireService wireService = EasyMock.createNiceMock(WireService.class); + EasyMock.replay(wireService); + CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class); + // TODO figure out what to do with the service contract + ServiceContract contract = new WSDLServiceContract(); + contract.setInterfaceClass(Greeter.class); + return new Axis2ReferenceBinding(serviceName, + parent, + wsBinding, + contract, + null, + null); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java new file mode 100755 index 0000000000..03340275b3 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java @@ -0,0 +1,153 @@ +/* + * 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.axis2; + +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.Servlet; +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.host.ServletHost; +import org.apache.tuscany.spi.idl.java.JavaServiceContract; +import org.apache.tuscany.spi.model.Operation; +import org.apache.tuscany.spi.wire.InboundWire; +import org.apache.tuscany.spi.wire.OutboundInvocationChain; +import org.apache.tuscany.spi.wire.OutboundWire; +import org.apache.tuscany.spi.wire.WireService; + +import junit.framework.TestCase; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.core.component.WorkContextImpl; +import org.easymock.EasyMock; + +public class Axis2ServiceTestCase extends TestCase { + + public void testInvokeService() throws Exception { + TestServletHost tomcatHost = new TestServletHost(); + Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, false); + axis2Service.start(); + + if (true) return; + Servlet servlet = tomcatHost.getMapping("testWebAppName/serviceBindings/testServiceName"); + assertNotNull(servlet); + + //Create mocked HttpRequest and HttpResponse object to test the Axis2Servlet + //To be done: + + } + + public void testAsyncMessageReceiver() throws Exception { + + TestServletHost tomcatHost = new TestServletHost(); + Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, true); + axis2Service.start(); + } + + @SuppressWarnings("unchecked") + private Axis2ServiceBinding createAxis2Service(String serviceName, ServletHost tomcatHost, boolean callback) + throws Exception { + //Create WebServiceBindingDefinition + 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 a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance. + WireService wireService = EasyMock.createNiceMock(WireService.class); + wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class)); + EasyMock.expectLastCall().andReturn(null); + EasyMock.replay(wireService); + + //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class + InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class); + JavaServiceContract contract = new JavaServiceContract(Greeter.class); + Map> opMap = new HashMap>(); + for (Method m : Greeter.class.getMethods()) { + opMap.put(m.getName(), new Operation(m.getName(), null, null, null)); + } + contract.setOperations(opMap); + EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes(); + if (callback) { + contract.setCallbackName(""); + } + EasyMock.replay(inboundWire); + + OutboundWire outboundWire = EasyMock.createNiceMock(OutboundWire.class); + Map, OutboundInvocationChain> map = new HashMap, OutboundInvocationChain>(); + EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once(); + EasyMock.replay(outboundWire); + + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(); + ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); + Axis2ServiceBinding axis2Service = + new Axis2ServiceBinding(serviceName, + contract, + null, + null, + wsBinding, + tomcatHost, + configurationContext, new WorkContextImpl()); + axis2Service.setInboundWire(inboundWire); + axis2Service.setOutboundWire(outboundWire); + + return axis2Service; + } + + protected class TestServletHost implements ServletHost { + private Map mappings = new HashMap(); + + public void registerMapping(String mapping, Servlet servlet) { + mappings.put(mapping, servlet); + } + + public Servlet unregisterMapping(String mapping) { + return mappings.remove(mapping); + } + + public Servlet getMapping(String mapping) { + return mappings.get(mapping); + } + + public boolean isMappingRegistered(String mapping) { + return mappings.containsKey(mapping); + } + + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java new file mode 100755 index 0000000000..39fccdadd3 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java @@ -0,0 +1,31 @@ +/* + * 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.axis2; + +public interface Greeter { + + String sayHi(); + + String greetMe(String requestType); + + void greetMeOneWay(String requestType); + + void greetMeWithCallback(String requestType); + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java new file mode 100644 index 0000000000..4c3b3304ea --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java @@ -0,0 +1,24 @@ +/* + * 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.axis2; + +public interface GreetingCallback { + + void greetMeCallback(String greetMeResponse); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java new file mode 100644 index 0000000000..75a848b88e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java @@ -0,0 +1,187 @@ +/* + * 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.axis2; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; + +import java.util.HashMap; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry; +import org.easymock.EasyMock; + +/** + * Tests for the WebServicebindingLoader class + */ +@SuppressWarnings("deprecation") +public class WebServicebindingLoaderTestCase extends TestCase { + + public void testCreateWSBinding() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + replay(wsdlReg); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.service(myService)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + EasyMock.verify(wsdlReg); + } + + public void testCreateWSBindingWsdlService() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + + Service wsdlService = createMock(Service.class); + expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService")); + + Map services = new HashMap(); + services.put("myService", wsdlService); + expect(mockDef.getServices()).andReturn(services); + + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + + replay(wsdlService); + replay(wsdlReg); + replay(mockDef); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.service(myService)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + assertEquals(wsdlService, binding.getWSDLService()); + + EasyMock.verify(wsdlService); + EasyMock.verify(wsdlReg); + EasyMock.verify(mockDef); + } + + public void testCreateWSBindingWsdlPort() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + + Service wsdlService = createMock(Service.class); + expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService")); + + Port wsdlPort = createMock(Port.class); + expect(wsdlService.getPort("myPort")).andReturn(wsdlPort); + + Map services = new HashMap(); + services.put("myService", wsdlService); + expect(mockDef.getServices()).andReturn(services); + + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + + replay(wsdlService); + replay(wsdlReg); + replay(mockDef); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.port(myService/myPort)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + assertEquals(wsdlPort, binding.getWSDLPort()); + + EasyMock.verify(wsdlService); + EasyMock.verify(wsdlReg); + EasyMock.verify(mockDef); + } + + public void testCreateWSBindingWsdlBinding() throws Exception { + WSDLDefinitionRegistry wsdlReg = createMock(WSDLDefinitionRegistry.class); + Definition mockDef = createMock(Definition.class); + + Binding wsdlBinding = createMock(Binding.class); + QName bindingQN = new QName("myNS", "myBinding"); + expect(mockDef.getBinding(bindingQN)).andReturn(wsdlBinding); + + expect(wsdlReg.getDefinition("myNS")).andReturn(mockDef); + + replay(wsdlReg); + replay(mockDef); + + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, wsdlReg); + + WebServiceBindingDefinition binding = loader.createWSBinding("myNS#wsdl.binding(myBinding)", null, null, null); + assertEquals(mockDef, binding.getWSDLDefinition()); + + assertEquals(wsdlBinding, binding.getBinding()); + + EasyMock.verify(wsdlReg); + EasyMock.verify(mockDef); + } + + public void testGetWSDLElementURIValue() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + assertEquals("myValue", loader.getWSDLElementURIValue("myNs#wsdl.foo(myValue)", "wsdl.foo")); + assertNull(loader.getWSDLElementURIValue("myNs#wsdl.XXX(myValue)", "wsdl.foo")); + } + + public void testBadGetWSDLElementURIValue() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + try { + loader.getWSDLElementURIValue("myNs#wsdl.foo(myValue", "wsdl.foo"); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + + public void testGetWSDLNamespace() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + assertEquals("myNS", loader.getWSDLNamespace("myNS#bla")); + } + + public void testNullGetWSDLNamespace() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + assertNull(loader.getWSDLNamespace("")); + assertNull(loader.getWSDLNamespace(null)); + } + + public void testBadGetWSDLNamespace() throws Exception { + WebServiceBindingLoader loader = new WebServiceBindingLoader(null, null); + try { + loader.getWSDLNamespace("bla"); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + try { + loader.getWSDLNamespace("#bla"); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl new file mode 100755 index 0000000000..d0958f282e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset b/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset new file mode 100644 index 0000000000..e615e93a4b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset @@ -0,0 +1,172 @@ + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt new file mode 100755 index 0000000000..d645695673 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/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, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt b/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/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/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml new file mode 100755 index 0000000000..09dae91e74 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml @@ -0,0 +1,78 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + databinding-axiom + Apache Tuscany Data Binding for Axiom + Tuscany Axiom Data Binding + + + + + org.apache.tuscany.sca.kernel + tuscany-spi + + + + org.apache.ws.commons.axiom + axiom-api + + + xerces + xercesImpl + + + + + + xerces + xercesImpl + + + + org.apache.ws.commons.axiom + axiom-impl + runtime + + + + junit + junit + + + + org.codehaus.woodstox + wstx-asl + + + + commons-logging + commons-logging + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java new file mode 100644 index 0000000000..68232cf2b8 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.DataBinding; +import org.apache.tuscany.spi.databinding.ExceptionHandler; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.databinding.extension.DataBindingExtension; +import org.osoa.sca.annotations.Service; + +/** + * DataBinding for AXIOM + */ +@Service(DataBinding.class) +public class AxiomDataBinding extends DataBindingExtension { + + public static final String NAME = OMElement.class.getName(); + public static final String[] ALIASES = new String[] {"axiom"}; + + public AxiomDataBinding() { + super(NAME, ALIASES, OMElement.class); + } + + /** + * @see org.apache.tuscany.spi.databinding.extension.DataBindingExtension#getWrapperHandler() + */ + @Override + public WrapperHandler getWrapperHandler() { + return new OMElementWrapperHandler(); + } + + public Object copy(Object source) { + if ( OMElement.class.isAssignableFrom(source.getClass()) ) { + try { + OMElement sourceElement = (OMElement)source; + return sourceElement.cloneOMElement(); + } catch ( Exception e ) { + throw new IllegalArgumentException(e); + } + } + return super.copy(source); + } + + @Override + public ExceptionHandler getExceptionHandler() { + return new AxiomExceptionHandler(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java new file mode 100644 index 0000000000..64fd0221ff --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.ExceptionHandler; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; + +/** + * AXIOM implementation of ExceptionHandler + * + * @version $Rev$ $Date$ + */ +public class AxiomExceptionHandler implements ExceptionHandler { + + public Exception createException(DataType exceptionType, String message, Object faultInfo, Throwable cause) { + return new ServiceFaultException(message, (OMElement)faultInfo, cause); + } + + public Object getFaultInfo(Exception exception) { + if (exception == null) { + return null; + } + ServiceFaultException faultException = (ServiceFaultException)exception; + return faultException.getFaultInfo(); + + } + + public DataType getFaultType(DataType exceptionType) { + if (ServiceFaultException.class == exceptionType.getPhysical()) { + XMLType type = XMLType.UNKNOWN; + if(exceptionType.getLogical() instanceof XMLType) { + type = (XMLType) exceptionType.getLogical(); + } + DataType faultType = new DataType(AxiomDataBinding.NAME, OMElement.class, type); + return faultType; + } else { + return null; + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java new file mode 100644 index 0000000000..b5fb40fa86 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; + +/** + * Helper for AXIOM + * + * @version $Rev$ $Date$ + */ +public class AxiomHelper { + + private AxiomHelper() { + } + + /** + * @param context + * @param element + */ + public static void adjustElementName(TransformationContext context, OMElement element) { + if (context != null) { + DataType dataType = context.getTargetDataType(); + Object logical = dataType == null ? null : dataType.getLogical(); + if (!(logical instanceof XMLType)) { + return; + } + XMLType xmlType = (XMLType)logical; + if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) { + // TODO: Throw expection or switch to the new Element + OMFactory factory = OMAbstractFactory.getOMFactory(); + QName name = xmlType.getElementName(); + OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix()); + element.setNamespace(namespace); + element.setLocalName(name.getLocalPart()); + } + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java new file mode 100644 index 0000000000..91b1f4da90 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.SimpleType2JavaTransformer; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from a simple java bject to OMElement + */ +@Service(Transformer.class) +public class OMElement2Object extends SimpleType2JavaTransformer { + + @Override + protected String getText(OMElement source) { + return source.getText(); + } + + public Class getSourceType() { + return OMElement.class; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java new file mode 100755 index 0000000000..52be08537d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import java.io.StringWriter; + +import javax.xml.stream.XMLStreamException; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from an OMElement to XML String + */ +@Service(Transformer.class) +public class OMElement2String extends TransformerExtension implements PullTransformer { + // private XmlOptions options; + + public String transform(OMElement source, TransformationContext context) { + try { + StringWriter writer = new StringWriter(); + source.serialize(writer); + return writer.toString(); + } catch (XMLStreamException e) { + throw new TransformationException(e); + } + } + + public Class getSourceType() { + return OMElement.class; + } + + public Class getTargetType() { + return String.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java new file mode 100755 index 0000000000..343408a027 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class OMElement2XMLStreamReader extends TransformerExtension implements PullTransformer { + // private XmlOptions options; + + public XMLStreamReader transform(OMElement source, TransformationContext context) { + return source.getXMLStreamReader(); + } + + public Class getSourceType() { + return OMElement.class; + } + + public Class getTargetType() { + return XMLStreamReader.class; + } + + public int getWeight() { + return 10; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java new file mode 100644 index 0000000000..4afc067516 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.WrapperHandler; +import org.apache.tuscany.spi.idl.ElementInfo; + +/** + * OMElement wrapper handler implementation + */ +public class OMElementWrapperHandler implements WrapperHandler { + + private OMFactory factory; + + public OMElementWrapperHandler() { + super(); + this.factory = OMAbstractFactory.getOMFactory(); + } + + public OMElement create(ElementInfo element, TransformationContext context) { + OMElement wrapper = factory.createOMElement(element.getQName(), null); + return wrapper; + } + + public void setChild(OMElement wrapper, int i, ElementInfo childElement, Object value) { + OMElement element = (OMElement)value; + QName elementName = childElement.getQName(); + OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix()); + element.setNamespace(namespace); + element.setLocalName(childElement.getQName().getLocalPart()); + wrapper.addChild((OMElement)value); + } + + public List getChildren(OMElement wrapper) { + List elements = new ArrayList(); + for (Iterator i = wrapper.getChildElements(); i.hasNext();) { + elements.add(i.next()); + } + return elements; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java new file mode 100644 index 0000000000..8b226319ae --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.Java2SimpleTypeTransformer; +import org.osoa.sca.annotations.Service; + +/** + * Transformer to convert data from an simple OMElement to Java Object + */ +@Service(Transformer.class) +public class Object2OMElement extends Java2SimpleTypeTransformer { + + private OMFactory factory; + + public Object2OMElement() { + super(); + factory = OMAbstractFactory.getOMFactory(); + } + + protected OMElement createElement(QName element, String text, TransformationContext context) { + OMElement omElement = factory.createOMElement(element, null); + factory.createOMText(omElement, text); + return omElement; + } + + @Override + public Class getTargetType() { + return OMElement.class; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java new file mode 100755 index 0000000000..eb0869dfd7 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import java.io.ByteArrayInputStream; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class String2OMElement extends TransformerExtension implements + PullTransformer { + + @SuppressWarnings("unchecked") + public OMElement transform(String source, TransformationContext context) { + try { + StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(source.getBytes())); + OMElement element = builder.getDocumentElement(); + AxiomHelper.adjustElementName(context, element); + return element; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getTargetType() { + return OMElement.class; + } + + public Class getSourceType() { + return String.class; + } + + public int getWeight() { + return 40; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java new file mode 100755 index 0000000000..e882d0f086 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.tuscany.spi.databinding.PullTransformer; +import org.apache.tuscany.spi.databinding.TransformationContext; +import org.apache.tuscany.spi.databinding.TransformationException; +import org.apache.tuscany.spi.databinding.Transformer; +import org.apache.tuscany.spi.databinding.extension.TransformerExtension; +import org.osoa.sca.annotations.Service; + +@Service(Transformer.class) +public class XMLStreamReader2OMElement extends TransformerExtension implements + PullTransformer { + + public XMLStreamReader2OMElement() { + super(); + } + + public OMElement transform(XMLStreamReader source, TransformationContext context) { + try { + StAXOMBuilder builder = new StAXOMBuilder(source); + OMElement element = builder.getDocumentElement(); + AxiomHelper.adjustElementName(context, element); + return element; + } catch (Exception e) { + throw new TransformationException(e); + } + } + + public Class getTargetType() { + return OMElement.class; + } + + public Class getSourceType() { + return XMLStreamReader.class; + } + + public int getWeight() { + return 10; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl new file mode 100644 index 0000000000..34ff82ddd5 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl @@ -0,0 +1,57 @@ + + + + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..ac92746c8d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,56 @@ + + + + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + 0.1-integration-incubating-SNAPSHOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite new file mode 100644 index 0000000000..09cab77b5a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java new file mode 100644 index 0000000000..2e7eccf620 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.databinding.axiom; + +import java.io.StringReader; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.tuscany.spi.idl.ServiceFaultException; +import org.apache.tuscany.spi.idl.XMLType; +import org.apache.tuscany.spi.model.DataType; + +/** + * Test case for SDOExceptionHandler + */ +public class AxiomExceptionHandlerTestCase extends TestCase { + private static final String IPO_XML = + "" + "" + + " " + + " Helen Zoe" + + " 47 Eden Street" + + " Cambridge" + + " CB1 1JR" + + " " + + " " + + " Robert Smith" + + " 8 Oak Avenue" + + " Old Town" + + " PA" + + " 95819" + + " " + + " " + + " " + + " Lapis necklace" + + " 1" + + " 99.95" + + " Want this for the holidays" + + " 1999-12-05" + + " " + + " " + + ""; + + private AxiomExceptionHandler handler; + private OMElement faultElement; + + /** + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + this.handler = new AxiomExceptionHandler(); + XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML)); + StAXOMBuilder builder = new StAXOMBuilder(reader); + faultElement = builder.getDocumentElement(); + } + + public void testGetFaultType() { + DataType dataType = handler.getFaultType(new DataType(ServiceFaultException.class, null)); + assertEquals(OMElement.class, dataType.getPhysical()); + assertEquals(XMLType.UNKNOWN, dataType.getLogical()); + assertEquals(AxiomDataBinding.NAME, dataType.getDataBinding()); + dataType = handler.getFaultType(new DataType(Exception.class, null)); + assertNull(dataType); + } + + public void testCreate() { + + Exception ex = handler.createException(null, "Order", faultElement, null); + assertTrue(ex instanceof ServiceFaultException); + ServiceFaultException exception = (ServiceFaultException)ex; + assertEquals("Order", exception.getMessage()); + assertSame(faultElement, exception.getFaultInfo()); + } + + public void testGetFaultInfo() { + ServiceFaultException exception = new ServiceFaultException("Order", faultElement, null); + Object faultInfo = handler.getFaultInfo(exception); + assertSame(faultElement, faultInfo); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java new file mode 100755 index 0000000000..917d090fc7 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.databinding.axiom; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamReader; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMElement; + +public class OMElementTestCase extends TestCase { + private static final String IPO_XML = + "" + "" + + " " + + " Helen Zoe" + + " 47 Eden Street" + + " Cambridge" + + " CB1 1JR" + + " " + + " " + + " Robert Smith" + + " 8 Oak Avenue" + + " Old Town" + + " PA" + + " 95819" + + " " + + " " + + " " + + " Lapis necklace" + + " 1" + + " 99.95" + + " Want this for the holidays" + + " 1999-12-05" + + " " + + " " + + ""; + + public final void testStringTransform() { + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(IPO_XML, null); + OMElement2String t2 = new OMElement2String(); + String xml = t2.transform(element, null); + Assert.assertNotNull(xml); + Assert.assertNotNull(xml.indexOf("") != -1); + } + + public final void testStringTransform2() { + String str = + "Robert"; + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(str, null); + OMElement2String t2 = new OMElement2String(); + String xml = t2.transform(element, null); + Assert.assertNotNull(xml); + Assert.assertNotNull(xml.indexOf("") != -1); + } + + public final void testStAXTransform() { + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(IPO_XML, null); + + OMElement2XMLStreamReader t2 = new OMElement2XMLStreamReader(); + XMLStreamReader reader = t2.transform(element, null); + + XMLStreamReader2OMElement t3 = new XMLStreamReader2OMElement(); + OMElement element2 = t3.transform(reader, null); + + Assert.assertEquals(element2.getQName(), element.getQName()); + Assert.assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), element2.getQName()); + } + + public final void testCopy() { + String2OMElement t1 = new String2OMElement(); + OMElement element = t1.transform(IPO_XML, null); + OMElement copy = (OMElement)new AxiomDataBinding().copy(element); + assertNotSame(element, copy); + assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getQName()); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml new file mode 100755 index 0000000000..58058dbe1a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml @@ -0,0 +1,33 @@ + + + + + Helen Zoe + 47 Eden Street + Cambridge + CB1 1JR + + + + Robert Smith + 8 Oak Avenue + Old Town + PA + 95819 + + + + + Lapis necklace + 1 + 99.95 + Want this for the holidays + 1999-12-05 + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd new file mode 100755 index 0000000000..5468542693 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd @@ -0,0 +1,118 @@ + + + + + International Purchase order schema for Example.com + Copyright 2000 Example.com. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl new file mode 100644 index 0000000000..cde45f12ae --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml new file mode 100644 index 0000000000..b5c8de523a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-old-style + ${testing.version} + jar + Apache Tuscany Axis2 itests old style scdl + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/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 "Hi " + name; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.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.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite new file mode 100644 index 0000000000..7b28443d0e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite @@ -0,0 +1,37 @@ + + + + + + + HelloworldClientRef + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite new file mode 100644 index 0000000000..4a5c1a46b7 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite @@ -0,0 +1,35 @@ + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..68174d1ecd --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..ac586a940f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName = "/OldStyleService.composite"; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java new file mode 100644 index 0000000000..843643370f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class OldStyleTestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "OldStyleReference.composite"; + private static final String SERVICE_COMPOSITE = "OldStyleService.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testCallingWSWithOldStyleSCDL() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml new file mode 100644 index 0000000000..78fce63c47 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml @@ -0,0 +1,41 @@ + + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.itests + parent + pom + Apache Tuscany Axis2 itests + + + old-style + simplest + service-explicit-uri + service-relative-uri + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml new file mode 100644 index 0000000000..9e87261c39 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-service-explicit-uri + ${testing.version} + jar + Apache Tuscany Axis2 itests service explicit uri + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/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 "Hi " + name; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.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.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite new file mode 100644 index 0000000000..2638f12a38 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite @@ -0,0 +1,36 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite new file mode 100644 index 0000000000..0e3a86b017 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..d3e769d31c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java new file mode 100644 index 0000000000..6585037255 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class ServiceExplicitURITestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testSimplestBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml new file mode 100644 index 0000000000..f9a636f552 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-service-relative-uri + ${testing.version} + jar + Apache Tuscany Axis2 itests service relative uri + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/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 "Hi " + name; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.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.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite new file mode 100644 index 0000000000..2638f12a38 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite @@ -0,0 +1,36 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite new file mode 100644 index 0000000000..f6bcc4a6fb --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..766a7acd98 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java new file mode 100644 index 0000000000..dec0a45e3c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class ServiceRelativeURITestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testSimplestBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml new file mode 100644 index 0000000000..62e3a2ae46 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-simplest + ${testing.version} + jar + Apache Tuscany Axis2 itests simplest binding.ws + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + junit + junit + 4.2 + test + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/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 "Hi " + name; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.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.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite new file mode 100644 index 0000000000..2638f12a38 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite @@ -0,0 +1,36 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite new file mode 100644 index 0000000000..5062dc282e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..446e269cd9 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java new file mode 100644 index 0000000000..79c1f067b5 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using pre-1.0 WS SCDL + */ +@SuppressWarnings("deprecation") +public class SimplestTestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testSimplestBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml new file mode 100644 index 0000000000..6b9fb6694f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml @@ -0,0 +1,90 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.testing + axis2-itest-wsdl-binding + ${testing.version} + jar + Apache Tuscany Axis2 itests service relative uri + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${scaKernelVersion} + + + org.apache.tuscany.sca.extensions.axis2 + databinding-axiom + ${scaKernelVersion} + + + + junit + junit + 4.2 + test + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/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 "Hi " + name; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.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.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite new file mode 100644 index 0000000000..889f69d1ca --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite @@ -0,0 +1,37 @@ + + + + + + + HelloworldClientRefSimplest + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite new file mode 100644 index 0000000000..bd7479f429 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite @@ -0,0 +1,35 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..766a7acd98 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java new file mode 100644 index 0000000000..8267488398 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.test.SCATestCase; + +public class HelloWorldServer extends SCATestCase { + + private String composteFileName; + + public HelloWorldServer(String composteFileName) { + this.composteFileName = composteFileName; + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(composteFileName); + super.setUp(); + } + + public void testPing() throws IOException, InterruptedException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java new file mode 100644 index 0000000000..ac9f7a65c9 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.itest; + + +import helloworld.HelloWorldService; +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.apache.tuscany.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for binding.ws using wsdlElement pointing to a WSDl binding, + * so the uri element must be used to define the actual endpoint. + * The SCA service uses a relative uri, the reference uses an absolute uri. + */ +@SuppressWarnings("deprecation") +public class WsdlElementBindingTestCase extends SCATestCase { + + private SCATestCaseRunner server; + private CompositeContext compositeContext; + + private static final String CLIENT_COMPOSITE = "client.composite"; + private static final String SERVICE_COMPOSITE = "service.composite"; + private static final String CLIENT_COMPONENT = "HelloworldClient"; + + public void testWsdlElementBinding() throws Exception { + HelloWorldService helloWorldService = compositeContext.locateService(HelloWorldService.class, CLIENT_COMPONENT); + String msg = helloWorldService.getGreetings("Petra"); + Assert.assertEquals("Hi Petra", msg); + } + + @Override + protected void setUp() throws Exception { + setApplicationSCDL(CLIENT_COMPOSITE); + super.setUp(); + compositeContext = CurrentCompositeContext.getContext(); + + server = new SCATestCaseRunner(HelloWorldServer.class, SERVICE_COMPOSITE); + server.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + server.tearDown(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt new file mode 100644 index 0000000000..9601ead3f6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt @@ -0,0 +1,1407 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Netscape Public License V1.1 + + AMENDMENTS + + The Netscape Public License Version 1.1 ("NPL") consists of the + Mozilla Public License Version 1.1 with the following Amendments, + including Exhibit A-Netscape Public License. Files identified with + "Exhibit A-Netscape Public License" are governed by the Netscape + Public License Version 1.1. + + Additional Terms applicable to the Netscape Public License. + I. Effect. + These additional terms described in this Netscape Public + License -- Amendments shall apply to the Mozilla Communicator + client code and to all Covered Code under this License. + + II. "Netscape's Branded Code" means Covered Code that Netscape + distributes and/or permits others to distribute under one or more + trademark(s) which are controlled by Netscape but which are not + licensed for use under this License. + + III. Netscape and logo. + This License does not grant any rights to use the trademarks + "Netscape", the "Netscape N and horizon" logo or the "Netscape + lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", + "Smart Browsing" even if such marks are included in the Original + Code or Modifications. + + IV. Inability to Comply Due to Contractual Obligation. + Prior to licensing the Original Code under this License, Netscape + has licensed third party code for use in Netscape's Branded Code. + To the extent that Netscape is limited contractually from making + such third party code available under this License, Netscape may + choose to reintegrate such code into Covered Code without being + required to distribute such code in Source Code form, even if + such code would otherwise be considered "Modifications" under + this License. + + V. Use of Modifications and Covered Code by Initial Developer. + V.1. In General. + The obligations of Section 3 apply to Netscape, except to + the extent specified in this Amendment, Section V.2 and V.3. + + V.2. Other Products. + Netscape may include Covered Code in products other than the + Netscape's Branded Code which are released by Netscape + during the two (2) years following the release date of the + Original Code, without such additional products becoming + subject to the terms of this License, and may license such + additional products on different terms from those contained + in this License. + + V.3. Alternative Licensing. + Netscape may license the Source Code of Netscape's Branded + Code, including Modifications incorporated therein, without + such Netscape Branded Code becoming subject to the terms of + this License, and may license such Netscape Branded Code on + different terms from those contained in this License. + + VI. Litigation. + Notwithstanding the limitations of Section 11 above, the + provisions regarding litigation in Section 11(a), (b) and (c) of + the License shall apply to all disputes relating to this License. + + EXHIBIT A-Netscape Public License. + + "The contents of this file are subject to the Netscape Public + License Version 1.1 (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.mozilla.org/NPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The Original Code is Mozilla Communicator client code, released + March 31, 1998. + + The Initial Developer of the Original Code is Netscape + Communications Corporation. Portions created by Netscape are + Copyright (C) 1998-1999 Netscape Communications Corporation. All + Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the + terms of the _____ license (the "[___] License"), in which case + the provisions of [______] License are applicable instead of + those above. If you wish to allow use of your version of this + file only under the terms of the [____] License and not to allow + others to use your version of this file under the NPL, indicate + your decision by deleting the provisions above and replace them + with the notice and other provisions required by the [___] + License. If you do not delete the provisions above, a recipient + may use your version of this file under either the NPL or the + [___] License." + + ---------------------------------------------------------------------- + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/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/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml new file mode 100644 index 0000000000..b722951bc1 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml @@ -0,0 +1,46 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.plugins + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-plugin-java2wsdl + maven-plugin + Apache Tuscany Axis2 Maven Plugin for Java2WSDL + Implementation of Java2WSDL Generator + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany.sca.extensions.axis2.tools + tuscany-java2wsdl + ${extensionVersion} + compile + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java new file mode 100644 index 0000000000..a5f6158dcd --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java @@ -0,0 +1,153 @@ +/* + * 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.tools.java2wsdl.plugin; + +import java.util.Hashtable; +import java.util.Map; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorFactory; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate WSDL from a given Java class / interface + */ +public class Java2WSDLGeneratorMojo extends AbstractMojo +{ + + /** + * The name of the class for which the WSDL must be generated + * @parameter + * + */ + private String sourceClassName; + + /** + * The location where the wsdls should be generated into + * @parameter expression="${project.build.directory}\\java2wsdl-wsdl" + */ + private String targetLocation; + + /** + * The name of the wsdl file + * @parameter + */ + private String wsdlFilename; + + + /** + * Classpaths to be included + * @parameter + * + */ + String[] classpaths; + + /** + * The name of the service + * @parameter + */ + private String serviceName; + + /** + * The binding style for the service + * @parameter + */ + private String bindingStyle; + + /** + * The binding use option + * @parameter + */ + private String bindingUse; + + /** + * The soap address + * @parameter + */ + private String soapAddress; + + public void execute() throws MojoExecutionException + { + try + { + Java2WSDLGeneratorFactory.getInstance().createGenerator().generateWSDL(createOptionsMap ()); + } + catch ( Exception e ) + { + throw new MojoExecutionException("Exception in Java2WSDL Maven Plugin ", e); + } + } + + protected Map createOptionsMap() + { + Map optionsMap = new Hashtable(); + + optionsMap.put(Java2WSDLConstants.CLASSNAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSNAME_OPTION, new String[]{sourceClassName})); + + if ( targetLocation != null ) + { + optionsMap.put(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, new String[]{targetLocation})); + } + + if ( wsdlFilename != null ) + { + optionsMap.put(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, new String[]{wsdlFilename})); + } + + if ( classpaths != null && classpaths.length > 0 ) + { + optionsMap.put(Java2WSDLConstants.CLASSPATH_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, classpaths)); + } + + if ( serviceName != null ) + { + optionsMap.put(Java2WSDLConstants.SERVICE_NAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.SERVICE_NAME_OPTION, new String[]{serviceName})); + } + + if ( bindingStyle != null ) + { + optionsMap.put(Java2WSDLConstants.STYLE_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.STYLE_OPTION, new String[]{bindingStyle})); + } + + if ( bindingUse != null ) + { + optionsMap.put(Java2WSDLConstants.USE_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.USE_OPTION, new String[]{bindingUse})); + } + + if ( soapAddress != null ) + { + optionsMap.put(Java2WSDLConstants.LOCATION_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.LOCATION_OPTION, new String[]{soapAddress})); + } + + return optionsMap; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml new file mode 100644 index 0000000000..6561cf45c3 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml @@ -0,0 +1,39 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.plugins + parent + pom + Apache Tuscany Axis2 Maven Plugins + Maven plugins for the Axis2 extension + + + java2wsdl + wsdl2java + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt new file mode 100644 index 0000000000..9601ead3f6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt @@ -0,0 +1,1407 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Netscape Public License V1.1 + + AMENDMENTS + + The Netscape Public License Version 1.1 ("NPL") consists of the + Mozilla Public License Version 1.1 with the following Amendments, + including Exhibit A-Netscape Public License. Files identified with + "Exhibit A-Netscape Public License" are governed by the Netscape + Public License Version 1.1. + + Additional Terms applicable to the Netscape Public License. + I. Effect. + These additional terms described in this Netscape Public + License -- Amendments shall apply to the Mozilla Communicator + client code and to all Covered Code under this License. + + II. "Netscape's Branded Code" means Covered Code that Netscape + distributes and/or permits others to distribute under one or more + trademark(s) which are controlled by Netscape but which are not + licensed for use under this License. + + III. Netscape and logo. + This License does not grant any rights to use the trademarks + "Netscape", the "Netscape N and horizon" logo or the "Netscape + lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", + "Smart Browsing" even if such marks are included in the Original + Code or Modifications. + + IV. Inability to Comply Due to Contractual Obligation. + Prior to licensing the Original Code under this License, Netscape + has licensed third party code for use in Netscape's Branded Code. + To the extent that Netscape is limited contractually from making + such third party code available under this License, Netscape may + choose to reintegrate such code into Covered Code without being + required to distribute such code in Source Code form, even if + such code would otherwise be considered "Modifications" under + this License. + + V. Use of Modifications and Covered Code by Initial Developer. + V.1. In General. + The obligations of Section 3 apply to Netscape, except to + the extent specified in this Amendment, Section V.2 and V.3. + + V.2. Other Products. + Netscape may include Covered Code in products other than the + Netscape's Branded Code which are released by Netscape + during the two (2) years following the release date of the + Original Code, without such additional products becoming + subject to the terms of this License, and may license such + additional products on different terms from those contained + in this License. + + V.3. Alternative Licensing. + Netscape may license the Source Code of Netscape's Branded + Code, including Modifications incorporated therein, without + such Netscape Branded Code becoming subject to the terms of + this License, and may license such Netscape Branded Code on + different terms from those contained in this License. + + VI. Litigation. + Notwithstanding the limitations of Section 11 above, the + provisions regarding litigation in Section 11(a), (b) and (c) of + the License shall apply to all disputes relating to this License. + + EXHIBIT A-Netscape Public License. + + "The contents of this file are subject to the Netscape Public + License Version 1.1 (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.mozilla.org/NPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The Original Code is Mozilla Communicator client code, released + March 31, 1998. + + The Initial Developer of the Original Code is Netscape + Communications Corporation. Portions created by Netscape are + Copyright (C) 1998-1999 Netscape Communications Corporation. All + Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the + terms of the _____ license (the "[___] License"), in which case + the provisions of [______] License are applicable instead of + those above. If you wish to allow use of your version of this + file only under the terms of the [____] License and not to allow + others to use your version of this file under the NPL, indicate + your decision by deleting the provisions above and replace them + with the notice and other provisions required by the [___] + License. If you do not delete the provisions above, a recipient + may use your version of this file under either the NPL or the + [___] License." + + ---------------------------------------------------------------------- + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/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/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml new file mode 100644 index 0000000000..c82dd860ed --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml @@ -0,0 +1,46 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.plugins + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-plugin-wsdl2java + maven-plugin + Apache Tuscany Axis2 Maven Plugin for WSDL2Java + Implementation of WSDL2Java Generator + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany.sca.extensions.axis2.tools + tuscany-wsdl2java + ${extensionVersion} + compile + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java new file mode 100644 index 0000000000..2d08c31326 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.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.tools.wsdl2java.plugin; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.List; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate SDO interface classes from an XML Schema + */ +public class WSDL2JavaGeneratorMojo extends AbstractMojo { + /** + * The directory containing wsdl files; defaults to ${basedir}/src/main/wsdl + * @parameter expression="${basedir}/src/main/wsdl" + */ + private String wsdlDir; + + /** + * Name of the wsdl file; if omitted all files in the directory are processed + * @parameter + */ + private File wsdlFile; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * @parameter + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * @parameter expression="${project.build.directory}/wsdl2java-source" + */ + private String targetDirectory; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * @parameter + */ + private WSDLFileOption[] wsdlFiles; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + private List compilerSourceRoots; + + public void execute() throws MojoExecutionException { + + if(null != wsdlFiles){ + for(int i=0; i< wsdlFiles.length ; ++i ){ + System.err.println("wsdlFiles" + wsdlFiles[i].getFileName()); + WSDLFileOption wf = wsdlFiles[i]; + + if(null == wf.getTargetDirectory()) + wf.setTargetDirectory(targetDirectory); + if(null == wf.getJavaPackage()){ + wf.setJavaPackage(javaPackage); + } + if(wf.getFileName() == null || wf.getFileName().length() ==0){ + throw new MojoExecutionException("no fileName specfied for wsdl."); + } + if(!wf.getFileName().canRead() || !wf.getFileName().isFile()){ + + throw new MojoExecutionException("file can not be read:"+wf.getFileName()); + } + + } + }else{ + + + + if (wsdlFile == null) { + + File[] files = new File(wsdlDir).listFiles(FILTER); + + wsdlFiles= new WSDLFileOption[files.length]; + for(int i= files.length -1; i> -1; --i){ + + + wsdlFiles[i] = new WSDLFileOption(); + wsdlFiles[i].setFileName(files[i]); + wsdlFiles[i].setJavaPackage(javaPackage); + wsdlFiles[i].setPorts(null); + wsdlFiles[i].setTargetDirectory(targetDirectory); + + + } + + } else { + wsdlFiles= new WSDLFileOption[]{new WSDLFileOption()}; + wsdlFiles[0].setFileName(wsdlFile); + wsdlFiles[0].setJavaPackage(javaPackage); + wsdlFiles[0].setPorts(null); + wsdlFiles[0].setTargetDirectory(targetDirectory); + } + } + + int genOptions = 0; + + for (int i = 0; i < wsdlFiles.length; i++) { + File file = wsdlFiles[i].getFileName(); + File marker = new File(targetDirectory, ".gen#" + file.getName()+".wsdl2java"); + if (file.lastModified() > marker.lastModified()) { + getLog().info("Generating Java service interfaces from " + file); + WSDL2JavaGenerator.generateFromWSDL(file.toString(), wsdlFiles[i].getPorts(), wsdlFiles[i].getTargetDirectory(), wsdlFiles[i].getJavaPackage(), null, genOptions); + } + try { + marker.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } + marker.setLastModified(System.currentTimeMillis()); + } + + compilerSourceRoots.add(targetDirectory); + } + + private static final FileFilter FILTER = new FileFilter() { + public boolean accept(File pathname) { + return (pathname.isFile() || !pathname.isHidden()); + } + }; +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java new file mode 100644 index 0000000000..3e6ebf0acc --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java @@ -0,0 +1,92 @@ +/* + * 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.tools.wsdl2java.plugin; + +import java.io.File; + +public class WSDLFileOption { + /** + * Name of the wsdl file; if omitted all files in the directory are processed + * + */ + private File fileName; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * + */ + private String targetDirectory; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + + private String ports[]; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + + + public WSDLFileOption(){} + + public String getJavaPackage() { + return javaPackage; + } + + public void setJavaPackage(String javaPackage) { + this.javaPackage = javaPackage; + } + + + public String[] getPorts() { + return ports; + } + + public void setPorts(String[] ports) { + this.ports = ports; + } + + public String getTargetDirectory() { + return targetDirectory; + } + + public void setTargetDirectory(String targetDirectory) { + this.targetDirectory = targetDirectory; + } + + public File getFileName() { + return fileName; + } + + public void setFileName(File fileName) { + this.fileName = fileName; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/pom.xml new file mode 100644 index 0000000000..a84a04565a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/pom.xml @@ -0,0 +1,181 @@ + + + + + + org.apache.tuscany.sca.extensions + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2 + parent + pom + Apache Tuscany SCA Extensions for Axis2 + + + + apache.ws + Apache WebServices Repository + http://ws.zones.apache.org/repository/ + legacy + + + + + + stable + + true + + + binding + databinding + tools + plugins + + samples + + + + + integration + + binding + databinding + tools + plugins + itests + samples + + + + + unstable + + binding + databinding + tools + plugins + itests + samples + + + + + + + + + + org.apache.axis2 + axis2-kernel + 1.1.1 + compile + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + compile + + + + org.apache.ws.commons.axiom + axiom-impl + 1.2.2 + compile + + + + incubator-woden + woden + 1.0.0M6 + runtime + + + + commons-logging + commons-logging + 1.1 + compile + + + + org.apache.neethi + neethi + 2.0 + runtime + + + + org.apache.ws.commons.schema + XmlSchema + 1.2 + compile + + + + commons-httpclient + commons-httpclient + 3.0.1 + runtime + + + + javax.mail + mail + 1.4 + compile + + + + backport-util-concurrent + backport-util-concurrent + 2.2 + runtime + + + + commons-codec + commons-codec + 1.3 + runtime + + + + httpcomponents-httpcore + jakarta-httpcore + 4.0-alpha2 + runtime + + + + xerces + xercesImpl + 2.8.1 + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt new file mode 100644 index 0000000000..0084319535 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/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/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt new file mode 100644 index 0000000000..d83ebbe236 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/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/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml new file mode 100644 index 0000000000..22dc92db52 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml @@ -0,0 +1,76 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-calculator-ws + war + Apache Tuscany Simple WebApp Sample + A sample WebApplication showing how to include a Tuscany runtime. + + + + org.apache.tuscany.samples.sca + sample-calculator + ${tuscanyVersion} + + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${tuscanyVersion} + + + + calculator + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + + + tuscany-war + + tuscany-war + + + + + + + org.apache.tuscany.sca.services.idl + tuscany-wsdl + ${tuscanyVersion} + + + org.apache.tuscany.sca.services.bindings + axis2 + ${tuscanyVersion} + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html new file mode 100644 index 0000000000..5d4e2cfcfb --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html @@ -0,0 +1,103 @@ + + + + + + + + + Tuscany Simple Calculator Sample + + + + + +

Tuscany Simple Calculator Sample

+ +

Overview

+ +

This sample illustrates the use of SCA to wire components together inside a composite. +All connections between the components are local and are defined using Java interfaces.

+ +

Location

+ +

This sample is located  in the + samples\standalone\calculator directory. All the + following commands should be issued while working in the sample + directory.

+ +

Prerequisites

+ +

Obtain the following prerequisites and install according to + their documentation.

+ + + +

Building

+ +

To build the sample  issue :

+
+mvn
+
+ +

The result after executing is in the target subdirectory the sample-calculator.jar

+ +

Setup

+ +

Set up the Tuscany standalone runtime environment using the + following command:

+
+mvn dependency:unpack 
+
+ +

After completion there should be a target\distribution subdirectory + created that has the Tuscany standalone runtime.

+ +

Running

+ +

Execute the following command: (cut and paste to command line)

+
+java -jar target/distribution/bin/launcher.jar target/sample-calculator.jar
+
+ +

Results

+ +

The sample when run should simply display to the standard + output:
+ +
3 + 2=5.0 +
3 - 2=1.0 +
3 * 2=6.0 +
3 / 2=1.5 +
+

+ + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl new file mode 100644 index 0000000000..0b97576479 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..deab967a2d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,35 @@ + + + + + + + CalculatorServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..200a448d24 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + + Apache Tuscany Simple Webapp Sample + + + TuscanyFilter + org.apache.tuscany.runtime.webapp.TuscanyFilter + + + TuscanyFilter + /* + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..7122eca852 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp @@ -0,0 +1,43 @@ +<%@ page import="calculator.CalculatorService" %> +<%@ page import="org.osoa.sca.CompositeContext" %> +<%@ page import="org.osoa.sca.CurrentCompositeContext" %> +<%-- + * 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. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + CompositeContext context = CurrentCompositeContext.getContext(); + CalculatorService calc = context.locateService(CalculatorService.class, "CalculatorServiceComponent"); +%> + +Calculator sample + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= calc.add(2, 3) %>
3 - 2<%= calc.subtract(3, 2) %>
+ + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html new file mode 100644 index 0000000000..695c7a7f73 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html @@ -0,0 +1,5 @@ + + +Hello World + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset new file mode 100644 index 0000000000..2a06794776 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset @@ -0,0 +1,172 @@ + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml new file mode 100644 index 0000000000..25ee6eff03 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml @@ -0,0 +1,76 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-helloworld-async-ws + jar + Apache Tuscany HelloWorld Web Service Sample + A sample HelloWorld Async Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldServer + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm new file mode 100644 index 0000000000..00494c1ec8 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm @@ -0,0 +1,66 @@ + + + +Tuscany +Hello World Web Service Sample + +

Tuscany +Hello World WS Sample

+

Overview

+

The Tuscany hello world ws sample shows using the Tuscany SCA +runtime in a Tomcat environment providing a web +service.

+

Location

+This sample is located  in the samples\sca\helloworldws +directory.
+

Setup

+Set up your server as described in the Tomcat +Setup.  If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add + sample-helloworldws-incubating-M1.war +to your Tomcat's webapp directory. +

Running

+This service can be invoked by the Tuscany SCA helloworldwsclient or helloworldjsclient +sample.
+

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---wsdl
¦ helloworld.wsdl
¦
+---webapp
+---WEB-INF
web.xml
+

+ + + + + + + +
sca.moduleDefines 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
helloworld.wsdlWSDL for the service.
web.xmlStandard J2EE web application's web.xml
+

You may have noticed that there is no Java source for this +components implementation.  There reason is this sample reuses +the code from the helloworld sample to implement the service. +

diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat new file mode 100644 index 0000000000..74dca40d4c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat @@ -0,0 +1,16 @@ +@echo off +pushd target +jar -xf ..\apache-tomcat-5.5.17.zip +popd +copy target\sample-helloworldws-1.0-SNAPSHOT.war target\apache-tomcat-5.5.17\webapps +rem pushd target\apache-tomcat-5.5.17\webapps +rem md sample-helloworldws-1.0-SNAPSHOT +rem cd sample-helloworldws-1.0-SNAPSHOT +rem jar -xf ..\sample-helloworldws-1.0-SNAPSHOT.war +pushd target\apache-tomcat-5.5.17\shared +rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +popd +rem hack +mkdir target\apache-tomcat-5.5.17\shared\extension +copy target\apache-tomcat-5.5.17\shared\lib\axis2-1.0-SNAPSHOT.jar target\apache-tomcat-5.5.17\shared\extension diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java new file mode 100644 index 0000000000..adc48e85a4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java @@ -0,0 +1,27 @@ +/* + * 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.Remotable; + +@Remotable +public interface HelloWorldCallback { + + public void getGreetingsCallback(String getGreetingsReturn); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bfea7039ad --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,63 @@ +/* + * 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.Callback; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +@Scope("COMPOSITE") +public class HelloWorldImpl implements HelloWorldService { + + private HelloWorldCallback helloWorldCallback; + + @Callback + public void setHelloWorldCallback(HelloWorldCallback helloWorldCallback) { + this.helloWorldCallback = helloWorldCallback; + } + + public String getGreetings(String name) { + try { + helloWorldCallback.getGreetingsCallback("Hola " + name); + } catch (Throwable t) { + t.printStackTrace(); + } + return "This should not be seen"; + } + + public String getGreetings1(DataObject name) { + String firstName = name.getString("firstName"); + String lastName = name.getString("lastName"); + return "Hi " + firstName + " " + lastName; + } + + public void getGreetingsWithCallback(String name) { + try { + helloWorldCallback.getGreetingsCallback("Alo " + name); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..3db3b0cae4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.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 helloworld; + +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +@Callback(HelloWorldCallback.class) +public interface HelloWorldService { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + + public void getGreetingsWithCallback(String name); + +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..11c564eb19 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..9428cd047c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl new file mode 100644 index 0000000000..8d619ea894 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl new file mode 100644 index 0000000000..852f36e10d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl new file mode 100644 index 0000000000..49e8926aab --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl new file mode 100644 index 0000000000..8c1c36d466 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl new file mode 100644 index 0000000000..9a15675f9f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl new file mode 100644 index 0000000000..123bef83ff --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..1ffda4a82a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + + + Tuscany HelloWorld Web Service Sample + + + tuscany.systemScdlPath + /META-INF/tuscany/webapp.scdl + + + + tuscany.applicationScdlPath + /META-INF/sca/default.scdl + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml new file mode 100644 index 0000000000..fb92f856c3 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml @@ -0,0 +1,80 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + tuscany-sample-helloworld-async-wsclient + jar + Apache Tuscany HelloWorld Web Service Async Client Sample + A sample client for a HelloWorld Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2.samples + tuscany-sample-helloworld-async-ws + test + 0.1-integration-incubating-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldClient + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat new file mode 100644 index 0000000000..0b9f69d8bd --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat @@ -0,0 +1,53 @@ +@echo off +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" +popd +rem move target\standalone\extension\axiom-api-1.0.jar target\standalone\boot +rem move target\standalone\extension\axiom-impl-1.0.jar target\standalone\boot +rem move target\standalone\extension\axis2-kernel-1.0.jar target\standalone\boot +rem move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\commons-codec-1.3.jar target\standalone\boot +rem move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +rem move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +rem move target\standalone\extension\neethi-1.0.1.jar target\standalone\boot +rem move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\XmlSchema-1.0.2.jar target\standalone\boot +rem move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\wstx-asl-2.9.3.jar target\standalone\boot +rem move target\standalone\extension\commons-logging-1.0.3.jar target\standalone\boot + + +move target\standalone\extension\axiom-api-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axiom-impl-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-common-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-core-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\woden-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl4j-1.5.2.jar target\standalone\boot +move target\standalone\extension\avalon-framework-4.1.3.jar target\standalone\boot +move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\commons-codec-1.2.jar target\standalone\boot +move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +move target\standalone\extension\commons-logging-1.1.jar target\standalone\boot +move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +move target\standalone\extension\log4j-1.2.12.jar target\standalone\boot +move target\standalone\extension\logkit-1.0.1.jar target\standalone\boot +move target\standalone\extension\neethi-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\servlet-api-2.3.jar target\standalone\boot +move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\XmlSchema-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot + + + +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" %* diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat new file mode 100644 index 0000000000..4b687a6aab --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat @@ -0,0 +1,16 @@ +@echo off +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" +rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\axis2\1.0-SNAPSHOT\axis2-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 +copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\databinding\databinding-sdo\1.0-SNAPSHOT\databinding-sdo-1.0-SNAPSHOT.jar" target\standalone\extension +rem copy "%USERPROFILE%\.m2\repository\org\apache\tuscany\bindings\axis2\1.0-SNAPSHOT\axis2-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-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" %* diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java new file mode 100644 index 0000000000..adc48e85a4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java @@ -0,0 +1,27 @@ +/* + * 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.Remotable; + +@Remotable +public interface HelloWorldCallback { + + public void getGreetingsCallback(String getGreetingsReturn); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..f59c409f45 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,40 @@ +/* + * 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 invoke a web service asynchronously with a callback + */ + +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldLocal helloWorldLocal = + compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent"); + helloWorldLocal.getGreetings("John"); + + // Sleep for 5 seconds to wait the callback to happen + Thread.sleep(5000); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java new file mode 100644 index 0000000000..a5b9074af0 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.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.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +@Service +public interface HelloWorldLocal { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..fc64f62a7b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,38 @@ +/* + * 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.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + +@Remotable +@Service +@Callback(HelloWorldCallback.class) +public interface HelloWorldService { + + public String getGreetings(String name); + @DataType(name="commonj.sdo.DataObject") + public String getGreetings1(DataObject name); + + public void getGreetingsWithCallback(String name); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..132b44efd8 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,58 @@ +/* + * 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.Scope; +import org.osoa.sca.annotations.Service; + +import commonj.sdo.DataObject; + + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + +@Service(HelloWorldLocal.class) +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldLocal, HelloWorldCallback { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } + + public String getGreetings1(DataObject name) { + return helloWorldService.getGreetings1(name); + } + + public void getGreetingsCallback(String getGreetingsReturn) { + System.out.println("Callback: " + getGreetingsReturn); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..11c564eb19 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..b0936e9916 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,46 @@ + + + + + + + + + HelloWorldService + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..78e24f1633 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties @@ -0,0 +1,29 @@ +# 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. +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..9822287a85 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java new file mode 100644 index 0000000000..535258f780 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java @@ -0,0 +1,46 @@ +package helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldWSAsyncClient extends SCATestCase { + + private HelloWorldLocal helloWorldLocal; + + @Override + protected void setUp() throws Exception { + try { + setApplicationSCDL(HelloWorldCallback.class, "META-INF/sca/default.scdl"); + ClassLoader classLoader = getClass().getClassLoader(); + addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl")); + + super.setUp(); + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + helloWorldLocal = + compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent"); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + public void testWSClient() throws Exception { + try { + String msg = helloWorldLocal.getGreetings("John"); + Assert.assertEquals(msg, "Hola John"); + + // Sleep for 2 seconds to wait the callback to happen + Thread.sleep(2000); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl new file mode 100644 index 0000000000..ec3643cf00 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml new file mode 100644 index 0000000000..2bc95796db --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml @@ -0,0 +1,94 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-om-ws + jar + Tuscany HelloWorld Axiom Web Service Sample + A sample HelloWorld Web Service using Axiom OM. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + compile + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.om.HelloWorldServer + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm new file mode 100644 index 0000000000..2c0f3c2eb1 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm @@ -0,0 +1,48 @@ + + +Tuscany +Hello World Web Service Sample + +

Tuscany +Hello World WS Sample

+

Overview

+

The Tuscany hello world ws sample shows using the Tuscany SCA +runtime in a Tomcat environment providing a web +service.

+

Location

+This sample is located  in the samples\sca\helloworldws +directory.
+

Setup

+Set up your server as described in the Tomcat +Setup.  If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add + sample-helloworldws-incubating-M1.war +to your Tomcat's webapp directory. +

Running

+This service can be invoked by the Tuscany SCA helloworldwsclient or helloworldjsclient +sample.
+

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---wsdl
¦ helloworldOM.wsdl
¦
+---webapp
+---WEB-INF
web.xml
+

+ + + + + + + +
sca.moduleDefines 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
helloworldOM.wsdlWSDL for the service.
web.xmlStandard J2EE web application's web.xml
+

You may have noticed that there is no Java source for this +components implementation.  There reason is this sample reuses +the code from the helloworldOM sample to implement the service. +

diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat new file mode 100755 index 0000000000..f612aabb75 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat @@ -0,0 +1,16 @@ +@echo off +pushd target +jar -xf ..\apache-tomcat-5.5.17.zip +popd +copy target\sample-helloworldws-1.0-SNAPSHOT.war target\apache-tomcat-5.5.17\webapps +rem pushd target\apache-tomcat-5.5.17\webapps +rem md sample-helloworldws-1.0-SNAPSHOT +rem cd sample-helloworldws-1.0-SNAPSHOT +rem jar -xf ..\sample-helloworldws-1.0-SNAPSHOT.war +pushd target\apache-tomcat-5.5.17\shared +rem jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +jar -xf "%USERPROFILE%\.m2\repository\org\apache\tuscany\web\1.0-SNAPSHOT\web-1.0-SNAPSHOT-bin.zip" +popd +rem hack +mkdir target\apache-tomcat-5.5.17\shared\extension +copy target\apache-tomcat-5.5.17\shared\lib\axis2-1.0-SNAPSHOT.jar target\apache-tomcat-5.5.17\shared\extension diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java new file mode 100644 index 0000000000..6705ec5a4a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java @@ -0,0 +1,45 @@ +/* + * 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.om; + + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public OMElement getGreetings(OMElement requestOM) { + String name = requestOM.getFirstElement().getText(); + + OMFactory omFactory = OMAbstractFactory.getOMFactory(); + OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld"); + OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld"); + responseOM.addChild(param); + param.addChild(omFactory.createOMText("Hello " + name)); + + return responseOM; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java new file mode 100644 index 0000000000..d68a6a39ad --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java @@ -0,0 +1,28 @@ +package helloworld.om; + + +import java.io.IOException; + +import org.apache.tuscany.api.SCARuntime; + +public class HelloWorldServer { + + /** + * @param args + */ + public static void main(String[] args) { + + SCARuntime.start("helloworldws-om.composite"); + + try { + System.out.println("HelloWorld server started"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + SCARuntime.stop(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java new file mode 100644 index 0000000000..8c17d68a4d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Service +@Remotable +@DataType(name="org.apache.axiom.om.OMElement") +public interface HelloWorldService { + + public OMElement getGreetings(OMElement name); + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite new file mode 100644 index 0000000000..e881aa2c70 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite @@ -0,0 +1,34 @@ + + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl new file mode 100644 index 0000000000..2c23e45e31 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..f14dd65ff3 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java @@ -0,0 +1,44 @@ +/* + * 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.om; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; + +import junit.framework.TestCase; + +public class HelloWorldServerTestCase extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("helloworldws-om.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml new file mode 100644 index 0000000000..18a7213ee9 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml @@ -0,0 +1,95 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-om-wsclient + jar + Tuscany HelloWorld Axiom Web Service Client Sample + A sample client for a HelloWorld Web Service using Axiom. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + compile + + + + org.apache.tuscany.sca.extensions.axis2.samples + tuscany-sample-helloworld-om-ws + runtime + 0.1-integration-incubating-SNAPSHOT + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.om.HelloWorldClient + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat new file mode 100755 index 0000000000..51079f2443 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat @@ -0,0 +1,53 @@ +@echo off +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" +popd +rem move target\standalone\extension\axiom-api-1.0.jar target\standalone\boot +rem move target\standalone\extension\axiom-impl-1.0.jar target\standalone\boot +rem move target\standalone\extension\axis2-kernel-1.0.jar target\standalone\boot +rem move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\commons-codec-1.3.jar target\standalone\boot +rem move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +rem move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +rem move target\standalone\extension\neethi-1.0.1.jar target\standalone\boot +rem move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\XmlSchema-1.0.2.jar target\standalone\boot +rem move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot +rem move target\standalone\extension\wstx-asl-2.9.3.jar target\standalone\boot +rem move target\standalone\extension\commons-logging-1.0.3.jar target\standalone\boot + + +move target\standalone\extension\axiom-api-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axiom-impl-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-common-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\axis2-core-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\woden-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\wsdl4j-1.5.2.jar target\standalone\boot +move target\standalone\extension\avalon-framework-4.1.3.jar target\standalone\boot +move target\standalone\extension\common-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\commons-codec-1.2.jar target\standalone\boot +move target\standalone\extension\commons-httpclient-3.0.jar target\standalone\boot +move target\standalone\extension\commons-logging-1.1.jar target\standalone\boot +move target\standalone\extension\ecore-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-change-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\ecore-xmi-2.2.1-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\junit-3.8.1.jar target\standalone\boot +move target\standalone\extension\log4j-1.2.12.jar target\standalone\boot +move target\standalone\extension\logkit-1.0.1.jar target\standalone\boot +move target\standalone\extension\neethi-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\sdo-api-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\servlet-api-2.3.jar target\standalone\boot +move target\standalone\extension\tuscany-sdo-impl-1.0-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\XmlSchema-SNAPSHOT.jar target\standalone\boot +move target\standalone\extension\xsd-2.2.1-SNAPSHOT.jar target\standalone\boot + + + +java %java_debug_set% -jar target\standalone\bin\launcher.jar --classpath "%USERPROFILE%\.m2\repository\org\apache\tuscany\samples\sca\sample-helloworldwsclient\1.0-SNAPSHOT\sample-helloworldwsclient-1.0-SNAPSHOT.jar" %* diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java new file mode 100644 index 0000000000..d0b3cef2af --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java @@ -0,0 +1,84 @@ +/* + * 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.om; + +import helloworld.om.HelloWorldService; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNode; +import org.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; +import static java.lang.System.out; + + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + + + +public class HelloWorldClient { + + private static final String TARGET_NAMESPACE = "http://helloworld-om"; + + public final static void main(String[] args) throws Exception { + + SCARuntime.start("helloworldwsclient-om.composite"); + + // Invoke the HelloWorld service + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldService helloWorldService= compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + OMFactory fac= OMAbstractFactory.getOMFactory(); + + //create operation + OMElement opE = fac.createOMElement("getGreetings", TARGET_NAMESPACE, "helloworld"); + //create parm + OMElement parmE = fac.createOMElement("name", TARGET_NAMESPACE, "helloworld"); + //and value. + opE.addChild(parmE); + StringBuilder sb= new StringBuilder(1000); + for(String s : args){ + sb.append(s); + } + parmE.addChild(fac.createOMText(sb.toString())); + + OMElement value = helloWorldService.getGreetings(parmE); + printTRee(value); + + out.println(value); + out.flush(); + + SCARuntime.stop(); + } + + private static void printTRee(OMElement value) { + + out.println(value); + for(OMNode n = value.getFirstOMChild(); n != null; n= n.getNextOMSibling()){ + if(n instanceof OMElement) printTRee((OMElement) n); + else out.println(n); + } + out.flush(); + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java new file mode 100644 index 0000000000..dfeac6a8d8 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld.om; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.api.annotation.DataType; +import org.osoa.sca.annotations.Service; +import org.osoa.sca.annotations.Remotable; + + +@Service +@Remotable +@DataType(name="org.apache.axiom.om.OMElement") +public interface HelloWorldService { + + public OMElement getGreetings(OMElement parmE); + +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..740ac68f7f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.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.om; + +import helloworld.om.HelloWorldService; + +import org.apache.axiom.om.OMElement; +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ + + +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public void setHelloWorldService(HelloWorldService helloWorldService) { + + this.helloWorldService = helloWorldService; + } + + public OMElement getGreetings(OMElement name) { + + return helloWorldService.getGreetings(name); + } + +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite new file mode 100644 index 0000000000..7b9b8fd08c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..6ff8d23044 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# 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. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl new file mode 100644 index 0000000000..2c23e45e31 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..6f3ab19d9f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld.om; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMText; +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.core.test.SCATestCaseRunner; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase extends TestCase { + + private HelloWorldService helloWorldService; + + private SCATestCaseRunner server; + + @Override + protected void setUp() throws Exception { + server = new SCATestCaseRunner(HelloWorldServerTest.class); + server.setUp(); + + SCARuntime.start("helloworldwsclient-om.composite"); + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + + } + + public void testWSClient() { + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld"); + OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld"); + requestOM.addChild(parmE); + parmE.addChild(fac.createOMText("petra")); + OMElement responseOM = helloWorldService.getGreetings(requestOM); + OMElement child = (OMElement)responseOM.getFirstElement(); + Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText()); + } + + @Override + protected void tearDown() throws Exception { + server.tearDown(); + SCARuntime.stop(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java new file mode 100644 index 0000000000..0c78f9c9be --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java @@ -0,0 +1,44 @@ +/* + * 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.om; + +import java.io.IOException; +import java.net.Socket; + +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; + +public class HelloWorldServerTest extends TestCase { + + @Override + protected void setUp() throws Exception { + SCARuntime.start("helloworldws-om.composite"); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @Override + protected void tearDown() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml new file mode 100644 index 0000000000..599e2e44af --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml @@ -0,0 +1,136 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-helloworld-oneway-ws + war + Tuscany Greeter Web Service Sample + A sample Greeter OneWay Web Service. + + + axis2 + + + + + org.osoa + sca-api-r1.0 + 0.1-integration-incubating-SNAPSHOT + compile + + + org.apache.tuscany.sca.kernel + tuscany-api + ${pom.version} + compile + + + + commonj + sdo-api-r2.1 + 0.1-integration-incubating-SNAPSHOT + compile + + + org.apache.tuscany.sca.kernel + tuscany-core + ${pom.version} + runtime + + + javax.servlet + servlet-api + 2.5 + provided + + + org.apache.tuscany.sca.services.bindings + axis2 + ${pom.version} + runtime + + + org.apache.tuscany.sca.services.databinding + databinding-axiom + ${pom.version} + runtime + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + ${pom.version} + runtime + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${pom.version} + runtime + + + org.apache.tuscany.sca.runtime.webapp + webapp-host + ${pom.version} + runtime + + + org.apache.ws.commons.axiom + axiom-api + SNAPSHOT + compile + + + org.apache.ws.commons.axiom + axiom-impl + SNAPSHOT + runtime + + + junit + junit + 4.2 + test + + + + + + sample-greeterws-oneway-0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + + + tuscany-war + + tuscany-war + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java new file mode 100644 index 0000000000..a38187b552 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java @@ -0,0 +1,31 @@ +/* + * 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 greeter; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(GreeterService.class) +@Scope("COMPOSITE") +public class GreeterImpl implements GreeterService { + + public void greet(String name) { + System.out.println("Hello " + name); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java new file mode 100644 index 0000000000..fef29e17e5 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java @@ -0,0 +1,31 @@ +/* + * 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 greeter; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +@Remotable +@Service +public interface GreeterService { + + @OneWay + public void greet(String name); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl new file mode 100644 index 0000000000..9dfe244d8e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl new file mode 100644 index 0000000000..b1dbb078c6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl @@ -0,0 +1,40 @@ + + + + + + + + + + + GreeterServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl new file mode 100644 index 0000000000..852f36e10d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl new file mode 100644 index 0000000000..6c902e24ad --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl new file mode 100644 index 0000000000..8c1c36d466 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl new file mode 100644 index 0000000000..b30777b8c6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl new file mode 100644 index 0000000000..f7d51a1437 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..8bfbd86496 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + + + Tuscany Greeter Web Service Sample + + + tuscany.systemScdlPath + /META-INF/tuscany/webapp.scdl + + + + tuscany.applicationScdlPath + /META-INF/sca/default.scdl + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml new file mode 100644 index 0000000000..d234485b09 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml @@ -0,0 +1,96 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-helloworld-oneway-wsclient + jar + Tuscany HelloWorld Web Service Async Client Sample + A sample client for a HelloWorld Web Service. + + axis2 + + + + + commonj + sdo-api-r2.1 + ${tuscanyVersion} + compile + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.bindings + axis2 + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.databinding + databinding-sdo + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + greeter.GreeterClient + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java new file mode 100644 index 0000000000..1aa3dce320 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package greeter; + +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class GreeterClient { + + public final static void main(String[] args) throws Exception { + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + GreeterLocal greeterLocal = + compositeContext.locateService(GreeterLocal.class, "GreeterServiceComponent"); + greeterLocal.greet("John"); + System.out.println("Sleeping for 5 seconds ..."); + Thread.sleep(5000); + System.out.println("Done ..."); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java new file mode 100644 index 0000000000..fc17992dbf --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package greeter; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class GreeterImpl implements GreeterLocal { + + private GreeterService greeterService; + + @Reference + public void setGreeterService(GreeterService greeterService) { + this.greeterService = greeterService; + } + + public void greet(String name) { + this.greeterService.greet(name); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java new file mode 100644 index 0000000000..7cf650f73b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java @@ -0,0 +1,24 @@ +/* + * 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 greeter; + +public interface GreeterLocal { + public void greet(String name); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java new file mode 100644 index 0000000000..57279b8a7c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.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 greeter; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +@Remotable +@Service +public interface GreeterService { + @OneWay + public void greet(String name); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..c450e10408 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,42 @@ + + + + + + + + + + + GreeterService + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl new file mode 100644 index 0000000000..9dfe244d8e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java new file mode 100644 index 0000000000..1f017744de --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java @@ -0,0 +1,58 @@ +/* + * 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 greeter; + +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class GreeterWSOneWayClient extends SCATestCase { + + private GreeterLocal greeterLocal; + + @Override + protected void setUp() throws Exception { + try { + setApplicationSCDL(GreeterService.class, "META-INF/sca/default.scdl"); + ClassLoader classLoader = getClass().getClassLoader(); + addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl")); + + super.setUp(); + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + greeterLocal = compositeContext.locateService(GreeterLocal.class, "GreeterServiceComponent"); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } + + public void testWSClient() { + try { + greeterLocal.greet("John"); + + System.out.println("Sleeping ..."); + Thread.sleep(5000); + + System.out.println("Done ..."); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl new file mode 100644 index 0000000000..ec3643cf00 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml new file mode 100644 index 0000000000..cb389d168b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml @@ -0,0 +1,83 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-ws + jar + Tuscany HelloWorld Web Service Sample + A sample HelloWorld Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + org.apache.tuscany.sca.services + tuscany-http-jetty + runtime + 0.1-integration-incubating-SNAPSHOT + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldServer + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0de3c70303 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..2f09cd77f0 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,28 @@ +package helloworld; + + +import java.io.IOException; + +import org.apache.tuscany.api.SCARuntime; + +public class HelloWorldServer { + + /** + * @param args + */ + public static void main(String[] args) { + + SCARuntime.start("helloworldws.composite"); + + try { + System.out.println("HelloWorld server started"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + SCARuntime.stop(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..bd527ff8e2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.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.Remotable; +import org.osoa.sca.annotations.Service; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +@Service +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..ac1bb3f20d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite @@ -0,0 +1,33 @@ + + + + + + + + HelloWorldServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite new file mode 100644 index 0000000000..c288471c14 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite @@ -0,0 +1,36 @@ + + + + + + + + + + 8080 + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..0b95fbd14f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..c2d1a5067b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java @@ -0,0 +1,48 @@ +/* + * 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 java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import junit.framework.TestCase; + +public class HelloWorldServerTestCase { + + @Before + public void startServer() throws Exception { + SCARuntime.start("helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @After + public void stopServer() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml new file mode 100644 index 0000000000..cef8bc7885 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml @@ -0,0 +1,87 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.samples + parent + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + + 4.0.0 + tuscany-sample-helloworld-wsclient + jar + Tuscany HelloWorld Web Service Client Sample + A sample client for a HelloWorld Web Service. + + + + org.apache.tuscany.sca.kernel + tuscany-api + compile + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.extensions.axis2 + tuscany-axis2 + runtime + 0.1-integration-incubating-SNAPSHOT + + + + org.apache.tuscany.sca.extensions.axis2.samples + tuscany-sample-helloworld-ws + runtime + 0.1-integration-incubating-SNAPSHOT + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + helloworld.HelloWorldClient + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..764cdac3bd --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,41 @@ +/* + * 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.apache.tuscany.api.SCARuntime; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + SCARuntime.start("helloworldwsclient.composite"); + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + HelloWorldService helloWorldService= compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + SCARuntime.stop(); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..82ce2d6db8 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/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; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Service; + +@Remotable +@Service +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite new file mode 100644 index 0000000000..07f930ba37 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..3dca310cdb --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties @@ -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. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..0b95fbd14f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..ef45608d69 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.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 helloworld; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.core.test.SCATestCaseRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase { + + private HelloWorldService helloWorldService; + + private SCATestCaseRunner server; + + @Before + public void startClient() throws Exception { + SCARuntime.start("helloworldwsclient.composite"); + + CompositeContext compositeContext = CurrentCompositeContext.getContext(); + helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent"); + + server = new SCATestCaseRunner(HelloWorldServerTest.class); + server.before(); + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + } + + @After + public void stopClient() throws Exception { + server.after(); + SCARuntime.stop(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java new file mode 100644 index 0000000000..647398281b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java @@ -0,0 +1,46 @@ +/* + * 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 java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.api.SCARuntime; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class HelloWorldServerTest { + + @Before + public void startServer() throws Exception { + SCARuntime.start("helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8080); + } + + @After + public void stopServer() throws Exception { + SCARuntime.stop(); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml new file mode 100644 index 0000000000..df0bfcb34b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml @@ -0,0 +1,85 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-loanapplication-ws + war + Tuscany Loan App Conversation Web Service Sample + A sample implementation of a loan application conversation web service. + + + + org.osoa + sca-api-r1.0 + + + org.apache.tuscany.sca.runtime.webapp + webapp-api + ${scaImplVersion} + runtime + + + + + ${artifactId} + + + org.apache.tuscany.sca.runtime.webapp + tuscany-war-plugin + ${scaImplVersion} + + + tuscany-war + + tuscany-war + + + + + + + false + + + + + org.apache.tuscany.sca.services.bindings + axis2 + ${scaImplVersion} + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java new file mode 100644 index 0000000000..68564f1376 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.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 loanappconversation; + +public class LoanApplication { + + private String customerName; + private float loanAmount; + + public LoanApplication(String customerName, float loanAmount) { + this.customerName = customerName; + this.loanAmount = loanAmount; + } + + public String toString() { + return "[Customer: " + customerName + ", loan amount: " + + loanAmount + "]"; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java new file mode 100644 index 0000000000..4156c2e72e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java @@ -0,0 +1,40 @@ +/* + * 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 loanappconversation; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.EndConversation; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +@Scope("CONVERSATION") +@Remotable +@AllowsPassByReference // bypasses the PassByValueIntercept error. +public interface LoanService { + //prim void apply(LoanApplication application); + void apply(String customerName, float loanAmount); + void lockCurrentRate(int termInYears); + @OneWay + void cancelApplication(); + String getLoanStatus(); + String display(); + @EndsConversation + void close(); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java new file mode 100644 index 0000000000..c0c7d9a455 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Scope("CONVERSATION") +@AllowsPassByReference // bypasses the PassByValueIntercept error. +@Remotable +@Service(LoanService.class) +public class LoanServiceImpl implements LoanService { + + private LoanApplication application; + private String status; + private int termLocked = 0; + + private void apply(LoanApplication application) { + this.application = application; + status = "open"; + } + //prim + public void apply(String customerName, float loanAmount) { + apply(new LoanApplication(customerName, loanAmount)); + + } + + public void lockCurrentRate(int termInYears) { + termLocked = termInYears; + status = "locked"; + } + + public void cancelApplication() { + status = "cancelled"; + } + + public String getLoanStatus() { + return status; + } + + public String display() { + return "Loan application: " + application + ", term: " + + termLocked + ", status: " + status; + } + + public void close() { + this.application = null; + this.status = "closed"; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl new file mode 100644 index 0000000000..6822aa8c5d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl new file mode 100644 index 0000000000..a35af74047 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl @@ -0,0 +1,41 @@ + + + + + + + + + + + + LoanServiceComponent + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..6449f9d232 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + + + + A sample implementation of a loan application conversation web service. + + + + tuscany.online + true + + + + + org.apache.tuscany.runtime.webapp.TuscanyContextListener + + + + TuscanyServlet + Tuscany Servlet + org.apache.tuscany.runtime.webapp.TuscanyServlet + + + + TuscanyServlet + /* + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml new file mode 100644 index 0000000000..7ba7dbbf6e --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml @@ -0,0 +1,85 @@ + + + + + org.apache.tuscany.samples.sca + parent + 0.1-integration-incubating-SNAPSHOT + + 4.0.0 + tuscany-sample-loanapplication-wsclient + jar + Tuscany Loan App Conversation WS Client + A sample implementation conversation WS client. + + + + org.apache.tuscany.sca.kernel + tuscany-api + 0.1-integration-incubating-SNAPSHOT + compile + + + + org.apache.tuscany.sca.kernel + tuscany-core + 0.1-integration-incubating-SNAPSHOT + runtime + + + + org.apache.tuscany.sca.services.bindings + axis2 + 0.1-integration-incubating-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + loanappconversation.LoanAppConversationClient + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.3 + + true + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java new file mode 100644 index 0000000000..6272821083 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanappconversation; + +//import org.apache.tuscany.spi.component.TargetNotFoundException; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class LoanAppConversationClient { + + public static void main(String[] args) throws Exception { + // Locate the MyClient component and invoke it + CompositeContext context = CurrentCompositeContext.getContext(); + + LoanClient loanClient = context.locateService(LoanClient.class, "LoanClientComponent"); + assert loanClient != null : "loanClient was not resolved!"; + loanClient.applyForLoan("John Doe", 1000.0f); + assert loanClient.isOpen() : "Failed loan not in approved state"; + System.out.println("Loan opened: " + loanClient.displayLoan()); + + + loanClient.cancelLoan(); + System.out.println("Sleeping to let cancel complete ..."); + Thread.sleep(5000); + + assert loanClient.isCancelled() : "Failed to cancel loan"; + System.out.println("Cancelled: " + loanClient.displayLoan()); + + loanClient.closeLoan(); + + System.out.println("Closing for a second time!"); + try{ + loanClient.closeLoan(); + assert false : "close for second time incorrectly succeed"; + System.out.println("Failed: close for second time incorrectly succeed."); + }catch(Exception e){ + System.out.println("Second close successfully produced: '" + e.getClass().getName() +"'"); + } + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java new file mode 100644 index 0000000000..68564f1376 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.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 loanappconversation; + +public class LoanApplication { + + private String customerName; + private float loanAmount; + + public LoanApplication(String customerName, float loanAmount) { + this.customerName = customerName; + this.loanAmount = loanAmount; + } + + public String toString() { + return "[Customer: " + customerName + ", loan amount: " + + loanAmount + "]"; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java new file mode 100644 index 0000000000..2de67508f6 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.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 loanappconversation; + +public interface LoanClient { + + void applyForLoan(String customerName, float amount); + boolean isApproved(); + boolean isOpen(); + boolean isCancelled(); + String displayLoan(); + void cancelLoan(); + void closeLoan(); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java new file mode 100644 index 0000000000..0869e1591a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java @@ -0,0 +1,63 @@ +/* + * 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 loanappconversation; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class LoanClientImpl implements LoanClient { + + private LoanService loanService; + + public boolean isApproved() { + return "approved".equals(loanService.getLoanStatus()); + } + + public boolean isOpen() { + return "open".equals(loanService.getLoanStatus()); + + } + + public boolean isCancelled() { + return "cancelled".equals(loanService.getLoanStatus()); + } + + @Reference + public void setLoanService(LoanService loanService) { + this.loanService = loanService; + } + + public void applyForLoan(String customerName, float amount) { + //prim loanService.apply(new LoanApplication(customerName, amount)); + loanService.apply(customerName, amount); + } + + public String displayLoan() { + return loanService.display(); + } + + public void cancelLoan() { + loanService.cancelApplication(); + } + + public void closeLoan() { + loanService.close(); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java new file mode 100644 index 0000000000..f516825229 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java @@ -0,0 +1,40 @@ +/* + * 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 loanappconversation; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.EndsConversation; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +@AllowsPassByReference // bypasses the PassByValueIntercept error. +@Scope("CONVERSATION") +@Remotable +public interface LoanService { + //prim void apply(LoanApplication application); + void apply(String customerName, float loanAmount); + void lockCurrentRate(int termInYears); + @OneWay + void cancelApplication(); + String getLoanStatus(); + String display(); + @EndsConversation + void close(); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..7d1d13eb54 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,40 @@ + + + + + + + LoanService + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl new file mode 100644 index 0000000000..6822aa8c5d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java new file mode 100644 index 0000000000..5ab428cf27 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java @@ -0,0 +1,63 @@ +/* + * 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 loanappconversation; + +import org.apache.tuscany.spi.component.TargetNotFoundException; +import org.apache.tuscany.test.SCATestCase; +import org.osoa.sca.CompositeContext; +import org.osoa.sca.CurrentCompositeContext; + +public class LoanAppConversationTestCase extends SCATestCase { + + private LoanClient loanClient; + + protected void setUp() throws Exception { + try { + setApplicationSCDL(LoanClient.class, "META-INF/sca/default.scdl"); + super.setUp(); + + CompositeContext context = CurrentCompositeContext.getContext(); + loanClient = context.locateService(LoanClient.class, "LoanClientComponent"); + } catch(Throwable e) { + e.printStackTrace(); + } + } + + public void test() throws Exception { + try { + loanClient.applyForLoan("John Doe", 1000.0f); + System.out.println("Applied: " + loanClient.displayLoan()); + System.out.println("Loan approved: " + loanClient.isApproved()); + loanClient.cancelLoan(); + System.out.println("Sleeping to let cancel complete ..."); + Thread.sleep(500); + System.out.println("Cancelled: " + loanClient.displayLoan()); + loanClient.closeLoan(); + try { + System.out.println("Trying to use the closed loan in the ended conversation ..."); + System.out.println("Closed: " + loanClient.displayLoan()); + fail("Target should not be found"); + } catch(Exception e) { + System.out.println("Target not found as expected"); + } + } catch(Throwable e) { + e.printStackTrace(); + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml new file mode 100644 index 0000000000..4cf1a72f07 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml @@ -0,0 +1,121 @@ + + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.samples + parent + pom + Tuscany Samples for the Axis2 extension + + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + + + stable + + true + + + helloworld-ws + helloworld-wsclient + helloworld-om-ws + helloworld-om-wsclient + + + + + integration + + helloworld-ws + helloworld-wsclient + helloworld-om-ws + helloworld-om-wsclient + helloworld-async-ws + helloworld-async-wsclient + + + + + unstable + + helloworld-ws + helloworld-wsclient + helloworld-om-ws + helloworld-om-wsclient + helloworld-async-ws + helloworld-async-wsclient + + + + + + + + + org.codehaus.mojo + dependency-maven-plugin + + + + org.apache.tuscany.distribution.sca + standalone + ${scaImplVersion} + bin + zip + + + ${project.build.directory}/distribution + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml new file mode 100644 index 0000000000..c6f29fcea8 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml @@ -0,0 +1,164 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.tools + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-java2wsdl + Apache Tuscany Axis2 Java2WSDL Tool + Apache Tuscany Axis2 Java2WSDL Tool + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + + + + stax + stax-api + + + + wsdl4j + wsdl4j + + + + org.apache.neethi + neethi + + + + org.apache.ws.commons.schema + XmlSchema + + + + org.apache.ws.commons.axiom + axiom-api + + + + xerces + xercesImpl + + + + org.apache.ws.commons.axiom + axiom-impl + + + + org.apache.axis2 + axis2-kernel + + + + org.apache.axis2 + axis2-java2wsdl + + + + org.apache.axis2 + axis2-codegen + + + + org.eclipse.emf + codegen + + + + org.eclipse.emf + codegen-ecore + + + + annogen + annogen + + + + commons-logging + commons-logging + + + + org.codehaus.woodstox + wstx-asl + + + + junit + junit + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.0-incubator-SNAPSHOT + + + generate-sdo + generate-test-sources + + ${basedir}/src/test/resources/CreditScoreDocLit.wsdl + org.example.creditscore.doclit + true + true + true + + + generate + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java new file mode 100644 index 0000000000..3cb699681c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java @@ -0,0 +1,435 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * This class encapsulates the parameters that effect the generation of the + * WSDL. For example they contain all user settings such as source class, + * target location etc. + * + */ +public class GenerationParameters implements TuscanyJava2WSDLConstants +{ + public static final String WSDL_FILENAME_SUFFIX = ".wsdl"; + public static final String XSD_IMPORT_DELIMITER = "[,]"; + + private Map cmdLineOptions = null; + private FileOutputStream outputFileStream = null; + private String sourceClassName = null; + + private ArrayList extraClasses; + private String attrFormDefault = null; + private String elementFormDefault = null; + private String targetNamespace = null; + private String targetNamespacePrefix = null; + private String schemaTargetNamespace = null; + private String schemaTargetNamespacePrefix = null; + private ClassLoader classLoader = null; + private String serviceName = null; + private String style = DOCUMENT; + private String use = LITERAL; + private String locationUri = DEFAULT_LOCATION_URL; + private Map schemaLocationMap = null; + + public GenerationParameters(Map cmdLineOptions) throws Exception + { + this.cmdLineOptions = cmdLineOptions; + loadParameters(); + } + + protected void loadParameters() throws Exception + { + initializeSourceClassName(); + resolveFileOutputStream(); + resolveClassLoader4InputClasspath(); + loadSchemaLocationMap(); + initializeOtherParams(); + } + + private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) { + //short option gets precedence + Java2WSDLCommandLineOption option = null; + if (longOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption); + if (option != null) { + return option; + } + } + if (shortOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption); + } + + return option; + } + + protected void initializeSourceClassName() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSNAME_OPTION, CLASSNAME_OPTION_LONG); + sourceClassName = option == null ? null : option.getOptionValue(); + + if (sourceClassName == null || sourceClassName.equals("")) { + throw new Exception("class name must be present!"); + } + } + + /** + * @throws Exception + */ + protected void resolveFileOutputStream() throws Exception + { + File outputFolder; + Java2WSDLCommandLineOption option = loadOption(OUTPUT_LOCATION_OPTION, + OUTPUT_LOCATION_OPTION_LONG); + String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue(); + + outputFolder = new File(outputFolderName); + if (!outputFolder.exists()) { + outputFolder.mkdirs(); + } else if (!outputFolder.isDirectory()) { + throw new Exception("The specified location " + outputFolderName + "is not a folder"); + } + + option = loadOption(OUTPUT_FILENAME_OPTION, + OUTPUT_FILENAME_OPTION_LONG); + String outputFileName = option == null ? null : option.getOptionValue(); + //derive a file name from the class name if the filename is not specified + if (outputFileName == null) + { + outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX; + } + + //first create a file in the given location + File outputFile = new File(outputFolder, outputFileName); + try + { + if (!outputFile.exists()) + { + outputFile.createNewFile(); + } + outputFileStream = new FileOutputStream(outputFile); + } + catch (IOException e) + { + throw new Exception(e); + } + } + + protected void addToSchemaLocationMap(String optionValue) throws Exception + { + //option value will be of the form [namespace, schemalocation] + //hence we take the two substrings starting after '[' and upto ',' and + //starting after ',' and upto ']' + getSchemaLocationMap().put(optionValue.substring(1, optionValue.indexOf(COMMA)), + optionValue.substring(optionValue.indexOf(COMMA) + 1, optionValue.length() - 1)); + + + } + + protected void loadSchemaLocationMap() throws Exception + { + Java2WSDLCommandLineOption option = loadOption(IMPORT_XSD_OPTION, IMPORT_XSD_OPTION_LONG); + + if (option != null) + { + ArrayList optionValues = option.getOptionValues(); + + for ( int count = 0 ; count < optionValues.size() ; ++count ) + { + addToSchemaLocationMap(((String)optionValues.get(count)).trim()); + } + } + } + + protected void resolveClassLoader4InputClasspath() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSPATH_OPTION, CLASSPATH_OPTION_LONG); + + if (option != null) { + ArrayList optionValues = option.getOptionValues(); + URL[] urls = new URL[optionValues.size()]; + String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]); + + try { + for (int i = 0; i < classPathEntries.length; i++) { + String classPathEntry = classPathEntries[i]; + //this should be a file(or a URL) + if (Java2WSDLUtils.isURL(classPathEntry)) { + urls[i] = new URL(classPathEntry); + } else { + urls[i] = new File(classPathEntry).toURL(); + } + } + } catch (MalformedURLException e) { + throw new Exception(e); + } + + classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); + + } else { + classLoader = Thread.currentThread().getContextClassLoader(); + } + } + + protected void initializeOtherParams() + { +// set the other parameters to the builder + Java2WSDLCommandLineOption option = loadOption(SCHEMA_TARGET_NAMESPACE_OPTION, + SCHEMA_TARGET_NAMESPACE_OPTION_LONG); + schemaTargetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, + SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG); + schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_OPTION, + TARGET_NAMESPACE_OPTION_LONG); + targetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_PREFIX_OPTION, + TARGET_NAMESPACE_PREFIX_OPTION_LONG); + targetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SERVICE_NAME_OPTION, + SERVICE_NAME_OPTION_LONG); + serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue(); + + option = loadOption(STYLE_OPTION,STYLE_OPTION); + style = (option == null) ? null : option.getOptionValue(); + + + option = loadOption(LOCATION_OPTION, + LOCATION_OPTION); + locationUri = (option == null) ? null : option.getOptionValue(); + + option = loadOption(USE_OPTION,USE_OPTION); + use = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ATTR_FORM_DEFAULT_OPTION, ATTR_FORM_DEFAULT_OPTION_LONG); + attrFormDefault = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ELEMENT_FORM_DEFAULT_OPTION,ELEMENT_FORM_DEFAULT_OPTION_LONG); + elementFormDefault = option == null ? null : option.getOptionValue(); + + option = loadOption(TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION, + TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG); + extraClasses = option == null ? new ArrayList() : option.getOptionValues(); + } + + public ClassLoader getClassLoader() + { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) + { + this.classLoader = classLoader; + } + + public String getLocationUri() + { + if ( locationUri == null ) + { + locationUri = DEFAULT_LOCATION_URL; + } + return locationUri; + } + + public void setLocationUri(String locationUri) + { + this.locationUri = locationUri; + } + + public FileOutputStream getOutputFileStream() + { + return outputFileStream; + } + + public void setOutputFileStream(FileOutputStream outputFileStream) + { + this.outputFileStream = outputFileStream; + } + + public String getSchemaTargetNamespace() throws Exception + { + if (schemaTargetNamespace == null + || schemaTargetNamespace.trim().equals("")) + { + this.schemaTargetNamespace = Java2WSDLUtils + .schemaNamespaceFromClassName(getSourceClassName(), getClassLoader()).toString(); + } + return schemaTargetNamespace; + } + + public void setSchemaTargetNamespace(String schemaTargetNamespace) + { + this.schemaTargetNamespace = schemaTargetNamespace; + } + + public String getSchemaTargetNamespacePrefix() + { + if (schemaTargetNamespacePrefix == null + || schemaTargetNamespacePrefix.trim().equals("")) + { + this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX; + } + + return schemaTargetNamespacePrefix; + } + + public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) + { + this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix; + } + + public String getServiceName() + { + if ( serviceName == null ) + { + serviceName = Java2WSDLUtils.getSimpleClassName(getSourceClassName()); + } + return serviceName; + } + + public void setServiceName(String serviceName) + { + this.serviceName = serviceName; + } + + public String getSourceClassName() + { + return sourceClassName; + } + + public void setSourceClassName(String sourceClassName) + { + this.sourceClassName = sourceClassName; + } + + public String getStyle() + { + if ( style == null ) + { + style = DOCUMENT; + } + return style; + } + + public void setStyle(String style) + { + this.style = style; + } + + public String getTargetNamespace() throws Exception + { + if ( targetNamespace == null ) { + targetNamespace = Java2WSDLUtils.namespaceFromClassName(this.sourceClassName, this.classLoader).toString(); + } + return targetNamespace; + } + + public void setTargetNamespace(String targetNamespace) + { + this.targetNamespace = targetNamespace; + } + + public String getTargetNamespacePrefix() + { + return targetNamespacePrefix; + } + + public void setTargetNamespacePrefix(String targetNamespacePrefix) + { + this.targetNamespacePrefix = targetNamespacePrefix; + } + + public String getUse() + { + if ( use == null ) + { + use = LITERAL; + } + return use; + } + + public void setUse(String use) + { + this.use = use; + } + + public Map getSchemaLocationMap() + { + if ( schemaLocationMap == null ) + { + schemaLocationMap = new Hashtable(); + } + return schemaLocationMap; + } + + public void setSchemaLocationMap(Map schemaLocationMap) { + this.schemaLocationMap = schemaLocationMap; + } + + public String getAttrFormDefault() { + if ( attrFormDefault == null ) + { + attrFormDefault = FORM_DEFAULT_QUALIFIED; + } + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + if ( elementFormDefault == null ) + { + elementFormDefault = FORM_DEFAULT_QUALIFIED; + } + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } + + public ArrayList getExtraClasses() { + return extraClasses; + } + + public void setExtraClasses(ArrayList extraClasses) { + this.extraClasses = extraClasses; + } +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java new file mode 100644 index 0000000000..8855c3f6e9 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.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.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; + +/** + * This class provides the tooling abstraction to Tuscany Java2WSDL and can be + * invoked from command line with the follwing options as with Axis2 Java2WSDL + * + */ +public class Java2WSDL { + /** + * @param args + */ + public static void main(String[] args) + { + //parse the cmd line args + Java2WSDLCommandLineOptionParser commandLineOptionParser = + new Java2WSDLCommandLineOptionParser(args); + // validate the arguments + validateCommandLineOptions(commandLineOptionParser); + + Java2WSDLGeneratorFactory.getInstance().createGenerator(). + generateWSDL(commandLineOptionParser.getAllOptions()); + + // Uncomment the following statement to directly run the Axis2 tool + // without + // runAxis2Tool(args); + } + + private static void runAxis2Tool(String[] args) { + org.apache.ws.java2wsdl.Java2WSDL.main(args); + } + + private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) { + if (parser.getAllOptions().size() == 0) { + printUsage(); + } else if (parser.getInvalidOptions(new TuscanyJava2WSDLOptionsValidator()).size() > 0) { + printUsage(); + } + + } + + public static void printUsage() { + System.out.println("Usage java2wsdl -cn : class file name"); + System.out.println("-o : output file location"); + System.out.println("-cp : list of classpath entries - (urls)"); + System.out.println("-tn : target namespace"); + System.out.println("-tp : target namespace prefix"); + System.out.println("-stn : target namespace for schema"); + System.out.println("-stp : target namespace prefix for schema"); + System.out.println("-sn : service name"); + System.out.println("-of : output file name for the WSDL"); + System.out.println("-st : style for the WSDL"); + System.out.println("-u : use for the WSDL"); + System.out.println("-l : address of the port for the WSDL"); + System.out.println("-ixsd [, ] : schemas to be imported (and not generated)"); + System.out.println("-efd : Setting for elementFormDefault (defaults to qualified)"); + System.out.println("-afd : Setting for attributeFormDefault (defaults to qualified)"); + System.out.println("-xc : Extra class for which schematype must be generated. " + + "\t\tUse as : -xc class1 -xc class2 ..."); + System.exit(0); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java new file mode 100644 index 0000000000..3323113af4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java @@ -0,0 +1,46 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Map; + +/** + * This is the Java2WSDL Generator facade that will be used by Tuscany + * components for java to wsdl conversion. + * + */ +public interface Java2WSDLGenerator { + public void generateWSDL(String[] args); + + public void generateWSDL(Map commandLineOptions); + + public void addWSDLGenListener(WSDLGenListener l); + + public void removeWSDLGenListener(WSDLGenListener l); + + public Map getCommandLineOptions(); + + public void setCommandLineOptoins(Map cmdLineOpts); + + public OutputStream getOutputStream(); + + public void setOutputStream(OutputStream outStream); + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java new file mode 100644 index 0000000000..e8f3db95b0 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.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.tools.java2wsdl.generate; + +import java.util.Vector; + +/** + * Factory that creates Java2WSDL Generators. Presently the there is a Default + * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory + * can be extended to create generators that wrap around other implementations + * if required. + */ + +public class Java2WSDLGeneratorFactory { + /* + * singleton instance of this factory class + */ + private static Java2WSDLGeneratorFactory factory = null; + + /** + * code for the default generator + */ + public static final int DEFAULT_GENERATOR = 0; + + /** + * Default Generator class name + */ + public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl"; + + /** + * list of generator classnames in a position that corresponds to their + * code. For example the default generator's code is 0 and hence this + * generator's classname is stored at index '0' of the list + */ + protected Vector generatorClassNames = new Vector(); + + /** + * @return the singleton instance of this generator factory + */ + public static Java2WSDLGeneratorFactory getInstance() { + if (factory == null) { + factory = new Java2WSDLGeneratorFactory(); + } + return factory; + } + + private Java2WSDLGeneratorFactory() { + generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME); + } + + public Java2WSDLGenerator createGenerator() { + return createGenerator(DEFAULT_GENERATOR); + } + + /** + * creates an instance of a Java2WSDL Generator based on the input type + * + * @param genType + * type of the generator to be created + * @return an instance of a Java2WSDL Generator + */ + public Java2WSDLGenerator createGenerator(int genType) { + try { + return (Java2WSDLGenerator) (Class.forName(generatorClassNames + .elementAt(genType)).newInstance()); + } catch (Exception e) { + System.out + .println(" Unable to create Java2WSDL generator due to ....."); + System.out.println(e); + return null; + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java new file mode 100644 index 0000000000..9d1a9df438 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java @@ -0,0 +1,239 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.apache.ws.java2wsdl.Java2WSDL; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This is an implementation of the Java2WSDLGenerator facade. This + * implementation is a decorator around the Axis2 implementation of the + * Java2WSDL conversion. The WSDL generation is divided into phases that are + * stringed up as a template method. The phases are - User Input Validation - + * WSDL Java Model Generation - Serialization of WSDL Java Model The function of + * each phase is accomplished by delegation to the appropriate classes in Axis2. + * At the start and end of each phase an event is published to subcribers + * denoting the start and end of the phase. + * + * Such a spliting up of the Java2WSDL conversion into phases has been designed + * to enable interceptors to modify the model or apply transformations to the + * output. Typically the interceptors can subscribe to the start and end events + * of these phases and hence be able to intercept. + * + * Note: This class contains substantial AXIS2 Java2WSDL code refactored into + * it. These will be removed as and when the Axis2 code is fixed. + * + */ +public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator, TuscanyJava2WSDLConstants +{ + private List genPhaseListeners = new Vector(); + private GenerationParameters genParams = null; + private Map commandLineOptions = null; + private TuscanyJava2WSDLBuilder java2WsdlBuilder; + private OutputStream outputStream = null; + + public Java2WSDLGeneratorImpl() + { + + } + + private void multicastGenPhaseCompletionEvent(int genPhase) { + WSDLGenEvent event = new WSDLGenEvent(this, genPhase); + Iterator iterator = genPhaseListeners.iterator(); + while (iterator.hasNext()) { + ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event); + } + } + + private void initJava2WSDLBuilder() throws Exception + { +// Now we are done with loading the basic values - time to create the builder + java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams); + } + + protected boolean validateInputArgs(String[] args) + { + boolean isValid = true; + Java2WSDLCommandLineOptionParser parser = new Java2WSDLCommandLineOptionParser(args); + if (parser.getAllOptions().size() == 0) { + Java2WSDL.printUsage(); + isValid = false; + } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()) + .size() > 0) { + Java2WSDL.printUsage(); + isValid = false; + } + + if (isValid) + { + commandLineOptions = parser.getAllOptions(); + } + + return isValid; + } + + public boolean buildWSDLDocument() throws Exception + { + boolean isComplete = true; + initJava2WSDLBuilder(); + java2WsdlBuilder.buildWSDL(); + + return isComplete; + } + + public boolean serializeWSDLDocument() throws Exception { + boolean isComplete = true; + + if ( getOutputStream() == null ) + { + setOutputStream(genParams.getOutputFileStream()); + } + + java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream()); + getOutputStream().flush(); + getOutputStream().close();; + + return isComplete; + } + + /* + * This is the template method that splits the Java2WSDL generation cycle + * into phase / steps. + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[]) + */ + public void generateWSDL(Map commandLineOptions) + { + try + { + // load the user options into an easy to access abstraction + genParams = new GenerationParameters(commandLineOptions); + + // if the WSDL Model generation was successul + if ( buildWSDLDocument() ) + { + // multicast event for generation of wsdl model + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION); + // if the serialization of the generated (and fixed) model + // is successful + if (serializeWSDLDocument()) { + // multicast event for writing of the WSDL Model to + // supplied output stream + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + // TODO Auto-generated method stub + + } + + public void generateWSDL(String[] args) + { + // if the argument input are found to be valid + if (validateInputArgs(args)) + { + //multicast event for input args validation complete + multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION); + generateWSDL(commandLineOptions); + } + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void addWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.add(l); + + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void removeWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.remove(l); + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions() + */ + public Map getCommandLineOptions() { + return commandLineOptions; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map) + */ + public void setCommandLineOptoins(Map cmdLineOpts) { + commandLineOptions = cmdLineOpts; + } + + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream() + */ + public OutputStream getOutputStream() { + // TODO Auto-generated method stub + return outputStream; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream) + */ + public void setOutputStream(OutputStream outStream) { + outputStream = outStream; + } + + + public TuscanyJava2WSDLBuilder getJava2WsdlBuilder() + { + return java2WsdlBuilder; + } + + public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder) + { + this.java2WsdlBuilder = java2WsdlBuilder; + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java new file mode 100644 index 0000000000..67609445ae --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java @@ -0,0 +1,524 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.StringReader; +import java.lang.reflect.Constructor; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaGroupBase; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.XmlSchemaType; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JProperty; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XSDHelper; + +public class SchemaBuilder implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + private static int prefixCount = 1; + + public static final String MIXED = "mixed"; + + public static final String GROUP = "group"; + + protected String attrFormDefault = null; + + protected String elementFormDefault = null; + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private Hashtable schemaMap = new Hashtable(); + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected Map schemaLocationMap = null; + + private ClassLoader classLoader; + + protected SchemaBuilder(XmlSchemaCollection schemaCollection, + Hashtable schemaMap, + Hashtable nsPrefixMap, + TuscanyTypeTable typeTable, + String attrFormDef, + String eleFormDef, + Map schemaLocMap, + ClassLoader classLoader) { + this.schemaMap = schemaMap; + this.xmlSchemaCollection = schemaCollection; + this.targetNamespacePrefixMap = nsPrefixMap; + this.typeTable = typeTable; + this.schemaLocationMap = schemaLocMap; + this.classLoader = classLoader; + this.attrFormDefault = attrFormDef; + this.elementFormDefault = eleFormDef; + } + + private boolean isSDO(JClass javaType) throws Exception { + Class sdoClass = Class.forName(javaType.getQualifiedName(), + true, + classLoader); + return DataObject.class.isAssignableFrom(sdoClass); + } + + private void buildComplexTypeContents_JavaType(JClass javaType, + XmlSchemaComplexType complexType, + XmlSchema xmlSchema) throws Exception { + JProperty[] properties = javaType.getDeclaredProperties(); + + for (int i = 0; i < properties.length; i++) { + JProperty property = properties[i]; + String propertyName = property.getType().getQualifiedName(); + boolean isArryType = property.getType().isArrayType(); + if (isArryType) { + propertyName = property.getType().getArrayComponentType().getQualifiedName(); + } + + if (typeTable.isSimpleType(propertyName)) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName)); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } else { + QName schemaTypeName = null; + if (isArryType) { + schemaTypeName = generateSchema(property.getType().getArrayComponentType()); + } else { + schemaTypeName = generateSchema(property.getType()); + } + + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(schemaTypeName); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + + addImports(xmlSchema, + schemaTypeName); + } + } + } + + protected QName buildSchema_JavaType(JClass javaType) throws Exception { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(javaType, this.classLoader); + if (schemaTypeName == null) { + String simpleName = javaType.getSimpleName(); + + String packageName = javaType.getContainingPackage().getQualifiedName(); + + String targetNameSpace = + Java2WSDLUtils.schemaNamespaceFromClassName(javaType.getQualifiedName(), this.classLoader) + .toString(); + + XmlSchema xmlSchema = getXmlSchema(targetNameSpace); + String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace); + + schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + complexType.setName(simpleName); + + XmlSchemaSequence sequence = new XmlSchemaSequence(); + complexType.setParticle(sequence); + + createGlobalElement(xmlSchema, + complexType, + schemaTypeName); + xmlSchema.getItems().add(complexType); + xmlSchema.getSchemaTypes().add(schemaTypeName, + complexType); + + // adding this type to the table + // typeTable.addComplexScheam(name, complexType.getQName()); + typeTable.addComplexSchemaType(targetNameSpace, + simpleName, + schemaTypeName); + buildComplexTypeContents_JavaType(javaType, + complexType, + xmlSchema); + } + return schemaTypeName; + } + + protected QName buildSchema_SDO(Type dataType) // throws Exception + { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(), + dataType.getName()); + + if (schemaTypeName == null) { + // invoke XSDHelper to generate schema for this sdo type + XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); + // it is better to check if XSDHelper can generate the schema + if (xsdHelper.isXSD(dataType)) { + // if schemalocations for xsd has been specified, include them + includeExtXSD(dataType); + } else { + List typeList = new Vector(); + typeList.add(dataType); + + // the xsdhelper returns a string that contains the schemas for this type + String schemaDefns = xsdHelper.generate(typeList, + schemaLocationMap); + + // extract the schema elements and store them in the schema map + extractSchemas(schemaDefns); + } + // since the XSDHelper will not return the type name, create it and store it in typetable + schemaTypeName = new QName(dataType.getURI(), dataType.getName(), generatePrefix()); + typeTable.addComplexSchemaType(dataType.getURI(), + dataType.getName(), + schemaTypeName); + + } + return schemaTypeName; + } + + public QName generateSchema(JClass javaType) throws Exception { + if (isSDO(javaType)) { + Type dataType = createDataObject(javaType).getType(); + return buildSchema_SDO(dataType); + } else { + return buildSchema_JavaType(javaType); + } + } + + private XmlSchema getXmlSchema(String targetNamespace) { + XmlSchema xmlSchema; + + if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) { + String targetNamespacePrefix = generatePrefix(); + + xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + return xmlSchema; + } + + /** + * JAM convert first name of an attribute into UpperCase as an example if there is a instance variable called foo in a bean , then Jam give that + * as Foo so this method is to correct that error + * + * @param wrongName + * @return the right name, using english as the locale for case conversion + */ + public static String getCorrectName(String wrongName) { + if (wrongName.length() > 1) { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH) + + wrongName.substring(1, + wrongName.length()); + } else { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH); + } + } + + private String addImports(XmlSchema xmlSchema, QName schemaTypeName) { + String prefix = null; + String[] prefixes = xmlSchema.getNamespaceContext().getDeclaredPrefixes(); + for (int count = 0; count < prefixes.length; ++count) { + if (schemaTypeName.getNamespaceURI(). + equals(xmlSchema.getNamespaceContext().getNamespaceURI(prefixes[count])) ) { + return prefixes[count]; + } + } + + // the following lines are executed only if a prefix was not found which implies that the + // schemaTypeName was not imported earlier and also it does not belong to the targetnamespace + String schemaLocation = null; + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + prefix = generatePrefix(); + //it is safe to cast like this since it was this class that instantiated the + //NamespaceContext and assigned it to an instance of a NamespaceMap (see method getXmlSchema) + ((NamespaceMap)xmlSchema.getNamespaceContext()).put(prefix, + schemaTypeName.getNamespaceURI()); + + return prefix; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + private void createGlobalElement(XmlSchema xmlSchema, + XmlSchemaComplexType complexType, + QName elementName) { + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaTypeName(complexType.getQName()); + globalElement.setName(formGlobalElementName(complexType.getName())); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + } + + private DataObject createDataObject(JClass sdoClass) throws Exception { + Class sdoType = Class.forName(sdoClass.getQualifiedName(), + true, + classLoader); + + Constructor constructor = sdoType.getDeclaredConstructor(new Class[0]); + constructor.setAccessible(true); + Object instance = constructor.newInstance(new Object[0]); + return (DataObject) instance; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + private void includeExtXSD(Type dataType) { + // now we know there is a type for which the xsd must come from outside + // create a schema for the namespace of this type and add an include in it for + // the xsd that is defined externally + XmlSchema xmlSchema = getXmlSchema(dataType.getURI()); + + // ideally there could be more than one external schema defintions for a namespace + // and hence schemalocations will be a list of locations + // List schemaLocations = (List)schemaLocationMap.get(dataType.getURI()); + + // since as per the specs the input to XSDHelper is a map of allowing + // only one schemalocation for a namespace. So for now this single location will be + // picked up and put into a list + List schemaLocations = new Vector(); + + if (schemaLocationMap.get(dataType.getURI()) != null) { + schemaLocations.add(schemaLocationMap.get(dataType.getURI())); + } + + if (schemaLocations.size() <= 0) { + schemaLocations.add(DEFAULT_SCHEMA_LOCATION); + } + + Iterator includesIterator = xmlSchema.getIncludes().getIterator(); + Iterator schemaLocIterator = schemaLocations.iterator(); + String aSchemaLocation = null; + boolean includeExists = false; + // include all external schema locations + while (schemaLocIterator.hasNext()) { + aSchemaLocation = (String) schemaLocIterator.next(); + while (includesIterator.hasNext()) { + if (!includeExists + && aSchemaLocation.equals(((XmlSchemaInclude) includesIterator.next()).getSchemaLocation())) { + includeExists = true; + } + } + + if (!includeExists) { + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(aSchemaLocation); + xmlSchema.getIncludes().add(includeElement); + xmlSchema.getItems().add(includeElement); + } + } + + } + + private void extractSchemas(String schemaDefns) { + // load each schema element and add it to the schema map + + String token = getToken(schemaDefns); + int curIndex = schemaDefns.indexOf(token); + int nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + + while (curIndex != -1) { + StringReader sr = null; + if (nextIndex != -1) + sr = new StringReader(schemaDefns.substring(curIndex, + nextIndex)); + else + sr = new StringReader(schemaDefns.substring(curIndex)); + + XmlSchemaCollection collection = new XmlSchemaCollection(); + XmlSchema aSchema = collection.read(sr, + null); + addSchemaToMap(aSchema); + + curIndex = nextIndex; + nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + } + } + + private void addSchemaToMap(XmlSchema extractedSchema) { + // check if a Schema object already exists in schema map for targetNamespace of this schema element + // if it does then copy the contents of this schema element to the existing one, ensuring that + // duplicate elements are not created. i.e. before adding some child element like 'include' or 'import' + // check if it already exists, if it does don't add this + XmlSchema existingSchema = (XmlSchema) schemaMap.get(extractedSchema.getTargetNamespace()); + + if (existingSchema == null) { + extractedSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + extractedSchema.setElementFormDefault(getElementFormDefaultSetting()); + schemaMap.put(extractedSchema.getTargetNamespace(), + extractedSchema); + + } else { + copySchemaItems(existingSchema, + extractedSchema); + } + } + + private void copySchemaItems(XmlSchema existingSchema, XmlSchema aSchema) { + // items to copy are imports, includes, elements, types ... + // each item is checked if it is a duplicate entry and copied only if it isn't + Iterator itemsIterator = aSchema.getItems().getIterator(); + Object schemaObject = null; + XmlSchemaElement schemaElement = null; + XmlSchemaType schemaType = null; + XmlSchemaInclude schemaInclude = null; + QName qName = null; + List existingIncludes = getExistingIncludes(existingSchema); + + while (itemsIterator.hasNext()) { + schemaObject = itemsIterator.next(); + if (schemaObject instanceof XmlSchemaElement) { + schemaElement = (XmlSchemaElement) schemaObject; + qName = schemaElement.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getElements().add(qName, + schemaElement); + existingSchema.getItems().add(schemaElement); + } + } else if (schemaObject instanceof XmlSchemaType) { + schemaType = (XmlSchemaType) itemsIterator.next(); + qName = schemaType.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getSchemaTypes().add(qName, + schemaType); + existingSchema.getItems().add(schemaType); + // add imports + addImports(existingSchema, + qName); + } + } else if (schemaObject instanceof XmlSchemaInclude) { + schemaInclude = (XmlSchemaInclude) itemsIterator.next(); + if (!existingIncludes.contains(schemaInclude.getSchemaLocation())) { + existingSchema.getIncludes().add(schemaInclude); + existingSchema.getItems().add(schemaInclude); + } + } + } + } + + private List getExistingIncludes(XmlSchema xmlSchema) { + List includeSchemaLocations = new Vector(); + Iterator iterator = xmlSchema.getIncludes().getIterator(); + + while (iterator.hasNext()) { + includeSchemaLocations.add(((XmlSchemaInclude) iterator.next()).getSchemaLocation()); + } + return includeSchemaLocations; + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private String getToken(String s) { + // get the schema element name eg. "); + writeSchemas(writer); + writer.write(""); + + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader(new ByteArrayInputStream(writer.toString() + .getBytes())); + + StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader); + OMElement documentElement = staxOMBuilders.getDocumentElement(); + + + Iterator iterator = documentElement.getChildElements(); + while (iterator.hasNext()) { + wsdlTypes.addChild((OMNode) iterator.next()); + } + defintions.addChild(wsdlTypes); + } + + private void writeSchemas(StringWriter writer) { + Iterator iterator = schemaCollection.iterator(); + XmlSchema xmlSchema = null; + + while (iterator.hasNext()) { + xmlSchema = (XmlSchema) iterator.next(); + // typeIterator = xmlSchema.getSchemaTypes().getValues(); + /* + * while (typeIterator.hasNext()) { xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next()); } + */ + xmlSchema.write(writer); + } + } + + private void generateMessages(OMFactory fac, OMElement definitions) throws Exception { + Hashtable namespaceMap = new Hashtable(); + String namespacePrefix = null; + String namespaceURI = null; + QName messagePartType = null; + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + // Request Message + OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + requestMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + MESSAGE_SUFFIX, + null); + definitions.addChild(requestMessge); + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName())) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + // avoid duplicate namespaces + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + + OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + requestMessge.addChild(requestPart); + requestPart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName(), + null); + } + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName() + + RESPONSE)) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + // Response Message + OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + responseMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + definitions.addChild(responseMessge); + OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + responseMessge.addChild(responsePart); + responsePart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE, + null); + } + } + } + + // now add these unique namespaces to the the definitions element + Enumeration enumeration = namespaceMap.keys(); + while (enumeration.hasMoreElements()) { + namespaceURI = (String) enumeration.nextElement(); + definitions.declareNamespace(namespaceURI, + (String) namespaceMap.get(namespaceURI)); + } + } + + /** + * Generate the porttypes + */ + private void generatePortType(OMFactory fac, OMElement defintions) { + JMethod jmethod = null; + OMElement operation = null; + OMElement message = null; + OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, + wsdl); + defintions.addChild(portType); + portType.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + PORT_TYPE_SUFFIX, + null); + // adding message refs + for (int i = 0; i < method.length; i++) { + jmethod = method[i]; + + if (jmethod.isPublic()) { + operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + portType.addChild(operation); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + message = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + jmethod.getSimpleName() + + MESSAGE_SUFFIX, + null); + operation.addChild(message); + + if (!jmethod.getReturnType().isVoidType()) { + message = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + operation.addChild(message); + } + } + } + + } + + /** + * Generate the service + */ + public void generateService(OMFactory fac, OMElement defintions) { + OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, + wsdl); + defintions.addChild(service); + service.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName(), + null); + OMElement port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP11PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + + port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + SOAP12BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap12, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + } + + /** + * Generate the bindings + */ + private void generateBinding(OMFactory fac, OMElement defintions) throws Exception { + generateSoap11Binding(fac, + defintions); + generateSoap12Binding(fac, + defintions); + } + + private void generateSoap11Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + + addExtensionElement(fac, + operation, + soap, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void generateSoap12Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap12, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + operation.declareNamespace(URI_WSDL12_SOAP, + SOAP12_PREFIX); + + addExtensionElement(fac, + operation, + soap12, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value, + String att2Name, + String att2Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + soapbinding.addAttribute(att2Name, + att2Value, + null); + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + } + + private String generatePrefix() { + return NAMESPACE_PREFIX + prefixCount++; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java new file mode 100644 index 0000000000..b23726f6fa --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.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.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +public class TuscanyJava2WSDLBuilder implements Java2WSDLConstants { + + private OutputStream out; + private String className; + private ClassLoader classLoader; + private String wsdlPrefix = "wsdl"; + + // these apply for the WSDL + private GenerationParameters generationParams; + + private OMElement wsdlDocument = null; + + public String getWsdlPrefix() { + return wsdlPrefix; + } + + public void setWsdlPrefix(String wsdlPrefix) { + this.wsdlPrefix = wsdlPrefix; + } + + public TuscanyJava2WSDLBuilder(GenerationParameters genParams) { + this.generationParams = genParams; + } + + /** + * Externally visible generator method + * + * @throws Exception + */ + public void buildWSDL() throws Exception { + ArrayList excludeOpeartion = new ArrayList(); + excludeOpeartion.add("init"); + excludeOpeartion.add("setOperationContext"); + excludeOpeartion.add("destroy"); + + TuscanyWSDLTypesGenerator typesGenerator = new TuscanyWSDLTypesGenerator(generationParams); + typesGenerator.setExcludeMethods(excludeOpeartion); + Collection schemaCollection = typesGenerator.buildWSDLTypes(); + + TuscanyJava2OMBuilder java2OMBuilder = + new TuscanyJava2OMBuilder(typesGenerator.getMethods(), schemaCollection, typesGenerator + .getTypeTable(), generationParams); + + wsdlDocument = java2OMBuilder.generateOM(); + } + + public OMElement getWsdlDocument() { + return wsdlDocument; + } + + public void setWsdlDocument(OMElement wsdlDocument) { + this.wsdlDocument = wsdlDocument; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java new file mode 100644 index 0000000000..cde870fff4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java @@ -0,0 +1,51 @@ +/* + * 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.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +/** + * This is a extension from the Axis2 Java2WSDLConstants to handle additions specific to Tuscany. + * This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public interface TuscanyJava2WSDLConstants extends Java2WSDLConstants +{ + public static final char OPEN_BRACKET = '['; + public static final char COMMA = ','; + public static final char CLOSE_BRACKET = ']'; + public static final String DEFAULT_SCHEMA_LOCATION = "*.xsd"; + public static final String SCHEMA_ELEMENT_NAME = "schema"; + + String FORM_DEFAULT_QUALIFIED = "qualified"; + String FORM_DEFAULT_UNQUALIFIED = "unqualified"; + + //short options + String IMPORT_XSD_OPTION = "ixsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION = "afd"; + String ELEMENT_FORM_DEFAULT_OPTION = "efd"; + String EXTRA_CLASSES_DEFAULT_OPTION = "xc"; + + //long options + String IMPORT_XSD_OPTION_LONG = "import_xsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION_LONG = "attributeFormDefault"; + String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault"; + String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses"; +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java new file mode 100644 index 0000000000..6411327abf --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This class is an extension from the Axis2 implementation in order to handle additional optoins + * specific to Tuscany. This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public class TuscanyJava2WSDLOptionsValidator extends Java2WSDLOptionsValidator implements + TuscanyJava2WSDLConstants { + public boolean isInvalid(Java2WSDLCommandLineOption option) { + boolean invalid; + String optionType = option.getOptionType(); + + invalid = !((IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION).equalsIgnoreCase(optionType) + || !super.isInvalid(option)); + + invalid = validateImportXSDOption(invalid, + option); + + return invalid; + } + + private boolean validateImportXSDOption(boolean invalid, Java2WSDLCommandLineOption option) { + String optionType = option.getOptionType(); + String schemaNSLocationPair = null; + + if (!invalid && (IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType)) { + ArrayList optionValues = option.getOptionValues(); + + for (int count = 0; count < optionValues.size(); ++count) { + schemaNSLocationPair = ((String) optionValues.get(count)).trim(); + if ((schemaNSLocationPair.charAt(0) != OPEN_BRACKET) + || (schemaNSLocationPair.charAt(schemaNSLocationPair.length() - 1) != CLOSE_BRACKET) + || (schemaNSLocationPair.indexOf(COMMA) == -1)) + + { + System.out.println("Schema Namespace-Location pair option not specified properly!!"); + invalid = true; + } + } + } + + return invalid; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java new file mode 100644 index 0000000000..4f3371126d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java @@ -0,0 +1,410 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + + +public class TuscanySchemaGenerator implements TuscanyJava2WSDLConstants +{ + public static final String NAME_SPACE_PREFIX = "stn_"; + public static final String PERIOD_SEPARATOR = "."; + private static int prefixCount = 1; + + protected String attrFormDefault = null; + protected String elementFormDefault = null; + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + protected Hashtable schemaMap = new Hashtable(); + protected Hashtable sdoAnnoMap = new Hashtable(); + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + protected SchemaBuilder schemaBuilder = null; + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + private ClassLoader classLoader; + private String className; + + // to keep loadded method using JAM + private JMethod methods []; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + private String schemaTargetNameSpace; + private String schema_namespace_prefix; + private Class clazz; + private ArrayList excludeMethods = new ArrayList(); + + public TuscanySchemaGenerator(ClassLoader loader, + String className, + String schematargetNamespace, + String schematargetNamespacePrefix, + Map schemaLocMap) + throws Exception + { + DataObjectUtil.initRuntime(); + this.classLoader = loader; + this.className = className; + clazz = Class.forName(className, true, loader); + methodTable = new MethodTable(clazz); + this.schemaTargetNameSpace = schematargetNamespace; + this.schema_namespace_prefix = schematargetNamespacePrefix; + this.schemaLocationMap = schemaLocMap; + + initializeSchemaMap(this.schemaTargetNameSpace, this.schema_namespace_prefix); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + getAttrFormDefault(), + getElementFormDefault(), + schemaLocMap, + this.classLoader ); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception + { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(classLoader); + jam_service_parms.includeClass(className); + JamService service = factory.createService(jam_service_parms); + + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) + { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType = null; + XmlSchemaSequence sequence = null; + QName methodPartSchemaTypeName = null; + for (int i = 0; i < methods.length; i++) + { + String methodName = methods[i].getSimpleName(); + JMethod jMethod = methods[i]; + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + //if (jMethod.getSimpleName().equals("init") + // || "setOperationContext".equals(jMethod.getSimpleName()) + // || "destroy".equals(jMethod.getSimpleName())) + // continue; + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) + { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + //create the schema type for the method wrapper + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) + { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + ( parameterNames != null && parameterNames[j] != null )? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + QName methodReturnSchemaTypeName = null; + + if (!returnType.isVoidType()) + { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + //generateWrapperElements(methods); + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception + { + boolean isArrayType = type.isArrayType(); + if ( isArrayType ) + { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if ( schemaTypeName == null ) + { + schemaTypeName = + schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema)schemaMap.get(schemaTargetNameSpace), schemaTypeName); + + } + else + { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray ) + { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if ( isArray ) + { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) + { + XmlSchema xmlSchema = (XmlSchema)schemaMap.get(schemaTargetNameSpace); + QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, globalElement); + + typeTable.addComplexSchemaType(this.schemaTargetNameSpace, globalElement.getName(), elementName); + + return complexType; + } + + + private String formGlobalElementName(String typeName) + { + String firstChar = typeName.substring(0,1); + return typeName.replaceFirst(firstChar, firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) + { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); + schemaMap.put(targetNamespace, xmlSchema); + + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + private void setFormDefaults() + { + + } + + public Hashtable getSdoAnnoMap() { + return sdoAnnoMap; + } + + public void setSdoAnnoMap(Hashtable sdoAnnoMap) { + this.sdoAnnoMap = sdoAnnoMap; + } + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) + { + //decide whether there must be an import or an include + if ( xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI()) ) + { + XmlSchema containingSchema = (XmlSchema)schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if ( containingSchema.getTypeByName(schemaTypeName) == null ) + { + String schemaLocation = null; + if ( (schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null ) + { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if ( !xmlSchema.getIncludes().contains(includeElement) ) + { + xmlSchema.getIncludes().add(includeElement); + } + } + } + else + { + if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values(). + contains(schemaTypeName.getNamespaceURI())) + { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap)xmlSchema.getNamespaceContext()). + put(generatePrefix(), schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + public String getAttrFormDefault() { + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java new file mode 100644 index 0000000000..4abd7a7ce7 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java @@ -0,0 +1,225 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; + +public class TuscanyTypeTable +{ + public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema"; + public static final String XS_URI_PREFIX = "xs"; + public static final QName XS_QNAME = new QName(XML_SCHEMA_URI, "schema", XS_URI_PREFIX); + public static final String DELIMITER = "#"; + + private Hashtable simpleXSDTypes; + private Hashtable complexXSDTypes; + + public static String asQualifiedName(String uri, String typeName) + { + return (uri + DELIMITER + typeName); + } + + + public TuscanyTypeTable() + { + simpleXSDTypes = new Hashtable(); + complexXSDTypes = new Hashtable(); + populateSimpleXSDTypes(); + populateStdSDOTypes(); + } + + private void populateStdSDOTypes() + { + simpleXSDTypes.put("Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("Bytes", + new QName(XML_SCHEMA_URI, "hexBinary", XS_URI_PREFIX)); + simpleXSDTypes.put("Character", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("DataObject", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("Day", + new QName(XML_SCHEMA_URI, "gDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Decimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + simpleXSDTypes.put("Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("Duration", + new QName(XML_SCHEMA_URI, "duration", XS_URI_PREFIX)); + simpleXSDTypes.put("Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("Int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("Integer", + new QName(XML_SCHEMA_URI, "integer", XS_URI_PREFIX)); + simpleXSDTypes.put("Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("Month", + new QName(XML_SCHEMA_URI, "gMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("monthDay", + new QName(XML_SCHEMA_URI, "gMonthDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Object", + new QName(XML_SCHEMA_URI, "anySimpleType", XS_URI_PREFIX)); + simpleXSDTypes.put("Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Strings", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Time", + new QName(XML_SCHEMA_URI, "time", XS_URI_PREFIX)); + simpleXSDTypes.put("Year", + new QName(XML_SCHEMA_URI, "gYear", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonth", + new QName(XML_SCHEMA_URI, "gYearMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonthDay", + new QName(XML_SCHEMA_URI, "date", XS_URI_PREFIX)); + simpleXSDTypes.put("URI", + new QName(XML_SCHEMA_URI, "anyURI", XS_URI_PREFIX)); + } + + private void populateSimpleXSDTypes() { + //todo pls use the types from org.apache.ws.commons.schema.constants.Constants + simpleXSDTypes.put("int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("char", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Integer", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Character", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Calendar", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Object", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.math.BigDecimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + + // Any types + simpleXSDTypes.put(OMElement.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(ArrayList.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(Vector.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(List.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + } + + public QName getStdSdoType(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public QName getComplexSchemaTypeName(String sdoURI, String sdoTypeName) + { + return (QName) complexXSDTypes.get(asQualifiedName(sdoURI, sdoTypeName)); + } + + public QName getComplexSchemaTypeName(JClass javaClass, ClassLoader cl) throws Exception + { + String namespace = Java2WSDLUtils.schemaNamespaceFromClassName( + javaClass.getQualifiedName(), cl).toString(); + return (QName) complexXSDTypes.get(asQualifiedName(namespace, javaClass.getSimpleName())); + } + + public boolean isSimpleType(String typeName) + { + Iterator keys = simpleXSDTypes.keySet().iterator(); + while (keys.hasNext()) { + String s = (String) keys.next(); + if (s.equals(typeName)) { + return true; + } + } + return false; + } + + public QName getSimpleSchemaTypeName(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public void addSimpleSchemaType(String typeName, QName schemaType) + { + simpleXSDTypes.put(typeName, schemaType); + } + + + public void addComplexSchemaType(String namespaceURI, String name, QName schemaType) + { + complexXSDTypes.put(asQualifiedName(namespaceURI, name), schemaType); + } + + + public QName getQNamefortheType(String namespaceURI, String typeName) + { + if ( XML_SCHEMA_URI.equals(namespaceURI)) + { + return getSimpleSchemaTypeName(typeName); + } + else + { + return getComplexSchemaTypeName(namespaceURI, typeName); + } + } +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java new file mode 100644 index 0000000000..a742e8913d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java @@ -0,0 +1,373 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + +public class TuscanyWSDLTypesGenerator implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + public static final String PERIOD_SEPARATOR = "."; + + private static int prefixCount = 1; + + protected GenerationParameters generationParams; + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected Hashtable schemaMap = new Hashtable(); + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected SchemaBuilder schemaBuilder = null; + + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + + // to keep loadded method using JAM + private JMethod methods[]; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + + private Class clazz; + + private ArrayList excludeMethods = new ArrayList(); + + public TuscanyWSDLTypesGenerator(GenerationParameters genParams) throws Exception { + DataObjectUtil.initRuntime(); + this.generationParams = genParams; + + clazz = Class.forName(generationParams.getSourceClassName(), + true, + generationParams.getClassLoader()); + methodTable = new MethodTable(clazz); + + initializeSchemaMap(generationParams.getSchemaTargetNamespace(), + generationParams.getSchemaTargetNamespacePrefix()); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + generationParams.getAttrFormDefault(), + generationParams.getElementFormDefault(), + generationParams.getSchemaLocationMap(), + generationParams.getClassLoader()); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(generationParams.getClassLoader()); + jam_service_parms.includeClass(generationParams.getSourceClassName()); + + for ( int count = 0 ; count < generationParams.getExtraClasses().size() ; ++count ) + { + jam_service_parms.includeClass((String)generationParams.getExtraClasses().get(count)); + } + + JamService service = factory.createService(jam_service_parms); + QName extraSchemaTypeName = null; + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + if ( jclass.getQualifiedName().equals(generationParams.getSourceClassName()) ) + { + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + //short the elements in the array + Arrays.sort(methods); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType; + XmlSchemaSequence sequence = null; + + for (int i = 0; i < methods.length; i++) { + JMethod jMethod = methods[i]; + + String methodName = methods[i].getSimpleName(); + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + //create the schema type for the method wrapper + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + + if (!returnType.isVoidType()) { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + } + else + { + //generate the schema type for extra classes + extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(jclass.getQualifiedName()); + if (extraSchemaTypeName == null) + { + extraSchemaTypeName = schemaBuilder.generateSchema(jclass); + } + } + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception { + boolean isArrayType = type.isArrayType(); + if (isArrayType) { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if (schemaTypeName == null) { + schemaTypeName = schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()), + schemaTypeName); + + } else { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if (isArray) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) throws Exception { + XmlSchema xmlSchema = (XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()); + QName elementName = new QName(generationParams.getSchemaTargetNamespace(), + localPartName, + generationParams.getSchemaTargetNamespacePrefix()); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + + typeTable.addComplexSchemaType(generationParams.getSchemaTargetNamespace(), + globalElement.getName(), + elementName); + + return complexType; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) { + //decide whether there must be an import or an include + if (xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI())) { + XmlSchema containingSchema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if (containingSchema.getTypeByName(schemaTypeName) == null) { + String schemaLocation = null; + if ((schemaLocation = (String) schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null) { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if (!xmlSchema.getIncludes().contains(includeElement)) { + xmlSchema.getIncludes().add(includeElement); + } + } + } else { + if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values() + .contains(schemaTypeName.getNamespaceURI())) { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap) xmlSchema.getNamespaceContext()).put(generatePrefix(), + schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java new file mode 100644 index 0000000000..26b3d092de --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java @@ -0,0 +1,38 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.EventObject; + +public class WSDLGenEvent extends EventObject { + private int generationPhase = WSDLGenListener.UNKNOWN; + + public WSDLGenEvent(Object source, int genPhase) { + super(source); + this.generationPhase = genPhase; + } + + public int getGenerationPhase() { + return generationPhase; + } + + public void setGenerationPhase(int generationPhase) { + this.generationPhase = generationPhase; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java new file mode 100644 index 0000000000..788d162f34 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java @@ -0,0 +1,39 @@ +/* + * 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.tools.java2wsdl.generate; + +public interface WSDLGenListener { + public static int UNKNOWN = 0; + + public static int INPUT_ARGS_PARSING = 1; + + public static int INPUT_ARGS_VALIDATION = 2; + + public static int WSDL_MODEL_CREATION = 3; + + public static int WSDL_MODEL_WRITING = 4; + + public static String[] phaseAsString = { "Unknown", + "Input Arguments Parsing", "Input Arguments Validation", + "WSDL Model Creation", "WSDL Model Writing" }; + + public void WSDLGenPhaseStarted(WSDLGenEvent event); + + public void WSDLGenPhaseCompleted(WSDLGenEvent event); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java new file mode 100644 index 0000000000..b30b8cd62b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java @@ -0,0 +1,143 @@ +/* + * 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.tools.java2wsdl.util; + +import java.util.ArrayList; +import java.util.List; + +public class XMLNameUtil { + + /** + * Returns a valid Java name from an XML Name. + * + * @param name + * @param isUpperCase + * @return a valid Java name from an XML Name + */ + public static String getJavaNameFromXMLName(String name, boolean isUpperCase) { + List parsedName = parseName(name, '_'); + StringBuilder result = new StringBuilder(64 * parsedName.size()); + for (String nameComponent: parsedName) { + if (nameComponent.length() > 0) { + if (result.length() > 0 || isUpperCase) { + result.append(Character.toUpperCase(nameComponent.charAt(0))); + result.append(nameComponent.substring(1)); + } else { + result.append(nameComponent); + } + } + } + + if (result.length() == 0) { + return "_"; + } + if (Character.isJavaIdentifierStart(result.charAt(0))) { + return isUpperCase ? result.toString() : decapitalizeName(result.toString()); + } + return "_" + result; + } + + /** + * Decapitalize a name. + * @param name + * @return a decapitalized name + */ + public static String decapitalizeName(String name) { + if (name.length() == 0) { + return name; + } else { + String lowerName = name.toLowerCase(); + int i; + for (i = 0; i < name.length(); i++) { + if (name.charAt(i) == lowerName.charAt(i)) { + break; + } + } + if (i > 1 && i < name.length()) { + --i; + } + return name.substring(0, i).toLowerCase() + name.substring(i); + } + } + + /** + * Parse the given name. + * + * @param sourceName + * @param separator + * @return some stuff parsed from the name + */ + private static List parseName(String sourceName, char separator) { + List result = new ArrayList(); + if (sourceName != null) { + StringBuilder currentWord = new StringBuilder(64); + boolean lastIsLower = false; + int index; + int length; + for (index = 0, length = sourceName.length(); index < length; ++index) { + char curChar = sourceName.charAt(index); + if (!Character.isJavaIdentifierPart(curChar)) { + curChar = separator; + } + if (Character.isUpperCase(curChar) + || (!lastIsLower && Character.isDigit(curChar)) + || curChar == separator) { + + if (lastIsLower && currentWord.length() > 1 + || curChar == separator && currentWord.length() > 0) { + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + } + lastIsLower = false; + } else { + if (!lastIsLower) { + int currentWordLength = currentWord.length(); + if (currentWordLength > 1) { + char lastChar = currentWord.charAt(--currentWordLength); + currentWord.setLength(currentWordLength); + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + currentWord.append(lastChar); + } + } + lastIsLower = true; + } + + if (curChar != separator) { + currentWord.append(curChar); + } + } + + result.add(currentWord.toString()); + } + return result; + } + + /** + * Return an EPackage name for the given namespace. + * + * @param namespace + * @return an EPackage name for the given namespace + */ + public static String getPackageNameFromNamespace(String namespace) { + return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace); + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java new file mode 100644 index 0000000000..22383e99db --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java @@ -0,0 +1,222 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axis2.description.AxisMessage; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.util.FileWriter; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; +import org.apache.axis2.wsdl.databinding.TypeMapper; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getJavaNameFromXMLName; + +/** + * Overrides the Axis2 JavaEmitter to generate unwrapped methods. + */ +public class JavaInterfaceEmitter extends JavaEmitter { + + private CodeGenConfiguration codegenConfiguration; + private TypeMapper typeMapper; + + public void setCodeGenConfiguration(CodeGenConfiguration configuration) { + super.setCodeGenConfiguration(configuration); + codegenConfiguration=configuration; + } + + public void setMapper(TypeMapper typeMapper) { + super.setMapper(typeMapper); + this.typeMapper = typeMapper; + } + + private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) { + List parameterElementList = new ArrayList(); + + if (message != null && message.getElementQName()!=null) { + + SDODataBindingTypeMappingEntry typeMappingEntry = + (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName()); + List typeMappings; + if (wrapped) { + typeMappings = (List)typeMappingEntry.getPropertyClassNames(); + } else { + typeMappings = new ArrayList(); + typeMappings.add(typeMappingEntry.getClassName()); + } + + for (int i=0; i> Generating Java class " + packageName + "." + className); + File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(), + packageName, className, ".java"); + if (outputFile.exists()) { + outputFile.delete(); + } + + writeClass(interfaceModel, interfaceWriter); + } + + protected String makeJavaClassName(String word) { + //return XMLNameUtil.getJavaNameFromXMLName(word, true); + return getJavaNameFromXMLName(word, true); + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java new file mode 100644 index 0000000000..b68277566a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java @@ -0,0 +1,230 @@ +/* + * 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.tools.wsdl2java.generate; + +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getPackageNameFromNamespace; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.PortType; +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.parsers.ParserConfigurationException; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.util.XMLUtils; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; +import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension; +import org.apache.axis2.wsdl.codegen.extension.PackageFinder; +import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension; +import org.apache.axis2.wsdl.databinding.JavaTypeMapper; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +public class JavaInterfaceGenerator { + + private List codegenExtensions = new ArrayList(); + private List codegenConfigurations= new LinkedList(); + + + + + public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName, + Map typeMapping) throws CodeGenerationException { + + Definition definition; + try { + definition = readWSDL(uri); + } catch (WSDLException e) { + throw new CodeGenerationException(e); + } + + HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports)); + + // Service service=(Service)definition.getServices().values().().next(); + + HashSet donePortTypes= new HashSet(); + + for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) { + Service service = (Service) sIter.next(); + + QName serviceQname = service.getQName(); + for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) { + Port port= (Port) pIter.next(); + if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested. + PortType portType= getPortType(port); + if(null == portType) continue; // not connected. + QName pQName= portType.getQName(); + if(donePortTypes.contains(pQName)) continue; //allready did it. + donePortTypes.add(pQName); + + if (packageName == null) { + + packageName = getPackageNameFromNamespace(definition.getTargetNamespace()); + } + JavaTypeMapper typeMapper = new JavaTypeMapper(); + for (Map.Entry e : typeMapping.entrySet()) { + typeMapper.addTypeMappingObject(e.getKey(), e.getValue()); + } + AxisService axisService; + try { + axisService = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName()).populateService(); + } catch (AxisFault e) { + throw new CodeGenerationException(e); + } + axisService.setName(port.getBinding().getPortType().getQName().getLocalPart()); + CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP); + codegenConfigurations.add(codegenConfiguration); + codegenConfiguration.setAxisService(axisService); + codegenConfiguration.setAdvancedCodeGenEnabled(false); + codegenConfiguration.setAsyncOn(false); + codegenConfiguration.setDatabindingType("sdo"); + codegenConfiguration.setGenerateAll(true); + codegenConfiguration.setGenerateDeployementDescriptor(false); + codegenConfiguration.setOutputLanguage("java"); + codegenConfiguration.setOutputLocation(new File(outputLocation)); + codegenConfiguration.setPackageName(packageName); + codegenConfiguration.setPackClasses(false); + codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP); + codegenConfiguration.setPortName(port.getName()); + codegenConfiguration.setServerSide(false); + codegenConfiguration.setServiceName(service.getQName().getLocalPart()); + codegenConfiguration.setSyncOn(true); + codegenConfiguration.setTypeMapper(typeMapper); + codegenConfiguration.setWriteMessageReceiver(false); + codegenConfiguration.setWriteTestCase(false); + addExtension(new WSDLValidatorExtension(), codegenConfiguration); + addExtension(new PackageFinder(), codegenConfiguration); + addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration); + addExtension(new DefaultDatabindingExtension(), codegenConfiguration); + } + } + } + + + private PortType getPortType(Port port) { + Binding binding = port.getBinding(); + if(null != binding){ + return binding.getPortType(); + } + return null; + + } + + + @SuppressWarnings("unchecked") + private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) { + //ext.init(codegenConfiguration); + codegenExtensions.add(new Object[]{ext, codegenConfiguration}); + } + + public void generate() throws CodeGenerationException { + try { + for (int i = 0; i < codegenExtensions.size(); i++) { + //CodeGenExtension + Object[] pair = (Object[])codegenExtensions.get(i); + + CodeGenExtension cge= (CodeGenExtension) pair[0]; + CodeGenConfiguration cgf= (CodeGenConfiguration)pair[1]; + + cge.engage(cgf); + + } + + for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){ + JavaInterfaceEmitter emitter = new JavaInterfaceEmitter(); + emitter.setCodeGenConfiguration(codegenConfiguration); + emitter.setMapper(codegenConfiguration.getTypeMapper()); + + emitter.writeInterface(false); + } + + } catch (Exception e) { + throw new CodeGenerationException(e); + } + } + + /** + * Read the WSDL file + * @param uri + * @return + * @throws WSDLException + */ + private Definition readWSDL(String uri) throws WSDLException { + + WSDLReader reader = + WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.importDocuments", true); + + File file = new File(uri); + String baseURI; + + if (uri.startsWith("http://")){ + baseURI = uri; + } else{ + if(file.getParentFile() == null){ + try { + baseURI = new File(".").getCanonicalFile().toURI().toString(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } else { + baseURI = file.getParentFile().toURI().toString(); + } + } + + Document doc; + try { + doc = XMLUtils.newDocument(uri); + } catch (ParserConfigurationException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser Configuration Error", + e); + } catch (SAXException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser SAX Error", + e); + + } catch (IOException e) { + throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); + } + + return reader.readWSDL(baseURI, doc); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java new file mode 100644 index 0000000000..cb413bca50 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java @@ -0,0 +1,53 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.io.File; + +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; + +/** + * @author lresende + */ +public class RemotableInterfaceWritter extends InterfaceWriter { + private static final String REMOTABLE_INTERFACE_TEMPLATE="/RemotableInterfaceTemplate.xsl"; + + public RemotableInterfaceWritter(String outputFileLocation) { + super(outputFileLocation); + } + + public RemotableInterfaceWritter(File outputFileLocation, String language) { + super(outputFileLocation, language); + } + + /** + * Loads the template. + */ + @Override + public void loadTemplate() throws CodeGenerationException { + // the default behavior for the class writers is to use the property map from the languge specific types + // The properties are arranged in the following order + // .* .template=, + + //overrida original behaviour to always load the template we specified + this.xsltStream = this.getClass().getResourceAsStream(REMOTABLE_INTERFACE_TEMPLATE); + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java new file mode 100644 index 0000000000..075959f985 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java @@ -0,0 +1,63 @@ +/* + * 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.tools.wsdl2java.generate; + +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension; +import org.apache.axis2.wsdl.databinding.TypeMapper; + +/** + * SDO data binding codegen extension. + */ +public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension { + + private TypeMapper typeMapper; + + public SDODataBindingCodegenExtension(TypeMapper typeMapper) { + this.typeMapper=typeMapper; + } + + protected boolean testFallThrough(String dbFrameworkName) { + return !dbFrameworkName.equals("sdo"); + } + +// public void engage() { +// if (testFallThrough(configuration.getDatabindingType())) { +// return; +// } +// +// // Set the type mapper into the config +// configuration.setTypeMapper(typeMapper); +// +// } + + public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { + // TODO Auto-generated method stub + if (testFallThrough(configuration.getDatabindingType())) { + return; + } + + // Set the type mapper into the config + configuration.setTypeMapper(typeMapper); + + + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java new file mode 100644 index 0000000000..2d81ef12bf --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java @@ -0,0 +1,51 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.util.List; + +/** + * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate + * method signatures. + */ +public class SDODataBindingTypeMappingEntry { + + private final boolean anonymous; + private final List propertyClassNames; + private final String className; + + public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List propertyClassNames) { + this.className = className; + this.anonymous = anonymous; + this.propertyClassNames = propertyClassNames; + } + + public boolean isAnonymous() { + return anonymous; + } + + public String getClassName() { + return className; + } + + public List getPropertyClassNames() { + return propertyClassNames; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java new file mode 100644 index 0000000000..8f3f7447b2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java @@ -0,0 +1,349 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.helper.XSDHelper; + +public class WSDL2JavaGenerator { + + /** + * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory + * ] [ -javaPackage ] + * For example: generate somedir/somefile.wsdl Basic options: + * -targetDirectory Generates the Java source code in the specified + * directory. By default, the code is generated in the same directory as the + * input wsdl file. -javaPackage Overrides the Java package for the + * generated classes. By default the package name is derived from the + * targetNamespace of the WSDL definition being generated. For example, if + * the targetNamespace is "http://www.example.com/simple", the default + * package will be "com.example.simple". + */ + public static void main(String args[]) { + if (args.length == 0) { + printUsage(); + return; + } + + String portName = null; + String targetDirectory = null; + String wsdlJavaPackage = null; + String xsdJavaPackage = null; + + int index = 0; + for (; index < args.length && args[index].startsWith("-"); ++index) { + if (args[index].equalsIgnoreCase("-port")) { + portName = args[++index]; + } else if (args[index].equalsIgnoreCase("-targetDirectory")) { + targetDirectory = args[++index]; + } else if (args[index].equalsIgnoreCase("-javaPackage")) { + wsdlJavaPackage = args[++index]; + } + // else if (...) + else { + printUsage(); + return; + } + } + + String wsdlFileName = args[index]; + if (wsdlFileName == null || targetDirectory == null) { + printUsage(); + return; + } + + generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, 0); + + } + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String targetDirectory, + String wsdlJavaPackage, + String xsdJavaPackage, int genOptions){ + generateFromWSDL( wsdlFileName, null, targetDirectory, + wsdlJavaPackage, + xsdJavaPackage, genOptions); + + } + + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String[] ports, + String targetDirectory, String wsdlJavaPackage, + String xsdJavaPackage, int genOptions) + { + + // Initialize the SDO runtime + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData, null); + + try { + + // Load the WSDL file + File inputFile = new File(wsdlFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + + // Define SDO metadata + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) { + targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent(); + } else { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + // Populate the typeMapping table that will be given to the Axis2 WSDL2Java + Map typeMapping = + new HashMap(); + if (!packageRegistry.values().isEmpty()) { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + + // Populate list of GenPackages and a map of GenClasses keyed by EClass + List genPackages = new ArrayList(); + Map genClasses = new HashMap(); + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) { + EPackage currentEPackage = (EPackage)iter.next(); + String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage); + String currentPrefix = CodeGenUtil.capName(currentEPackage.getName()); + + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, + currentPrefix, genOptions, resourceSet); + genPackages.add(currentGenPackage); + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + genClasses.put(genClass.getEcoreClass(), genClass); + } + + } + + // Process all the SDO packages + // Populate the qname -> interfaceName typeMapping table + for (GenPackage currentGenPackage : genPackages) { + EPackage currentEPackage = currentGenPackage.getEcorePackage(); + + // Populate the type mappings for all the complex types + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(genClass.getEcoreClass())); + String interfaceName = currentGenPackage.getInterfacePackageName() + '.' + + genClass.getInterfaceName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, false, null); + typeMapping.put(qname, typeMappingEntry); + } + + // Process all the global XSD elements + EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage); + if (documentRoot != null) { + for (EStructuralFeature element : (List)extendedMetaData + .getElements(documentRoot)) { + EClassifier elementType = element.getEType(); + + // Handle a complex type + if (elementType instanceof EClass) { + EClass eClass = (EClass)elementType; + + GenClass genClass = genClasses.get(elementType); + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String interfaceName = genClass.getGenPackage().getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + boolean anonymous = extendedMetaData.isAnonymous(eClass); + + // Build list of property class names + List propertyClassNames=new ArrayList(); + for (EStructuralFeature feature : (List)eClass.getEStructuralFeatures()) { + EClassifier propertyType = feature.getEType(); + if (propertyType instanceof EClass) { + GenClass propertyGenClass = genClasses.get(propertyType); + String propertyClassName = propertyGenClass.getGenPackage().getInterfacePackageName() + + '.' + propertyGenClass.getInterfaceName(); + propertyClassNames.add(propertyClassName); + } else if (propertyType instanceof EClassifier) { + String propertyClassName = propertyType.getInstanceClass().getName(); + propertyClassNames.add(propertyClassName); + } + } + + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames); + typeMapping.put(qname, typeMappingEntry); + + } else { + + // Handle a simple type + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String className = elementType.getInstanceClass().getName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(className, false, null); + typeMapping.put(qname, typeMappingEntry); + } + } + } + } + } + + try { + JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName, + ports, + targetDirectory, + wsdlJavaPackage, + typeMapping); + codeGenerator.generate(); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + } + + @SuppressWarnings("unchecked") + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, + int genOptions, ResourceSet resourceSet) { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, + String prefix, int genOptions) { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(Collections.singleton(ePackage)); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + // FIXME workaround java.lang.NoClassDefFoundError: + // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + + if (basePackage != null) { + genPackage.setBasePackage(basePackage); + } + if (prefix != null) { + genPackage.setPrefix(prefix); + } + + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /* CodeGenUtil. */shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) { + ePackage.setName(name); + } + return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); + stringTokenizer.hasMoreTokens();) { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.wsdl"); + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl new file mode 100644 index 0000000000..e3da5da20f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + /** + * .java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ + package ; + + import org.osoa.sca.annotations.Remotable; + import org.apache.tuscany.api.annotation.DataType; + + /* + * java interface + */ + + @Remotable + @DataType(name="commonj.sdo.DataObject") + public interface { + + + + + + + + /** + * Auto generated method signatures + * @param + */ + public void + ( + + , + ) throws java.rmi.RemoteException; + + + + + + /** + * Auto generated method signature + * @param + */ + + public void start( + + + , + ,final . callback) throws java.rmi.RemoteException; + + + + + + + + + /** + * Auto generated method signature + + *@param + + */ + public void + ( + + , + + ) throws java.rmi.RemoteException; + + + + + + // + } + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java new file mode 100644 index 0000000000..e679496509 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.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.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerValue { + + public int getValue(String custId, String stockSymbol) { + return 0; + } + + public Customer getCustomerDetails(String custId) { + return new Customer(); + } + + public String noArgsServiceMethod() + { + return new String(); + } + + private void privateServiceMethod() + { + + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java new file mode 100644 index 0000000000..4b5a795f2c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.account.Account; +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerWithAccount { + + private Customer customer = new Customer(); + + private Account[] accounts; + + public int getValue(String custId, String stockSymbol) { + return 123; + } + + public Customer getCustomerDetails(String custId) { + return customer; + } + + public Account getCustomerAccount(String custId, String accountId) { + return accounts[0]; + } + + public Account[] getAccounts() { + return accounts; + } + + public void setAccounts(Account[] accounts) { + this.accounts = accounts; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java new file mode 100644 index 0000000000..a72321c9b1 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * A JUnit test case to test the Tuscany Java 2 WSDL Generation + */ +public class TuscanyJava2WSDLTestCase extends TestCase { + + /** + * setup the pre-requisites for the test case to run + * + * @exception Exception + */ + protected void setUp() throws Exception { + // System.out.println("inside setup"); + super.setUp(); + } + + /** + * @exception Exception + */ + protected void tearDown() throws Exception { + // System.out.println("inside tearDown"); + super.tearDown(); + } + + + /** + * Simple WSDL generation test. + */ + public void testSimpleWSDLGeneration() { + String[] arguments = new String[] { "-cn","org.apache.tuscany.tools.java2wsdl.generate.CustomerValue", + "-o", "target/java2wsdl-source", + "-xc", "org.apache.tuscany.tools.java2wsdl.generate.extra.GoldCustomer"}; + + + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + /** + * Test WSDL generation where a parameter Object[] is involved. + */ + public void testWsdlGeneration2() { + + String[] arguments = new String[] + { + "-cn", + "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount", + "-o", "target/java2wsdl-source", }; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + public void testWsdlGeneration_SDO_Static() + { + //tests for SDOs where XSD exist. Hence no XSDs must be generated + String[] arguments = new String[] { + "-cn", + "org.soapinterop.CreditScoreDocLit", + "-o", "target/java2wsdl-source", + "-ixsd", "[http://www.example.org/creditscore/doclit/," + + "http://www.example.org/creditscore/doclit/xsd]"}; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CreditScoreDocLit.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + + + /** + * Test WSDL generation from a java interface and then generate the java + * interface using the generated WSDL. + */ + public void _testRoundTrip() { + // TODO implement round trip + // this should re-generate java interfaces from the generated wsdl + // and compile (?) the generated java code. + // fail(); + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java new file mode 100644 index 0000000000..84d59164ee --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java @@ -0,0 +1,53 @@ +/* + * 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.tools.java2wsdl.generate.account; + +import java.math.BigDecimal; + +public class Account { + int accountType; + + String accountNo; + + BigDecimal balance; + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public int getAccountType() { + return accountType; + } + + public void setAccountType(int accountType) { + this.accountType = accountType; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java new file mode 100644 index 0000000000..a28399e7fe --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.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.tools.java2wsdl.generate.customer; + +public class Customer { + private String name = ""; + + public int custType = 0; + + public String getName() { + return name; + } +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java new file mode 100644 index 0000000000..afc68a3217 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.extra; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + + + + +public class GoldCustomer extends Customer { + public String goldCustNumber = ""; + + public String getGoldCustNumber() { + return goldCustNumber; + } + + public void setGoldCustNumber(String goldCustNumber) { + this.goldCustNumber = goldCustNumber; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java new file mode 100644 index 0000000000..c3467cbabc --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java @@ -0,0 +1,44 @@ +/* + * 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.tools.wsdl2java.generate; + +import junit.framework.TestCase; + +/** + * Test case for WSDL2Java + */ +public class WSDL2JavaGeneratorTestCase extends TestCase { + + public void testAccountService() { + + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java new file mode 100644 index 0000000000..e9e8aa882a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java @@ -0,0 +1,25 @@ +/* + * 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.soapinterop; + +public interface CreditScoreDocLit { + public org.example.creditscore.doclit.CreditReport getCreditScore( + org.example.creditscore.doclit.Customer param0) throws java.rmi.RemoteException; + } + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl new file mode 100644 index 0000000000..e7be3ce5ba --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl new file mode 100644 index 0000000000..09d1a58589 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl new file mode 100644 index 0000000000..051f604bb2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl new file mode 100644 index 0000000000..820c26ca34 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..a565f3fa65 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml new file mode 100644 index 0000000000..a5b5a65105 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml @@ -0,0 +1,131 @@ + + + + + org.apache.tuscany.sca.extensions.axis2 + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + org.apache.tuscany.sca.extensions.axis2.tools + parent + pom + Apache Tuscany Axis2 Tools + Tools for the Axis2 extension + + + + + osuosl.org + http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2 + + true + + + + + + java2wsdl + wsdl2java + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-incubator-SNAPSHOT + compile + + + + org.apache.neethi + neethi + 2.0 + compile + + + + org.apache.ws.commons.axiom + axiom-api + 1.2.2 + + + xerces + xercesImpl + + + + + + xerces + xercesImpl + 2.8.1 + + + + org.apache.axis2 + axis2-java2wsdl + 1.1.1 + compile + + + + org.apache.axis2 + axis2-codegen + 1.1.1 + compile + + + + org.eclipse.emf + codegen + 2.2.1 + compile + + + + org.eclipse.emf + codegen-ecore + 2.2.1 + compile + + + + annogen + annogen + 0.1.0 + compile + + + + commons-logging + commons-logging + 1.1 + compile + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml new file mode 100644 index 0000000000..6f48974b41 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml @@ -0,0 +1,164 @@ + + + + + org.apache.tuscany.sca.extensions.axis2.tools + parent + 0.1-integration-incubating-SNAPSHOT + + + 4.0.0 + tuscany-wsdl2java + Apache Tuscany Axis2 WSDL2Java Tool + Apache Tuscany Axis2 WSDL2Java Tool + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + + + + stax + stax-api + + + + wsdl4j + wsdl4j + + + + org.apache.neethi + neethi + + + + org.apache.ws.commons.schema + XmlSchema + + + + org.apache.ws.commons.axiom + axiom-api + + + + xerces + xercesImpl + + + + org.apache.ws.commons.axiom + axiom-impl + + + + org.apache.axis2 + axis2-kernel + + + + org.apache.axis2 + axis2-java2wsdl + + + + org.apache.axis2 + axis2-codegen + + + + org.eclipse.emf + codegen + + + + org.eclipse.emf + codegen-ecore + + + + annogen + annogen + + + + commons-logging + commons-logging + + + + org.codehaus.woodstox + wstx-asl + + + + junit + junit + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.0-incubator-SNAPSHOT + + + generate-sdo + generate-test-sources + + ${basedir}/src/test/resources/CreditScoreDocLit.wsdl + org.example.creditscore.doclit + true + true + true + + + generate + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java new file mode 100644 index 0000000000..3cb699681c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java @@ -0,0 +1,435 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * This class encapsulates the parameters that effect the generation of the + * WSDL. For example they contain all user settings such as source class, + * target location etc. + * + */ +public class GenerationParameters implements TuscanyJava2WSDLConstants +{ + public static final String WSDL_FILENAME_SUFFIX = ".wsdl"; + public static final String XSD_IMPORT_DELIMITER = "[,]"; + + private Map cmdLineOptions = null; + private FileOutputStream outputFileStream = null; + private String sourceClassName = null; + + private ArrayList extraClasses; + private String attrFormDefault = null; + private String elementFormDefault = null; + private String targetNamespace = null; + private String targetNamespacePrefix = null; + private String schemaTargetNamespace = null; + private String schemaTargetNamespacePrefix = null; + private ClassLoader classLoader = null; + private String serviceName = null; + private String style = DOCUMENT; + private String use = LITERAL; + private String locationUri = DEFAULT_LOCATION_URL; + private Map schemaLocationMap = null; + + public GenerationParameters(Map cmdLineOptions) throws Exception + { + this.cmdLineOptions = cmdLineOptions; + loadParameters(); + } + + protected void loadParameters() throws Exception + { + initializeSourceClassName(); + resolveFileOutputStream(); + resolveClassLoader4InputClasspath(); + loadSchemaLocationMap(); + initializeOtherParams(); + } + + private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) { + //short option gets precedence + Java2WSDLCommandLineOption option = null; + if (longOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption); + if (option != null) { + return option; + } + } + if (shortOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption); + } + + return option; + } + + protected void initializeSourceClassName() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSNAME_OPTION, CLASSNAME_OPTION_LONG); + sourceClassName = option == null ? null : option.getOptionValue(); + + if (sourceClassName == null || sourceClassName.equals("")) { + throw new Exception("class name must be present!"); + } + } + + /** + * @throws Exception + */ + protected void resolveFileOutputStream() throws Exception + { + File outputFolder; + Java2WSDLCommandLineOption option = loadOption(OUTPUT_LOCATION_OPTION, + OUTPUT_LOCATION_OPTION_LONG); + String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue(); + + outputFolder = new File(outputFolderName); + if (!outputFolder.exists()) { + outputFolder.mkdirs(); + } else if (!outputFolder.isDirectory()) { + throw new Exception("The specified location " + outputFolderName + "is not a folder"); + } + + option = loadOption(OUTPUT_FILENAME_OPTION, + OUTPUT_FILENAME_OPTION_LONG); + String outputFileName = option == null ? null : option.getOptionValue(); + //derive a file name from the class name if the filename is not specified + if (outputFileName == null) + { + outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX; + } + + //first create a file in the given location + File outputFile = new File(outputFolder, outputFileName); + try + { + if (!outputFile.exists()) + { + outputFile.createNewFile(); + } + outputFileStream = new FileOutputStream(outputFile); + } + catch (IOException e) + { + throw new Exception(e); + } + } + + protected void addToSchemaLocationMap(String optionValue) throws Exception + { + //option value will be of the form [namespace, schemalocation] + //hence we take the two substrings starting after '[' and upto ',' and + //starting after ',' and upto ']' + getSchemaLocationMap().put(optionValue.substring(1, optionValue.indexOf(COMMA)), + optionValue.substring(optionValue.indexOf(COMMA) + 1, optionValue.length() - 1)); + + + } + + protected void loadSchemaLocationMap() throws Exception + { + Java2WSDLCommandLineOption option = loadOption(IMPORT_XSD_OPTION, IMPORT_XSD_OPTION_LONG); + + if (option != null) + { + ArrayList optionValues = option.getOptionValues(); + + for ( int count = 0 ; count < optionValues.size() ; ++count ) + { + addToSchemaLocationMap(((String)optionValues.get(count)).trim()); + } + } + } + + protected void resolveClassLoader4InputClasspath() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(CLASSPATH_OPTION, CLASSPATH_OPTION_LONG); + + if (option != null) { + ArrayList optionValues = option.getOptionValues(); + URL[] urls = new URL[optionValues.size()]; + String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]); + + try { + for (int i = 0; i < classPathEntries.length; i++) { + String classPathEntry = classPathEntries[i]; + //this should be a file(or a URL) + if (Java2WSDLUtils.isURL(classPathEntry)) { + urls[i] = new URL(classPathEntry); + } else { + urls[i] = new File(classPathEntry).toURL(); + } + } + } catch (MalformedURLException e) { + throw new Exception(e); + } + + classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); + + } else { + classLoader = Thread.currentThread().getContextClassLoader(); + } + } + + protected void initializeOtherParams() + { +// set the other parameters to the builder + Java2WSDLCommandLineOption option = loadOption(SCHEMA_TARGET_NAMESPACE_OPTION, + SCHEMA_TARGET_NAMESPACE_OPTION_LONG); + schemaTargetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, + SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG); + schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_OPTION, + TARGET_NAMESPACE_OPTION_LONG); + targetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(TARGET_NAMESPACE_PREFIX_OPTION, + TARGET_NAMESPACE_PREFIX_OPTION_LONG); + targetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(SERVICE_NAME_OPTION, + SERVICE_NAME_OPTION_LONG); + serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue(); + + option = loadOption(STYLE_OPTION,STYLE_OPTION); + style = (option == null) ? null : option.getOptionValue(); + + + option = loadOption(LOCATION_OPTION, + LOCATION_OPTION); + locationUri = (option == null) ? null : option.getOptionValue(); + + option = loadOption(USE_OPTION,USE_OPTION); + use = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ATTR_FORM_DEFAULT_OPTION, ATTR_FORM_DEFAULT_OPTION_LONG); + attrFormDefault = (option == null) ? null : option.getOptionValue(); + + option = loadOption(ELEMENT_FORM_DEFAULT_OPTION,ELEMENT_FORM_DEFAULT_OPTION_LONG); + elementFormDefault = option == null ? null : option.getOptionValue(); + + option = loadOption(TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION, + TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG); + extraClasses = option == null ? new ArrayList() : option.getOptionValues(); + } + + public ClassLoader getClassLoader() + { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) + { + this.classLoader = classLoader; + } + + public String getLocationUri() + { + if ( locationUri == null ) + { + locationUri = DEFAULT_LOCATION_URL; + } + return locationUri; + } + + public void setLocationUri(String locationUri) + { + this.locationUri = locationUri; + } + + public FileOutputStream getOutputFileStream() + { + return outputFileStream; + } + + public void setOutputFileStream(FileOutputStream outputFileStream) + { + this.outputFileStream = outputFileStream; + } + + public String getSchemaTargetNamespace() throws Exception + { + if (schemaTargetNamespace == null + || schemaTargetNamespace.trim().equals("")) + { + this.schemaTargetNamespace = Java2WSDLUtils + .schemaNamespaceFromClassName(getSourceClassName(), getClassLoader()).toString(); + } + return schemaTargetNamespace; + } + + public void setSchemaTargetNamespace(String schemaTargetNamespace) + { + this.schemaTargetNamespace = schemaTargetNamespace; + } + + public String getSchemaTargetNamespacePrefix() + { + if (schemaTargetNamespacePrefix == null + || schemaTargetNamespacePrefix.trim().equals("")) + { + this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX; + } + + return schemaTargetNamespacePrefix; + } + + public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) + { + this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix; + } + + public String getServiceName() + { + if ( serviceName == null ) + { + serviceName = Java2WSDLUtils.getSimpleClassName(getSourceClassName()); + } + return serviceName; + } + + public void setServiceName(String serviceName) + { + this.serviceName = serviceName; + } + + public String getSourceClassName() + { + return sourceClassName; + } + + public void setSourceClassName(String sourceClassName) + { + this.sourceClassName = sourceClassName; + } + + public String getStyle() + { + if ( style == null ) + { + style = DOCUMENT; + } + return style; + } + + public void setStyle(String style) + { + this.style = style; + } + + public String getTargetNamespace() throws Exception + { + if ( targetNamespace == null ) { + targetNamespace = Java2WSDLUtils.namespaceFromClassName(this.sourceClassName, this.classLoader).toString(); + } + return targetNamespace; + } + + public void setTargetNamespace(String targetNamespace) + { + this.targetNamespace = targetNamespace; + } + + public String getTargetNamespacePrefix() + { + return targetNamespacePrefix; + } + + public void setTargetNamespacePrefix(String targetNamespacePrefix) + { + this.targetNamespacePrefix = targetNamespacePrefix; + } + + public String getUse() + { + if ( use == null ) + { + use = LITERAL; + } + return use; + } + + public void setUse(String use) + { + this.use = use; + } + + public Map getSchemaLocationMap() + { + if ( schemaLocationMap == null ) + { + schemaLocationMap = new Hashtable(); + } + return schemaLocationMap; + } + + public void setSchemaLocationMap(Map schemaLocationMap) { + this.schemaLocationMap = schemaLocationMap; + } + + public String getAttrFormDefault() { + if ( attrFormDefault == null ) + { + attrFormDefault = FORM_DEFAULT_QUALIFIED; + } + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + if ( elementFormDefault == null ) + { + elementFormDefault = FORM_DEFAULT_QUALIFIED; + } + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } + + public ArrayList getExtraClasses() { + return extraClasses; + } + + public void setExtraClasses(ArrayList extraClasses) { + this.extraClasses = extraClasses; + } +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java new file mode 100644 index 0000000000..8855c3f6e9 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.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.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; + +/** + * This class provides the tooling abstraction to Tuscany Java2WSDL and can be + * invoked from command line with the follwing options as with Axis2 Java2WSDL + * + */ +public class Java2WSDL { + /** + * @param args + */ + public static void main(String[] args) + { + //parse the cmd line args + Java2WSDLCommandLineOptionParser commandLineOptionParser = + new Java2WSDLCommandLineOptionParser(args); + // validate the arguments + validateCommandLineOptions(commandLineOptionParser); + + Java2WSDLGeneratorFactory.getInstance().createGenerator(). + generateWSDL(commandLineOptionParser.getAllOptions()); + + // Uncomment the following statement to directly run the Axis2 tool + // without + // runAxis2Tool(args); + } + + private static void runAxis2Tool(String[] args) { + org.apache.ws.java2wsdl.Java2WSDL.main(args); + } + + private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) { + if (parser.getAllOptions().size() == 0) { + printUsage(); + } else if (parser.getInvalidOptions(new TuscanyJava2WSDLOptionsValidator()).size() > 0) { + printUsage(); + } + + } + + public static void printUsage() { + System.out.println("Usage java2wsdl -cn : class file name"); + System.out.println("-o : output file location"); + System.out.println("-cp : list of classpath entries - (urls)"); + System.out.println("-tn : target namespace"); + System.out.println("-tp : target namespace prefix"); + System.out.println("-stn : target namespace for schema"); + System.out.println("-stp : target namespace prefix for schema"); + System.out.println("-sn : service name"); + System.out.println("-of : output file name for the WSDL"); + System.out.println("-st : style for the WSDL"); + System.out.println("-u : use for the WSDL"); + System.out.println("-l : address of the port for the WSDL"); + System.out.println("-ixsd [, ] : schemas to be imported (and not generated)"); + System.out.println("-efd : Setting for elementFormDefault (defaults to qualified)"); + System.out.println("-afd : Setting for attributeFormDefault (defaults to qualified)"); + System.out.println("-xc : Extra class for which schematype must be generated. " + + "\t\tUse as : -xc class1 -xc class2 ..."); + System.exit(0); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java new file mode 100644 index 0000000000..3323113af4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java @@ -0,0 +1,46 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Map; + +/** + * This is the Java2WSDL Generator facade that will be used by Tuscany + * components for java to wsdl conversion. + * + */ +public interface Java2WSDLGenerator { + public void generateWSDL(String[] args); + + public void generateWSDL(Map commandLineOptions); + + public void addWSDLGenListener(WSDLGenListener l); + + public void removeWSDLGenListener(WSDLGenListener l); + + public Map getCommandLineOptions(); + + public void setCommandLineOptoins(Map cmdLineOpts); + + public OutputStream getOutputStream(); + + public void setOutputStream(OutputStream outStream); + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java new file mode 100644 index 0000000000..e8f3db95b0 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.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.tools.java2wsdl.generate; + +import java.util.Vector; + +/** + * Factory that creates Java2WSDL Generators. Presently the there is a Default + * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory + * can be extended to create generators that wrap around other implementations + * if required. + */ + +public class Java2WSDLGeneratorFactory { + /* + * singleton instance of this factory class + */ + private static Java2WSDLGeneratorFactory factory = null; + + /** + * code for the default generator + */ + public static final int DEFAULT_GENERATOR = 0; + + /** + * Default Generator class name + */ + public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl"; + + /** + * list of generator classnames in a position that corresponds to their + * code. For example the default generator's code is 0 and hence this + * generator's classname is stored at index '0' of the list + */ + protected Vector generatorClassNames = new Vector(); + + /** + * @return the singleton instance of this generator factory + */ + public static Java2WSDLGeneratorFactory getInstance() { + if (factory == null) { + factory = new Java2WSDLGeneratorFactory(); + } + return factory; + } + + private Java2WSDLGeneratorFactory() { + generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME); + } + + public Java2WSDLGenerator createGenerator() { + return createGenerator(DEFAULT_GENERATOR); + } + + /** + * creates an instance of a Java2WSDL Generator based on the input type + * + * @param genType + * type of the generator to be created + * @return an instance of a Java2WSDL Generator + */ + public Java2WSDLGenerator createGenerator(int genType) { + try { + return (Java2WSDLGenerator) (Class.forName(generatorClassNames + .elementAt(genType)).newInstance()); + } catch (Exception e) { + System.out + .println(" Unable to create Java2WSDL generator due to ....."); + System.out.println(e); + return null; + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java new file mode 100644 index 0000000000..9d1a9df438 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java @@ -0,0 +1,239 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.apache.ws.java2wsdl.Java2WSDL; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This is an implementation of the Java2WSDLGenerator facade. This + * implementation is a decorator around the Axis2 implementation of the + * Java2WSDL conversion. The WSDL generation is divided into phases that are + * stringed up as a template method. The phases are - User Input Validation - + * WSDL Java Model Generation - Serialization of WSDL Java Model The function of + * each phase is accomplished by delegation to the appropriate classes in Axis2. + * At the start and end of each phase an event is published to subcribers + * denoting the start and end of the phase. + * + * Such a spliting up of the Java2WSDL conversion into phases has been designed + * to enable interceptors to modify the model or apply transformations to the + * output. Typically the interceptors can subscribe to the start and end events + * of these phases and hence be able to intercept. + * + * Note: This class contains substantial AXIS2 Java2WSDL code refactored into + * it. These will be removed as and when the Axis2 code is fixed. + * + */ +public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator, TuscanyJava2WSDLConstants +{ + private List genPhaseListeners = new Vector(); + private GenerationParameters genParams = null; + private Map commandLineOptions = null; + private TuscanyJava2WSDLBuilder java2WsdlBuilder; + private OutputStream outputStream = null; + + public Java2WSDLGeneratorImpl() + { + + } + + private void multicastGenPhaseCompletionEvent(int genPhase) { + WSDLGenEvent event = new WSDLGenEvent(this, genPhase); + Iterator iterator = genPhaseListeners.iterator(); + while (iterator.hasNext()) { + ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event); + } + } + + private void initJava2WSDLBuilder() throws Exception + { +// Now we are done with loading the basic values - time to create the builder + java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams); + } + + protected boolean validateInputArgs(String[] args) + { + boolean isValid = true; + Java2WSDLCommandLineOptionParser parser = new Java2WSDLCommandLineOptionParser(args); + if (parser.getAllOptions().size() == 0) { + Java2WSDL.printUsage(); + isValid = false; + } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()) + .size() > 0) { + Java2WSDL.printUsage(); + isValid = false; + } + + if (isValid) + { + commandLineOptions = parser.getAllOptions(); + } + + return isValid; + } + + public boolean buildWSDLDocument() throws Exception + { + boolean isComplete = true; + initJava2WSDLBuilder(); + java2WsdlBuilder.buildWSDL(); + + return isComplete; + } + + public boolean serializeWSDLDocument() throws Exception { + boolean isComplete = true; + + if ( getOutputStream() == null ) + { + setOutputStream(genParams.getOutputFileStream()); + } + + java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream()); + getOutputStream().flush(); + getOutputStream().close();; + + return isComplete; + } + + /* + * This is the template method that splits the Java2WSDL generation cycle + * into phase / steps. + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[]) + */ + public void generateWSDL(Map commandLineOptions) + { + try + { + // load the user options into an easy to access abstraction + genParams = new GenerationParameters(commandLineOptions); + + // if the WSDL Model generation was successul + if ( buildWSDLDocument() ) + { + // multicast event for generation of wsdl model + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION); + // if the serialization of the generated (and fixed) model + // is successful + if (serializeWSDLDocument()) { + // multicast event for writing of the WSDL Model to + // supplied output stream + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + // TODO Auto-generated method stub + + } + + public void generateWSDL(String[] args) + { + // if the argument input are found to be valid + if (validateInputArgs(args)) + { + //multicast event for input args validation complete + multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION); + generateWSDL(commandLineOptions); + } + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void addWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.add(l); + + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void removeWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.remove(l); + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions() + */ + public Map getCommandLineOptions() { + return commandLineOptions; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map) + */ + public void setCommandLineOptoins(Map cmdLineOpts) { + commandLineOptions = cmdLineOpts; + } + + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream() + */ + public OutputStream getOutputStream() { + // TODO Auto-generated method stub + return outputStream; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream) + */ + public void setOutputStream(OutputStream outStream) { + outputStream = outStream; + } + + + public TuscanyJava2WSDLBuilder getJava2WsdlBuilder() + { + return java2WsdlBuilder; + } + + public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder) + { + this.java2WsdlBuilder = java2WsdlBuilder; + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java new file mode 100644 index 0000000000..67609445ae --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java @@ -0,0 +1,524 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.io.StringReader; +import java.lang.reflect.Constructor; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaGroupBase; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.XmlSchemaType; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JProperty; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XSDHelper; + +public class SchemaBuilder implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + private static int prefixCount = 1; + + public static final String MIXED = "mixed"; + + public static final String GROUP = "group"; + + protected String attrFormDefault = null; + + protected String elementFormDefault = null; + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private Hashtable schemaMap = new Hashtable(); + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected Map schemaLocationMap = null; + + private ClassLoader classLoader; + + protected SchemaBuilder(XmlSchemaCollection schemaCollection, + Hashtable schemaMap, + Hashtable nsPrefixMap, + TuscanyTypeTable typeTable, + String attrFormDef, + String eleFormDef, + Map schemaLocMap, + ClassLoader classLoader) { + this.schemaMap = schemaMap; + this.xmlSchemaCollection = schemaCollection; + this.targetNamespacePrefixMap = nsPrefixMap; + this.typeTable = typeTable; + this.schemaLocationMap = schemaLocMap; + this.classLoader = classLoader; + this.attrFormDefault = attrFormDef; + this.elementFormDefault = eleFormDef; + } + + private boolean isSDO(JClass javaType) throws Exception { + Class sdoClass = Class.forName(javaType.getQualifiedName(), + true, + classLoader); + return DataObject.class.isAssignableFrom(sdoClass); + } + + private void buildComplexTypeContents_JavaType(JClass javaType, + XmlSchemaComplexType complexType, + XmlSchema xmlSchema) throws Exception { + JProperty[] properties = javaType.getDeclaredProperties(); + + for (int i = 0; i < properties.length; i++) { + JProperty property = properties[i]; + String propertyName = property.getType().getQualifiedName(); + boolean isArryType = property.getType().isArrayType(); + if (isArryType) { + propertyName = property.getType().getArrayComponentType().getQualifiedName(); + } + + if (typeTable.isSimpleType(propertyName)) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName)); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } else { + QName schemaTypeName = null; + if (isArryType) { + schemaTypeName = generateSchema(property.getType().getArrayComponentType()); + } else { + schemaTypeName = generateSchema(property.getType()); + } + + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(getCorrectName(property.getSimpleName())); + elt1.setSchemaTypeName(schemaTypeName); + ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1); + + if (isArryType) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + + addImports(xmlSchema, + schemaTypeName); + } + } + } + + protected QName buildSchema_JavaType(JClass javaType) throws Exception { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(javaType, this.classLoader); + if (schemaTypeName == null) { + String simpleName = javaType.getSimpleName(); + + String packageName = javaType.getContainingPackage().getQualifiedName(); + + String targetNameSpace = + Java2WSDLUtils.schemaNamespaceFromClassName(javaType.getQualifiedName(), this.classLoader) + .toString(); + + XmlSchema xmlSchema = getXmlSchema(targetNameSpace); + String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace); + + schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + complexType.setName(simpleName); + + XmlSchemaSequence sequence = new XmlSchemaSequence(); + complexType.setParticle(sequence); + + createGlobalElement(xmlSchema, + complexType, + schemaTypeName); + xmlSchema.getItems().add(complexType); + xmlSchema.getSchemaTypes().add(schemaTypeName, + complexType); + + // adding this type to the table + // typeTable.addComplexScheam(name, complexType.getQName()); + typeTable.addComplexSchemaType(targetNameSpace, + simpleName, + schemaTypeName); + buildComplexTypeContents_JavaType(javaType, + complexType, + xmlSchema); + } + return schemaTypeName; + } + + protected QName buildSchema_SDO(Type dataType) // throws Exception + { + QName schemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(), + dataType.getName()); + + if (schemaTypeName == null) { + // invoke XSDHelper to generate schema for this sdo type + XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper()); + // it is better to check if XSDHelper can generate the schema + if (xsdHelper.isXSD(dataType)) { + // if schemalocations for xsd has been specified, include them + includeExtXSD(dataType); + } else { + List typeList = new Vector(); + typeList.add(dataType); + + // the xsdhelper returns a string that contains the schemas for this type + String schemaDefns = xsdHelper.generate(typeList, + schemaLocationMap); + + // extract the schema elements and store them in the schema map + extractSchemas(schemaDefns); + } + // since the XSDHelper will not return the type name, create it and store it in typetable + schemaTypeName = new QName(dataType.getURI(), dataType.getName(), generatePrefix()); + typeTable.addComplexSchemaType(dataType.getURI(), + dataType.getName(), + schemaTypeName); + + } + return schemaTypeName; + } + + public QName generateSchema(JClass javaType) throws Exception { + if (isSDO(javaType)) { + Type dataType = createDataObject(javaType).getType(); + return buildSchema_SDO(dataType); + } else { + return buildSchema_JavaType(javaType); + } + } + + private XmlSchema getXmlSchema(String targetNamespace) { + XmlSchema xmlSchema; + + if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) { + String targetNamespacePrefix = generatePrefix(); + + xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + return xmlSchema; + } + + /** + * JAM convert first name of an attribute into UpperCase as an example if there is a instance variable called foo in a bean , then Jam give that + * as Foo so this method is to correct that error + * + * @param wrongName + * @return the right name, using english as the locale for case conversion + */ + public static String getCorrectName(String wrongName) { + if (wrongName.length() > 1) { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH) + + wrongName.substring(1, + wrongName.length()); + } else { + return wrongName.substring(0, + 1).toLowerCase(Locale.ENGLISH); + } + } + + private String addImports(XmlSchema xmlSchema, QName schemaTypeName) { + String prefix = null; + String[] prefixes = xmlSchema.getNamespaceContext().getDeclaredPrefixes(); + for (int count = 0; count < prefixes.length; ++count) { + if (schemaTypeName.getNamespaceURI(). + equals(xmlSchema.getNamespaceContext().getNamespaceURI(prefixes[count])) ) { + return prefixes[count]; + } + } + + // the following lines are executed only if a prefix was not found which implies that the + // schemaTypeName was not imported earlier and also it does not belong to the targetnamespace + String schemaLocation = null; + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + prefix = generatePrefix(); + //it is safe to cast like this since it was this class that instantiated the + //NamespaceContext and assigned it to an instance of a NamespaceMap (see method getXmlSchema) + ((NamespaceMap)xmlSchema.getNamespaceContext()).put(prefix, + schemaTypeName.getNamespaceURI()); + + return prefix; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + private void createGlobalElement(XmlSchema xmlSchema, + XmlSchemaComplexType complexType, + QName elementName) { + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaTypeName(complexType.getQName()); + globalElement.setName(formGlobalElementName(complexType.getName())); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + } + + private DataObject createDataObject(JClass sdoClass) throws Exception { + Class sdoType = Class.forName(sdoClass.getQualifiedName(), + true, + classLoader); + + Constructor constructor = sdoType.getDeclaredConstructor(new Class[0]); + constructor.setAccessible(true); + Object instance = constructor.newInstance(new Object[0]); + return (DataObject) instance; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + private void includeExtXSD(Type dataType) { + // now we know there is a type for which the xsd must come from outside + // create a schema for the namespace of this type and add an include in it for + // the xsd that is defined externally + XmlSchema xmlSchema = getXmlSchema(dataType.getURI()); + + // ideally there could be more than one external schema defintions for a namespace + // and hence schemalocations will be a list of locations + // List schemaLocations = (List)schemaLocationMap.get(dataType.getURI()); + + // since as per the specs the input to XSDHelper is a map of allowing + // only one schemalocation for a namespace. So for now this single location will be + // picked up and put into a list + List schemaLocations = new Vector(); + + if (schemaLocationMap.get(dataType.getURI()) != null) { + schemaLocations.add(schemaLocationMap.get(dataType.getURI())); + } + + if (schemaLocations.size() <= 0) { + schemaLocations.add(DEFAULT_SCHEMA_LOCATION); + } + + Iterator includesIterator = xmlSchema.getIncludes().getIterator(); + Iterator schemaLocIterator = schemaLocations.iterator(); + String aSchemaLocation = null; + boolean includeExists = false; + // include all external schema locations + while (schemaLocIterator.hasNext()) { + aSchemaLocation = (String) schemaLocIterator.next(); + while (includesIterator.hasNext()) { + if (!includeExists + && aSchemaLocation.equals(((XmlSchemaInclude) includesIterator.next()).getSchemaLocation())) { + includeExists = true; + } + } + + if (!includeExists) { + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(aSchemaLocation); + xmlSchema.getIncludes().add(includeElement); + xmlSchema.getItems().add(includeElement); + } + } + + } + + private void extractSchemas(String schemaDefns) { + // load each schema element and add it to the schema map + + String token = getToken(schemaDefns); + int curIndex = schemaDefns.indexOf(token); + int nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + + while (curIndex != -1) { + StringReader sr = null; + if (nextIndex != -1) + sr = new StringReader(schemaDefns.substring(curIndex, + nextIndex)); + else + sr = new StringReader(schemaDefns.substring(curIndex)); + + XmlSchemaCollection collection = new XmlSchemaCollection(); + XmlSchema aSchema = collection.read(sr, + null); + addSchemaToMap(aSchema); + + curIndex = nextIndex; + nextIndex = schemaDefns.indexOf(token, + curIndex + token.length()); + } + } + + private void addSchemaToMap(XmlSchema extractedSchema) { + // check if a Schema object already exists in schema map for targetNamespace of this schema element + // if it does then copy the contents of this schema element to the existing one, ensuring that + // duplicate elements are not created. i.e. before adding some child element like 'include' or 'import' + // check if it already exists, if it does don't add this + XmlSchema existingSchema = (XmlSchema) schemaMap.get(extractedSchema.getTargetNamespace()); + + if (existingSchema == null) { + extractedSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + extractedSchema.setElementFormDefault(getElementFormDefaultSetting()); + schemaMap.put(extractedSchema.getTargetNamespace(), + extractedSchema); + + } else { + copySchemaItems(existingSchema, + extractedSchema); + } + } + + private void copySchemaItems(XmlSchema existingSchema, XmlSchema aSchema) { + // items to copy are imports, includes, elements, types ... + // each item is checked if it is a duplicate entry and copied only if it isn't + Iterator itemsIterator = aSchema.getItems().getIterator(); + Object schemaObject = null; + XmlSchemaElement schemaElement = null; + XmlSchemaType schemaType = null; + XmlSchemaInclude schemaInclude = null; + QName qName = null; + List existingIncludes = getExistingIncludes(existingSchema); + + while (itemsIterator.hasNext()) { + schemaObject = itemsIterator.next(); + if (schemaObject instanceof XmlSchemaElement) { + schemaElement = (XmlSchemaElement) schemaObject; + qName = schemaElement.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getElements().add(qName, + schemaElement); + existingSchema.getItems().add(schemaElement); + } + } else if (schemaObject instanceof XmlSchemaType) { + schemaType = (XmlSchemaType) itemsIterator.next(); + qName = schemaType.getQName(); + // if the element does not exist in the existing schema + if (existingSchema.getElementByName(qName) == null) { + // add it to the existing schema + existingSchema.getSchemaTypes().add(qName, + schemaType); + existingSchema.getItems().add(schemaType); + // add imports + addImports(existingSchema, + qName); + } + } else if (schemaObject instanceof XmlSchemaInclude) { + schemaInclude = (XmlSchemaInclude) itemsIterator.next(); + if (!existingIncludes.contains(schemaInclude.getSchemaLocation())) { + existingSchema.getIncludes().add(schemaInclude); + existingSchema.getItems().add(schemaInclude); + } + } + } + } + + private List getExistingIncludes(XmlSchema xmlSchema) { + List includeSchemaLocations = new Vector(); + Iterator iterator = xmlSchema.getIncludes().getIterator(); + + while (iterator.hasNext()) { + includeSchemaLocations.add(((XmlSchemaInclude) iterator.next()).getSchemaLocation()); + } + return includeSchemaLocations; + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private String getToken(String s) { + // get the schema element name eg. "); + writeSchemas(writer); + writer.write(""); + + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader(new ByteArrayInputStream(writer.toString() + .getBytes())); + + StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader); + OMElement documentElement = staxOMBuilders.getDocumentElement(); + + + Iterator iterator = documentElement.getChildElements(); + while (iterator.hasNext()) { + wsdlTypes.addChild((OMNode) iterator.next()); + } + defintions.addChild(wsdlTypes); + } + + private void writeSchemas(StringWriter writer) { + Iterator iterator = schemaCollection.iterator(); + XmlSchema xmlSchema = null; + + while (iterator.hasNext()) { + xmlSchema = (XmlSchema) iterator.next(); + // typeIterator = xmlSchema.getSchemaTypes().getValues(); + /* + * while (typeIterator.hasNext()) { xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next()); } + */ + xmlSchema.write(writer); + } + } + + private void generateMessages(OMFactory fac, OMElement definitions) throws Exception { + Hashtable namespaceMap = new Hashtable(); + String namespacePrefix = null; + String namespaceURI = null; + QName messagePartType = null; + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + // Request Message + OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + requestMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + MESSAGE_SUFFIX, + null); + definitions.addChild(requestMessge); + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName())) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + // avoid duplicate namespaces + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + + OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + requestMessge.addChild(requestPart); + requestPart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName(), + null); + } + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(), + jmethod.getSimpleName() + + RESPONSE)) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, + namespacePrefix); + } + // Response Message + OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, + wsdl); + responseMessge.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + definitions.addChild(responseMessge); + OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME, + wsdl); + responseMessge.addChild(responsePart); + responsePart.addAttribute(ATTRIBUTE_NAME, + "part1", + null); + + responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE, + null); + } + } + } + + // now add these unique namespaces to the the definitions element + Enumeration enumeration = namespaceMap.keys(); + while (enumeration.hasMoreElements()) { + namespaceURI = (String) enumeration.nextElement(); + definitions.declareNamespace(namespaceURI, + (String) namespaceMap.get(namespaceURI)); + } + } + + /** + * Generate the porttypes + */ + private void generatePortType(OMFactory fac, OMElement defintions) { + JMethod jmethod = null; + OMElement operation = null; + OMElement message = null; + OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, + wsdl); + defintions.addChild(portType); + portType.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + PORT_TYPE_SUFFIX, + null); + // adding message refs + for (int i = 0; i < method.length; i++) { + jmethod = method[i]; + + if (jmethod.isPublic()) { + operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + portType.addChild(operation); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + message = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + jmethod.getSimpleName() + + MESSAGE_SUFFIX, + null); + operation.addChild(message); + + if (!jmethod.getReturnType().isVoidType()) { + message = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE_MESSAGE, + null); + operation.addChild(message); + } + } + } + + } + + /** + * Generate the service + */ + public void generateService(OMFactory fac, OMElement defintions) { + OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, + wsdl); + defintions.addChild(service); + service.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName(), + null); + OMElement port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP11PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + + port = fac.createOMElement(PORT, + wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12PORT, + null); + port.addAttribute(BINDING_LOCAL_NAME, + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + SOAP12BINDING_NAME_SUFFIX, + null); + addExtensionElement(fac, + port, + soap12, + SOAP_ADDRESS, + LOCATION, + generationParams.getLocationUri() + generationParams.getServiceName()); + } + + /** + * Generate the bindings + */ + private void generateBinding(OMFactory fac, OMElement defintions) throws Exception { + generateSoap11Binding(fac, + defintions); + generateSoap12Binding(fac, + defintions); + } + + private void generateSoap11Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + + addExtensionElement(fac, + operation, + soap, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void generateSoap12Binding(OMFactory fac, OMElement defintions) throws Exception { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, + wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, + generationParams.getServiceName() + SOAP12BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", + tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName() + + PORT_TYPE_SUFFIX, + null); + + addExtensionElement(fac, + binding, + soap12, + BINDING_LOCAL_NAME, + TRANSPORT, + TRANSPORT_URI, + STYLE, + generationParams.getStyle()); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + if (jmethod.isPublic()) { + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + operation.declareNamespace(URI_WSDL12_SOAP, + SOAP12_PREFIX); + + addExtensionElement(fac, + operation, + soap12, + OPERATION_LOCAL_NAME, + SOAP_ACTION, + URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(), + STYLE, + generationParams.getStyle()); + operation.addAttribute(ATTRIBUTE_NAME, + jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + input, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, + wsdl); + addExtensionElement(fac, + output, + soap12, + SOAP_BODY, + SOAP_USE, + generationParams.getUse(), + "namespace", + generationParams.getTargetNamespace()); + operation.addChild(output); + } + } + } + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value, + String att2Name, + String att2Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + soapbinding.addAttribute(att2Name, + att2Value, + null); + } + + private void addExtensionElement(OMFactory fac, + OMElement element, + OMNamespace namespace, + String name, + String att1Name, + String att1Value) { + OMElement soapbinding = fac.createOMElement(name, + namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, + att1Value, + null); + } + + private String generatePrefix() { + return NAMESPACE_PREFIX + prefixCount++; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java new file mode 100644 index 0000000000..b23726f6fa --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.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.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +public class TuscanyJava2WSDLBuilder implements Java2WSDLConstants { + + private OutputStream out; + private String className; + private ClassLoader classLoader; + private String wsdlPrefix = "wsdl"; + + // these apply for the WSDL + private GenerationParameters generationParams; + + private OMElement wsdlDocument = null; + + public String getWsdlPrefix() { + return wsdlPrefix; + } + + public void setWsdlPrefix(String wsdlPrefix) { + this.wsdlPrefix = wsdlPrefix; + } + + public TuscanyJava2WSDLBuilder(GenerationParameters genParams) { + this.generationParams = genParams; + } + + /** + * Externally visible generator method + * + * @throws Exception + */ + public void buildWSDL() throws Exception { + ArrayList excludeOpeartion = new ArrayList(); + excludeOpeartion.add("init"); + excludeOpeartion.add("setOperationContext"); + excludeOpeartion.add("destroy"); + + TuscanyWSDLTypesGenerator typesGenerator = new TuscanyWSDLTypesGenerator(generationParams); + typesGenerator.setExcludeMethods(excludeOpeartion); + Collection schemaCollection = typesGenerator.buildWSDLTypes(); + + TuscanyJava2OMBuilder java2OMBuilder = + new TuscanyJava2OMBuilder(typesGenerator.getMethods(), schemaCollection, typesGenerator + .getTypeTable(), generationParams); + + wsdlDocument = java2OMBuilder.generateOM(); + } + + public OMElement getWsdlDocument() { + return wsdlDocument; + } + + public void setWsdlDocument(OMElement wsdlDocument) { + this.wsdlDocument = wsdlDocument; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java new file mode 100644 index 0000000000..cde870fff4 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java @@ -0,0 +1,51 @@ +/* + * 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.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; + +/** + * This is a extension from the Axis2 Java2WSDLConstants to handle additions specific to Tuscany. + * This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public interface TuscanyJava2WSDLConstants extends Java2WSDLConstants +{ + public static final char OPEN_BRACKET = '['; + public static final char COMMA = ','; + public static final char CLOSE_BRACKET = ']'; + public static final String DEFAULT_SCHEMA_LOCATION = "*.xsd"; + public static final String SCHEMA_ELEMENT_NAME = "schema"; + + String FORM_DEFAULT_QUALIFIED = "qualified"; + String FORM_DEFAULT_UNQUALIFIED = "unqualified"; + + //short options + String IMPORT_XSD_OPTION = "ixsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION = "afd"; + String ELEMENT_FORM_DEFAULT_OPTION = "efd"; + String EXTRA_CLASSES_DEFAULT_OPTION = "xc"; + + //long options + String IMPORT_XSD_OPTION_LONG = "import_xsd"; //option for importing XSDs + String ATTR_FORM_DEFAULT_OPTION_LONG = "attributeFormDefault"; + String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault"; + String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses"; +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java new file mode 100644 index 0000000000..6411327abf --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.ArrayList; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This class is an extension from the Axis2 implementation in order to handle additional optoins + * specific to Tuscany. This class can be done away with once Axis2 is also enhanced to support these + * additional options. + * + */ +public class TuscanyJava2WSDLOptionsValidator extends Java2WSDLOptionsValidator implements + TuscanyJava2WSDLConstants { + public boolean isInvalid(Java2WSDLCommandLineOption option) { + boolean invalid; + String optionType = option.getOptionType(); + + invalid = !((IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG).equalsIgnoreCase(optionType) + || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION).equalsIgnoreCase(optionType) + || !super.isInvalid(option)); + + invalid = validateImportXSDOption(invalid, + option); + + return invalid; + } + + private boolean validateImportXSDOption(boolean invalid, Java2WSDLCommandLineOption option) { + String optionType = option.getOptionType(); + String schemaNSLocationPair = null; + + if (!invalid && (IMPORT_XSD_OPTION).equalsIgnoreCase(optionType) + || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType)) { + ArrayList optionValues = option.getOptionValues(); + + for (int count = 0; count < optionValues.size(); ++count) { + schemaNSLocationPair = ((String) optionValues.get(count)).trim(); + if ((schemaNSLocationPair.charAt(0) != OPEN_BRACKET) + || (schemaNSLocationPair.charAt(schemaNSLocationPair.length() - 1) != CLOSE_BRACKET) + || (schemaNSLocationPair.indexOf(COMMA) == -1)) + + { + System.out.println("Schema Namespace-Location pair option not specified properly!!"); + invalid = true; + } + } + } + + return invalid; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java new file mode 100644 index 0000000000..4f3371126d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java @@ -0,0 +1,410 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + + +public class TuscanySchemaGenerator implements TuscanyJava2WSDLConstants +{ + public static final String NAME_SPACE_PREFIX = "stn_"; + public static final String PERIOD_SEPARATOR = "."; + private static int prefixCount = 1; + + protected String attrFormDefault = null; + protected String elementFormDefault = null; + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + protected Hashtable schemaMap = new Hashtable(); + protected Hashtable sdoAnnoMap = new Hashtable(); + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + protected SchemaBuilder schemaBuilder = null; + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + private ClassLoader classLoader; + private String className; + + // to keep loadded method using JAM + private JMethod methods []; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + private String schemaTargetNameSpace; + private String schema_namespace_prefix; + private Class clazz; + private ArrayList excludeMethods = new ArrayList(); + + public TuscanySchemaGenerator(ClassLoader loader, + String className, + String schematargetNamespace, + String schematargetNamespacePrefix, + Map schemaLocMap) + throws Exception + { + DataObjectUtil.initRuntime(); + this.classLoader = loader; + this.className = className; + clazz = Class.forName(className, true, loader); + methodTable = new MethodTable(clazz); + this.schemaTargetNameSpace = schematargetNamespace; + this.schema_namespace_prefix = schematargetNamespacePrefix; + this.schemaLocationMap = schemaLocMap; + + initializeSchemaMap(this.schemaTargetNameSpace, this.schema_namespace_prefix); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + getAttrFormDefault(), + getElementFormDefault(), + schemaLocMap, + this.classLoader ); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception + { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(classLoader); + jam_service_parms.includeClass(className); + JamService service = factory.createService(jam_service_parms); + + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) + { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType = null; + XmlSchemaSequence sequence = null; + QName methodPartSchemaTypeName = null; + for (int i = 0; i < methods.length; i++) + { + String methodName = methods[i].getSimpleName(); + JMethod jMethod = methods[i]; + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + //if (jMethod.getSimpleName().equals("init") + // || "setOperationContext".equals(jMethod.getSimpleName()) + // || "destroy".equals(jMethod.getSimpleName())) + // continue; + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) + { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + //create the schema type for the method wrapper + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) + { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + ( parameterNames != null && parameterNames[j] != null )? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + QName methodReturnSchemaTypeName = null; + + if (!returnType.isVoidType()) + { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + //generateWrapperElements(methods); + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception + { + boolean isArrayType = type.isArrayType(); + if ( isArrayType ) + { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if ( schemaTypeName == null ) + { + schemaTypeName = + schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema)schemaMap.get(schemaTargetNameSpace), schemaTypeName); + + } + else + { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray ) + { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if ( isArray ) + { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) + { + XmlSchema xmlSchema = (XmlSchema)schemaMap.get(schemaTargetNameSpace); + QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, globalElement); + + typeTable.addComplexSchemaType(this.schemaTargetNameSpace, globalElement.getName(), elementName); + + return complexType; + } + + + private String formGlobalElementName(String typeName) + { + String firstChar = typeName.substring(0,1); + return typeName.replaceFirst(firstChar, firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) + { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); + schemaMap.put(targetNamespace, xmlSchema); + + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + private void setFormDefaults() + { + + } + + public Hashtable getSdoAnnoMap() { + return sdoAnnoMap; + } + + public void setSdoAnnoMap(Hashtable sdoAnnoMap) { + this.sdoAnnoMap = sdoAnnoMap; + } + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) + { + //decide whether there must be an import or an include + if ( xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI()) ) + { + XmlSchema containingSchema = (XmlSchema)schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if ( containingSchema.getTypeByName(schemaTypeName) == null ) + { + String schemaLocation = null; + if ( (schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null ) + { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if ( !xmlSchema.getIncludes().contains(includeElement) ) + { + xmlSchema.getIncludes().add(includeElement); + } + } + } + else + { + if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values(). + contains(schemaTypeName.getNamespaceURI())) + { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap)xmlSchema.getNamespaceContext()). + put(generatePrefix(), schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() + { + if ( FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault()) ) + { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } + else + { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + public String getAttrFormDefault() { + return attrFormDefault; + } + + public void setAttrFormDefault(String attrFormDefault) { + this.attrFormDefault = attrFormDefault; + } + + public String getElementFormDefault() { + return elementFormDefault; + } + + public void setElementFormDefault(String elementFormDefault) { + this.elementFormDefault = elementFormDefault; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java new file mode 100644 index 0000000000..4abd7a7ce7 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java @@ -0,0 +1,225 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.codehaus.jam.JClass; + +public class TuscanyTypeTable +{ + public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema"; + public static final String XS_URI_PREFIX = "xs"; + public static final QName XS_QNAME = new QName(XML_SCHEMA_URI, "schema", XS_URI_PREFIX); + public static final String DELIMITER = "#"; + + private Hashtable simpleXSDTypes; + private Hashtable complexXSDTypes; + + public static String asQualifiedName(String uri, String typeName) + { + return (uri + DELIMITER + typeName); + } + + + public TuscanyTypeTable() + { + simpleXSDTypes = new Hashtable(); + complexXSDTypes = new Hashtable(); + populateSimpleXSDTypes(); + populateStdSDOTypes(); + } + + private void populateStdSDOTypes() + { + simpleXSDTypes.put("Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("Bytes", + new QName(XML_SCHEMA_URI, "hexBinary", XS_URI_PREFIX)); + simpleXSDTypes.put("Character", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("DataObject", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("Day", + new QName(XML_SCHEMA_URI, "gDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Decimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + simpleXSDTypes.put("Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("Duration", + new QName(XML_SCHEMA_URI, "duration", XS_URI_PREFIX)); + simpleXSDTypes.put("Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("Int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("Integer", + new QName(XML_SCHEMA_URI, "integer", XS_URI_PREFIX)); + simpleXSDTypes.put("Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("Month", + new QName(XML_SCHEMA_URI, "gMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("monthDay", + new QName(XML_SCHEMA_URI, "gMonthDay", XS_URI_PREFIX)); + simpleXSDTypes.put("Object", + new QName(XML_SCHEMA_URI, "anySimpleType", XS_URI_PREFIX)); + simpleXSDTypes.put("Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Strings", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("Time", + new QName(XML_SCHEMA_URI, "time", XS_URI_PREFIX)); + simpleXSDTypes.put("Year", + new QName(XML_SCHEMA_URI, "gYear", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonth", + new QName(XML_SCHEMA_URI, "gYearMonth", XS_URI_PREFIX)); + simpleXSDTypes.put("YearMonthDay", + new QName(XML_SCHEMA_URI, "date", XS_URI_PREFIX)); + simpleXSDTypes.put("URI", + new QName(XML_SCHEMA_URI, "anyURI", XS_URI_PREFIX)); + } + + private void populateSimpleXSDTypes() { + //todo pls use the types from org.apache.ws.commons.schema.constants.Constants + simpleXSDTypes.put("int", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.String", + new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX)); + simpleXSDTypes.put("boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("char", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Integer", + new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Double", + new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Float", + new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Long", + new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Character", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Boolean", + new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Byte", + new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Short", + new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Date", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.util.Calendar", + new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX)); + simpleXSDTypes.put("java.lang.Object", + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put("java.math.BigDecimal", + new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX)); + + // Any types + simpleXSDTypes.put(OMElement.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(ArrayList.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(Vector.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + simpleXSDTypes.put(List.class.getName(), + new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX)); + } + + public QName getStdSdoType(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public QName getComplexSchemaTypeName(String sdoURI, String sdoTypeName) + { + return (QName) complexXSDTypes.get(asQualifiedName(sdoURI, sdoTypeName)); + } + + public QName getComplexSchemaTypeName(JClass javaClass, ClassLoader cl) throws Exception + { + String namespace = Java2WSDLUtils.schemaNamespaceFromClassName( + javaClass.getQualifiedName(), cl).toString(); + return (QName) complexXSDTypes.get(asQualifiedName(namespace, javaClass.getSimpleName())); + } + + public boolean isSimpleType(String typeName) + { + Iterator keys = simpleXSDTypes.keySet().iterator(); + while (keys.hasNext()) { + String s = (String) keys.next(); + if (s.equals(typeName)) { + return true; + } + } + return false; + } + + public QName getSimpleSchemaTypeName(String typename) + { + return (QName) simpleXSDTypes.get(typename); + } + + public void addSimpleSchemaType(String typeName, QName schemaType) + { + simpleXSDTypes.put(typeName, schemaType); + } + + + public void addComplexSchemaType(String namespaceURI, String name, QName schemaType) + { + complexXSDTypes.put(asQualifiedName(namespaceURI, name), schemaType); + } + + + public QName getQNamefortheType(String namespaceURI, String typeName) + { + if ( XML_SCHEMA_URI.equals(namespaceURI)) + { + return getSimpleSchemaTypeName(typeName); + } + else + { + return getComplexSchemaTypeName(namespaceURI, typeName); + } + } +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java new file mode 100644 index 0000000000..a742e8913d --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java @@ -0,0 +1,373 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.commons.schema.XmlSchemaCollection; +import org.apache.ws.commons.schema.XmlSchemaComplexType; +import org.apache.ws.commons.schema.XmlSchemaElement; +import org.apache.ws.commons.schema.XmlSchemaForm; +import org.apache.ws.commons.schema.XmlSchemaImport; +import org.apache.ws.commons.schema.XmlSchemaInclude; +import org.apache.ws.commons.schema.XmlSchemaSequence; +import org.apache.ws.commons.schema.utils.NamespaceMap; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.SchemaGenerator; +import org.apache.ws.java2wsdl.bytecode.MethodTable; +import org.codehaus.jam.JClass; +import org.codehaus.jam.JMethod; +import org.codehaus.jam.JParameter; +import org.codehaus.jam.JamClassIterator; +import org.codehaus.jam.JamService; +import org.codehaus.jam.JamServiceFactory; +import org.codehaus.jam.JamServiceParams; + +public class TuscanyWSDLTypesGenerator implements TuscanyJava2WSDLConstants { + public static final String NAME_SPACE_PREFIX = "stn_"; + + public static final String PERIOD_SEPARATOR = "."; + + private static int prefixCount = 1; + + protected GenerationParameters generationParams; + + protected Hashtable targetNamespacePrefixMap = new Hashtable(); + + protected Hashtable schemaMap = new Hashtable(); + + protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection(); + + private TuscanyTypeTable typeTable = new TuscanyTypeTable(); + + protected SchemaBuilder schemaBuilder = null; + + protected Map schemaLocationMap = null; + + private static final Log log = LogFactory.getLog(SchemaGenerator.class); + + // to keep loadded method using JAM + private JMethod methods[]; + + //to store byte code method using Axis 1.x codes + private MethodTable methodTable; + + private Class clazz; + + private ArrayList excludeMethods = new ArrayList(); + + public TuscanyWSDLTypesGenerator(GenerationParameters genParams) throws Exception { + DataObjectUtil.initRuntime(); + this.generationParams = genParams; + + clazz = Class.forName(generationParams.getSourceClassName(), + true, + generationParams.getClassLoader()); + methodTable = new MethodTable(clazz); + + initializeSchemaMap(generationParams.getSchemaTargetNamespace(), + generationParams.getSchemaTargetNamespacePrefix()); + schemaBuilder = new SchemaBuilder(xmlSchemaCollection, + schemaMap, + targetNamespacePrefixMap, + typeTable, + generationParams.getAttrFormDefault(), + generationParams.getElementFormDefault(), + generationParams.getSchemaLocationMap(), + generationParams.getClassLoader()); + } + + /** + * Generates schema for all the parameters in method. First generates schema + * for all different parameter type and later refers to them. + * + * @return Returns XmlSchema. + * @throws Exception + */ + public Collection buildWSDLTypes() throws Exception { + JamServiceFactory factory = JamServiceFactory.getInstance(); + JamServiceParams jam_service_parms = factory.createServiceParams(); + //setting the classLoder +// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader)); + //it can posible to add the classLoader as well + jam_service_parms.addClassLoader(generationParams.getClassLoader()); + jam_service_parms.includeClass(generationParams.getSourceClassName()); + + for ( int count = 0 ; count < generationParams.getExtraClasses().size() ; ++count ) + { + jam_service_parms.includeClass((String)generationParams.getExtraClasses().get(count)); + } + + JamService service = factory.createService(jam_service_parms); + QName extraSchemaTypeName = null; + JamClassIterator jClassIter = service.getClasses(); + //all most all the time the ittr will have only one class in it + while (jClassIter.hasNext()) { + JClass jclass = (JClass) jClassIter.next(); + // serviceName = jclass.getSimpleName(); + //todo in the future , when we support annotation we can use this + //JAnnotation[] annotations = jclass.getAnnotations(); + + if ( jclass.getQualifiedName().equals(generationParams.getSourceClassName()) ) + { + /** + * Schema genertaion done in two stage 1. Load all the methods and + * create type for methods parameters (if the parameters are Bean + * then it will create Complex types for those , and if the + * parameters are simple type which decribe in SimpleTypeTable + * nothing will happen) 2. In the next stage for all the methods + * messages and port types will be creteated + */ + methods = jclass.getDeclaredMethods(); + //short the elements in the array + Arrays.sort(methods); + + // since we do not support overload + HashMap uniqueMethods = new HashMap(); + XmlSchemaComplexType methodSchemaType; + XmlSchemaSequence sequence = null; + + for (int i = 0; i < methods.length; i++) { + JMethod jMethod = methods[i]; + + String methodName = methods[i].getSimpleName(); + // no need to think abt this method , since that is system + // config method + if (excludeMethods.contains(jMethod.getSimpleName())) { + continue; + } + + if (uniqueMethods.get(jMethod.getSimpleName()) != null) { + throw new Exception( + " Sorry we don't support methods overloading !!!! "); + } + + if (!jMethod.isPublic()) { + // no need to generate Schema for non public methods + continue; + } + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + //create the schema type for the method wrapper + + uniqueMethods.put(jMethod.getSimpleName(), jMethod); + JParameter [] paras = jMethod.getParameters(); + String parameterNames [] = null; + if (paras.length > 0) { + parameterNames = methodTable.getParameterNames(methodName); + sequence = new XmlSchemaSequence(); + + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName()); + methodSchemaType.setParticle(sequence); + } + + for (int j = 0; j < paras.length; j++) { + JParameter methodParameter = paras[j]; + JClass paraType = methodParameter.getType(); + generateSchemaForType(sequence, paraType, + (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : methodParameter.getSimpleName()); + } + // for its return type + JClass returnType = jMethod.getReturnType(); + + if (!returnType.isVoidType()) { + methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE); + sequence = new XmlSchemaSequence(); + methodSchemaType.setParticle(sequence); + generateSchemaForType(sequence, returnType, "return"); + } + } + } + else + { + //generate the schema type for extra classes + extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(jclass.getQualifiedName()); + if (extraSchemaTypeName == null) + { + extraSchemaTypeName = schemaBuilder.generateSchema(jclass); + } + } + } + return schemaMap.values(); + } + + private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception { + boolean isArrayType = type.isArrayType(); + if (isArrayType) { + type = type.getArrayComponentType(); + } + + String classTypeName = type.getQualifiedName(); + + QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName); + if (schemaTypeName == null) { + schemaTypeName = schemaBuilder.generateSchema(type); + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + addImportORInclude((XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()), + schemaTypeName); + + } else { + addContentToMethodSchemaType(sequence, + schemaTypeName, + partName, + type.isArrayType()); + } + + return schemaTypeName; + } + + private void addContentToMethodSchemaType(XmlSchemaSequence sequence, + QName schemaTypeName, + String paraName, + boolean isArray) { + XmlSchemaElement elt1 = new XmlSchemaElement(); + elt1.setName(paraName); + elt1.setSchemaTypeName(schemaTypeName); + sequence.getItems().add(elt1); + + if (isArray) { + elt1.setMaxOccurs(Long.MAX_VALUE); + elt1.setMinOccurs(0); + } + } + + private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) throws Exception { + XmlSchema xmlSchema = (XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()); + QName elementName = new QName(generationParams.getSchemaTargetNamespace(), + localPartName, + generationParams.getSchemaTargetNamespacePrefix()); + XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema); + + XmlSchemaElement globalElement = new XmlSchemaElement(); + globalElement.setSchemaType(complexType); + globalElement.setName(formGlobalElementName(localPartName)); + globalElement.setQName(elementName); + + xmlSchema.getItems().add(globalElement); + xmlSchema.getElements().add(elementName, + globalElement); + + typeTable.addComplexSchemaType(generationParams.getSchemaTargetNamespace(), + globalElement.getName(), + elementName); + + return complexType; + } + + private String formGlobalElementName(String typeName) { + String firstChar = typeName.substring(0, + 1); + return typeName.replaceFirst(firstChar, + firstChar.toLowerCase()); + } + + public TuscanyTypeTable getTypeTable() { + return typeTable; + } + + public JMethod[] getMethods() { + return methods; + } + + private String generatePrefix() { + return NAME_SPACE_PREFIX + prefixCount++; + } + + public void setExcludeMethods(ArrayList excludeMethods) { + this.excludeMethods = excludeMethods; + } + + private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) { + XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); + xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); + xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); + + targetNamespacePrefixMap.put(targetNamespace, + targetNamespacePrefix); + schemaMap.put(targetNamespace, + xmlSchema); + + NamespaceMap prefixmap = new NamespaceMap(); + prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, + TuscanyTypeTable.XML_SCHEMA_URI); + prefixmap.put(targetNamespacePrefix, + targetNamespace); + xmlSchema.setNamespaceContext(prefixmap); + } + + + private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) { + //decide whether there must be an import or an include + if (xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI())) { + XmlSchema containingSchema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI()); + //if the type is not defined in the Schema then include + if (containingSchema.getTypeByName(schemaTypeName) == null) { + String schemaLocation = null; + if ((schemaLocation = (String) schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null) { + schemaLocation = DEFAULT_SCHEMA_LOCATION; + } + + XmlSchemaInclude includeElement = new XmlSchemaInclude(); + includeElement.setSchemaLocation(schemaLocation); + + if (!xmlSchema.getIncludes().contains(includeElement)) { + xmlSchema.getIncludes().add(includeElement); + } + } + } else { + if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values() + .contains(schemaTypeName.getNamespaceURI())) { + XmlSchemaImport importElement = new XmlSchemaImport(); + importElement.setNamespace(schemaTypeName.getNamespaceURI()); + xmlSchema.getItems().add(importElement); + ((NamespaceMap) xmlSchema.getNamespaceContext()).put(generatePrefix(), + schemaTypeName.getNamespaceURI()); + } + } + } + + private XmlSchemaForm getAttrFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getAttrFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } + + private XmlSchemaForm getElementFormDefaultSetting() { + if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getElementFormDefault())) { + return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); + } else { + return new XmlSchemaForm(XmlSchemaForm.QUALIFIED); + } + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java new file mode 100644 index 0000000000..26b3d092de --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java @@ -0,0 +1,38 @@ +/* + * 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.tools.java2wsdl.generate; + +import java.util.EventObject; + +public class WSDLGenEvent extends EventObject { + private int generationPhase = WSDLGenListener.UNKNOWN; + + public WSDLGenEvent(Object source, int genPhase) { + super(source); + this.generationPhase = genPhase; + } + + public int getGenerationPhase() { + return generationPhase; + } + + public void setGenerationPhase(int generationPhase) { + this.generationPhase = generationPhase; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java new file mode 100644 index 0000000000..788d162f34 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java @@ -0,0 +1,39 @@ +/* + * 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.tools.java2wsdl.generate; + +public interface WSDLGenListener { + public static int UNKNOWN = 0; + + public static int INPUT_ARGS_PARSING = 1; + + public static int INPUT_ARGS_VALIDATION = 2; + + public static int WSDL_MODEL_CREATION = 3; + + public static int WSDL_MODEL_WRITING = 4; + + public static String[] phaseAsString = { "Unknown", + "Input Arguments Parsing", "Input Arguments Validation", + "WSDL Model Creation", "WSDL Model Writing" }; + + public void WSDLGenPhaseStarted(WSDLGenEvent event); + + public void WSDLGenPhaseCompleted(WSDLGenEvent event); +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java new file mode 100644 index 0000000000..b30b8cd62b --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java @@ -0,0 +1,143 @@ +/* + * 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.tools.java2wsdl.util; + +import java.util.ArrayList; +import java.util.List; + +public class XMLNameUtil { + + /** + * Returns a valid Java name from an XML Name. + * + * @param name + * @param isUpperCase + * @return a valid Java name from an XML Name + */ + public static String getJavaNameFromXMLName(String name, boolean isUpperCase) { + List parsedName = parseName(name, '_'); + StringBuilder result = new StringBuilder(64 * parsedName.size()); + for (String nameComponent: parsedName) { + if (nameComponent.length() > 0) { + if (result.length() > 0 || isUpperCase) { + result.append(Character.toUpperCase(nameComponent.charAt(0))); + result.append(nameComponent.substring(1)); + } else { + result.append(nameComponent); + } + } + } + + if (result.length() == 0) { + return "_"; + } + if (Character.isJavaIdentifierStart(result.charAt(0))) { + return isUpperCase ? result.toString() : decapitalizeName(result.toString()); + } + return "_" + result; + } + + /** + * Decapitalize a name. + * @param name + * @return a decapitalized name + */ + public static String decapitalizeName(String name) { + if (name.length() == 0) { + return name; + } else { + String lowerName = name.toLowerCase(); + int i; + for (i = 0; i < name.length(); i++) { + if (name.charAt(i) == lowerName.charAt(i)) { + break; + } + } + if (i > 1 && i < name.length()) { + --i; + } + return name.substring(0, i).toLowerCase() + name.substring(i); + } + } + + /** + * Parse the given name. + * + * @param sourceName + * @param separator + * @return some stuff parsed from the name + */ + private static List parseName(String sourceName, char separator) { + List result = new ArrayList(); + if (sourceName != null) { + StringBuilder currentWord = new StringBuilder(64); + boolean lastIsLower = false; + int index; + int length; + for (index = 0, length = sourceName.length(); index < length; ++index) { + char curChar = sourceName.charAt(index); + if (!Character.isJavaIdentifierPart(curChar)) { + curChar = separator; + } + if (Character.isUpperCase(curChar) + || (!lastIsLower && Character.isDigit(curChar)) + || curChar == separator) { + + if (lastIsLower && currentWord.length() > 1 + || curChar == separator && currentWord.length() > 0) { + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + } + lastIsLower = false; + } else { + if (!lastIsLower) { + int currentWordLength = currentWord.length(); + if (currentWordLength > 1) { + char lastChar = currentWord.charAt(--currentWordLength); + currentWord.setLength(currentWordLength); + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + currentWord.append(lastChar); + } + } + lastIsLower = true; + } + + if (curChar != separator) { + currentWord.append(curChar); + } + } + + result.add(currentWord.toString()); + } + return result; + } + + /** + * Return an EPackage name for the given namespace. + * + * @param namespace + * @return an EPackage name for the given namespace + */ + public static String getPackageNameFromNamespace(String namespace) { + return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace); + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java new file mode 100644 index 0000000000..22383e99db --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java @@ -0,0 +1,222 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axis2.description.AxisMessage; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.util.FileWriter; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; +import org.apache.axis2.wsdl.databinding.TypeMapper; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getJavaNameFromXMLName; + +/** + * Overrides the Axis2 JavaEmitter to generate unwrapped methods. + */ +public class JavaInterfaceEmitter extends JavaEmitter { + + private CodeGenConfiguration codegenConfiguration; + private TypeMapper typeMapper; + + public void setCodeGenConfiguration(CodeGenConfiguration configuration) { + super.setCodeGenConfiguration(configuration); + codegenConfiguration=configuration; + } + + public void setMapper(TypeMapper typeMapper) { + super.setMapper(typeMapper); + this.typeMapper = typeMapper; + } + + private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) { + List parameterElementList = new ArrayList(); + + if (message != null && message.getElementQName()!=null) { + + SDODataBindingTypeMappingEntry typeMappingEntry = + (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName()); + List typeMappings; + if (wrapped) { + typeMappings = (List)typeMappingEntry.getPropertyClassNames(); + } else { + typeMappings = new ArrayList(); + typeMappings.add(typeMappingEntry.getClassName()); + } + + for (int i=0; i> Generating Java class " + packageName + "." + className); + File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(), + packageName, className, ".java"); + if (outputFile.exists()) { + outputFile.delete(); + } + + writeClass(interfaceModel, interfaceWriter); + } + + protected String makeJavaClassName(String word) { + //return XMLNameUtil.getJavaNameFromXMLName(word, true); + return getJavaNameFromXMLName(word, true); + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java new file mode 100644 index 0000000000..b68277566a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java @@ -0,0 +1,230 @@ +/* + * 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.tools.wsdl2java.generate; + +import static org.apache.tuscany.tools.java2wsdl.util.XMLNameUtil.getPackageNameFromNamespace; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.PortType; +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.parsers.ParserConfigurationException; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.util.XMLUtils; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; +import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension; +import org.apache.axis2.wsdl.codegen.extension.PackageFinder; +import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension; +import org.apache.axis2.wsdl.databinding.JavaTypeMapper; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +public class JavaInterfaceGenerator { + + private List codegenExtensions = new ArrayList(); + private List codegenConfigurations= new LinkedList(); + + + + + public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName, + Map typeMapping) throws CodeGenerationException { + + Definition definition; + try { + definition = readWSDL(uri); + } catch (WSDLException e) { + throw new CodeGenerationException(e); + } + + HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports)); + + // Service service=(Service)definition.getServices().values().().next(); + + HashSet donePortTypes= new HashSet(); + + for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) { + Service service = (Service) sIter.next(); + + QName serviceQname = service.getQName(); + for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) { + Port port= (Port) pIter.next(); + if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested. + PortType portType= getPortType(port); + if(null == portType) continue; // not connected. + QName pQName= portType.getQName(); + if(donePortTypes.contains(pQName)) continue; //allready did it. + donePortTypes.add(pQName); + + if (packageName == null) { + + packageName = getPackageNameFromNamespace(definition.getTargetNamespace()); + } + JavaTypeMapper typeMapper = new JavaTypeMapper(); + for (Map.Entry e : typeMapping.entrySet()) { + typeMapper.addTypeMappingObject(e.getKey(), e.getValue()); + } + AxisService axisService; + try { + axisService = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName()).populateService(); + } catch (AxisFault e) { + throw new CodeGenerationException(e); + } + axisService.setName(port.getBinding().getPortType().getQName().getLocalPart()); + CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP); + codegenConfigurations.add(codegenConfiguration); + codegenConfiguration.setAxisService(axisService); + codegenConfiguration.setAdvancedCodeGenEnabled(false); + codegenConfiguration.setAsyncOn(false); + codegenConfiguration.setDatabindingType("sdo"); + codegenConfiguration.setGenerateAll(true); + codegenConfiguration.setGenerateDeployementDescriptor(false); + codegenConfiguration.setOutputLanguage("java"); + codegenConfiguration.setOutputLocation(new File(outputLocation)); + codegenConfiguration.setPackageName(packageName); + codegenConfiguration.setPackClasses(false); + codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP); + codegenConfiguration.setPortName(port.getName()); + codegenConfiguration.setServerSide(false); + codegenConfiguration.setServiceName(service.getQName().getLocalPart()); + codegenConfiguration.setSyncOn(true); + codegenConfiguration.setTypeMapper(typeMapper); + codegenConfiguration.setWriteMessageReceiver(false); + codegenConfiguration.setWriteTestCase(false); + addExtension(new WSDLValidatorExtension(), codegenConfiguration); + addExtension(new PackageFinder(), codegenConfiguration); + addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration); + addExtension(new DefaultDatabindingExtension(), codegenConfiguration); + } + } + } + + + private PortType getPortType(Port port) { + Binding binding = port.getBinding(); + if(null != binding){ + return binding.getPortType(); + } + return null; + + } + + + @SuppressWarnings("unchecked") + private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) { + //ext.init(codegenConfiguration); + codegenExtensions.add(new Object[]{ext, codegenConfiguration}); + } + + public void generate() throws CodeGenerationException { + try { + for (int i = 0; i < codegenExtensions.size(); i++) { + //CodeGenExtension + Object[] pair = (Object[])codegenExtensions.get(i); + + CodeGenExtension cge= (CodeGenExtension) pair[0]; + CodeGenConfiguration cgf= (CodeGenConfiguration)pair[1]; + + cge.engage(cgf); + + } + + for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){ + JavaInterfaceEmitter emitter = new JavaInterfaceEmitter(); + emitter.setCodeGenConfiguration(codegenConfiguration); + emitter.setMapper(codegenConfiguration.getTypeMapper()); + + emitter.writeInterface(false); + } + + } catch (Exception e) { + throw new CodeGenerationException(e); + } + } + + /** + * Read the WSDL file + * @param uri + * @return + * @throws WSDLException + */ + private Definition readWSDL(String uri) throws WSDLException { + + WSDLReader reader = + WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.importDocuments", true); + + File file = new File(uri); + String baseURI; + + if (uri.startsWith("http://")){ + baseURI = uri; + } else{ + if(file.getParentFile() == null){ + try { + baseURI = new File(".").getCanonicalFile().toURI().toString(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } else { + baseURI = file.getParentFile().toURI().toString(); + } + } + + Document doc; + try { + doc = XMLUtils.newDocument(uri); + } catch (ParserConfigurationException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser Configuration Error", + e); + } catch (SAXException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser SAX Error", + e); + + } catch (IOException e) { + throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); + } + + return reader.readWSDL(baseURI, doc); + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java new file mode 100644 index 0000000000..cb413bca50 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java @@ -0,0 +1,53 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.io.File; + +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; + +/** + * @author lresende + */ +public class RemotableInterfaceWritter extends InterfaceWriter { + private static final String REMOTABLE_INTERFACE_TEMPLATE="/RemotableInterfaceTemplate.xsl"; + + public RemotableInterfaceWritter(String outputFileLocation) { + super(outputFileLocation); + } + + public RemotableInterfaceWritter(File outputFileLocation, String language) { + super(outputFileLocation, language); + } + + /** + * Loads the template. + */ + @Override + public void loadTemplate() throws CodeGenerationException { + // the default behavior for the class writers is to use the property map from the languge specific types + // The properties are arranged in the following order + // .* .template=, + + //overrida original behaviour to always load the template we specified + this.xsltStream = this.getClass().getResourceAsStream(REMOTABLE_INTERFACE_TEMPLATE); + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java new file mode 100644 index 0000000000..075959f985 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java @@ -0,0 +1,63 @@ +/* + * 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.tools.wsdl2java.generate; + +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension; +import org.apache.axis2.wsdl.databinding.TypeMapper; + +/** + * SDO data binding codegen extension. + */ +public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension { + + private TypeMapper typeMapper; + + public SDODataBindingCodegenExtension(TypeMapper typeMapper) { + this.typeMapper=typeMapper; + } + + protected boolean testFallThrough(String dbFrameworkName) { + return !dbFrameworkName.equals("sdo"); + } + +// public void engage() { +// if (testFallThrough(configuration.getDatabindingType())) { +// return; +// } +// +// // Set the type mapper into the config +// configuration.setTypeMapper(typeMapper); +// +// } + + public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { + // TODO Auto-generated method stub + if (testFallThrough(configuration.getDatabindingType())) { + return; + } + + // Set the type mapper into the config + configuration.setTypeMapper(typeMapper); + + + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java new file mode 100644 index 0000000000..2d81ef12bf --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java @@ -0,0 +1,51 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.util.List; + +/** + * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate + * method signatures. + */ +public class SDODataBindingTypeMappingEntry { + + private final boolean anonymous; + private final List propertyClassNames; + private final String className; + + public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List propertyClassNames) { + this.className = className; + this.anonymous = anonymous; + this.propertyClassNames = propertyClassNames; + } + + public boolean isAnonymous() { + return anonymous; + } + + public String getClassName() { + return className; + } + + public List getPropertyClassNames() { + return propertyClassNames; + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java new file mode 100644 index 0000000000..94f8d88646 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java @@ -0,0 +1,357 @@ +/* + * 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.tools.wsdl2java.generate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.helper.XSDHelper; + +public class WSDL2JavaGenerator { + static protected final int DYNAMIC_SDO = 1; + + /** + * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory + * ] [ -javaPackage ] + * For example: generate somedir/somefile.wsdl Basic options: + * -targetDirectory Generates the Java source code in the specified + * directory. By default, the code is generated in the same directory as the + * input wsdl file. -javaPackage Overrides the Java package for the + * generated classes. By default the package name is derived from the + * targetNamespace of the WSDL definition being generated. For example, if + * the targetNamespace is "http://www.example.com/simple", the default + * package will be "com.example.simple". + */ + public static void main(String args[]) { + if (args.length == 0) { + printUsage(); + return; + } + + String portName = null; + String targetDirectory = null; + String wsdlJavaPackage = null; + String xsdJavaPackage = null; + int dynamicSDO = 0; + + int index = 0; + for (; index < args.length && args[index].startsWith("-"); ++index) { + if (args[index].equalsIgnoreCase("-port")) { + portName = args[++index]; + } else if (args[index].equalsIgnoreCase("-targetDirectory")) { + targetDirectory = args[++index]; + } else if (args[index].equalsIgnoreCase("-javaPackage")) { + wsdlJavaPackage = args[++index]; + } else if (args[index].equalsIgnoreCase("-dynamicSDO")) { + dynamicSDO = DYNAMIC_SDO; + } + // else if (...) + else { + printUsage(); + return; + } + } + + String wsdlFileName = args[index]; + if (wsdlFileName == null || targetDirectory == null) { + printUsage(); + return; + } + + generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, dynamicSDO); + + } + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String targetDirectory, + String wsdlJavaPackage, + String xsdJavaPackage, int genOptions){ + generateFromWSDL( wsdlFileName, null, targetDirectory, + wsdlJavaPackage, + xsdJavaPackage, genOptions); + + } + + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String[] ports, + String targetDirectory, String wsdlJavaPackage, + String xsdJavaPackage, int genOptions) + { + + // Initialize the SDO runtime + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData, null); + + try { + + // Load the WSDL file + File inputFile = new File(wsdlFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + + // Define SDO metadata + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) { + targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent(); + } else { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + // Populate the typeMapping table that will be given to the Axis2 WSDL2Java + Map typeMapping = + new HashMap(); + if (!packageRegistry.values().isEmpty()) { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + + // Populate list of GenPackages and a map of GenClasses keyed by EClass + List genPackages = new ArrayList(); + Map genClasses = new HashMap(); + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) { + EPackage currentEPackage = (EPackage)iter.next(); + String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage); + String currentPrefix = CodeGenUtil.capName(currentEPackage.getName()); + + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, + currentPrefix, genOptions, resourceSet); + genPackages.add(currentGenPackage); + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + genClasses.put(genClass.getEcoreClass(), genClass); + } + + } + + // Process all the SDO packages + // Populate the qname -> interfaceName typeMapping table + for (GenPackage currentGenPackage : genPackages) { + EPackage currentEPackage = currentGenPackage.getEcorePackage(); + + // Populate the type mappings for all the complex types + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(genClass.getEcoreClass())); + String interfaceName = (DYNAMIC_SDO & genOptions) == DYNAMIC_SDO ? "commonj.sdo.DataObject" : currentGenPackage + .getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, false, null); + typeMapping.put(qname, typeMappingEntry); + } + + // Process all the global XSD elements + EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage); + if (documentRoot != null) { + for (EStructuralFeature element : (List)extendedMetaData + .getElements(documentRoot)) { + EClassifier elementType = element.getEType(); + + // Handle a complex type + if (elementType instanceof EClass) { + EClass eClass = (EClass)elementType; + + GenClass genClass = genClasses.get(elementType); + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String interfaceName = (DYNAMIC_SDO & genOptions) == DYNAMIC_SDO ? "commonj.sdo.DataObject" : genClass + .getGenPackage().getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + boolean anonymous = extendedMetaData.isAnonymous(eClass); + + // Build list of property class names + List propertyClassNames=new ArrayList(); + for (EStructuralFeature feature : (List)eClass.getEStructuralFeatures()) { + EClassifier propertyType = feature.getEType(); + if (propertyType instanceof EClass) { + GenClass propertyGenClass = genClasses.get(propertyType); + String propertyClassName = (DYNAMIC_SDO & genOptions) == DYNAMIC_SDO ? "commonj.sdo.DataObject" + : propertyGenClass.getGenPackage().getInterfacePackageName() + '.' + + propertyGenClass.getInterfaceName(); + propertyClassNames.add(propertyClassName); + } else if (propertyType instanceof EClassifier) { + String propertyClassName = propertyType.getInstanceClass().getName(); + propertyClassNames.add(propertyClassName); + } + } + + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames); + typeMapping.put(qname, typeMappingEntry); + + } else { + + // Handle a simple type + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String className = elementType.getInstanceClass().getName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(className, false, null); + typeMapping.put(qname, typeMappingEntry); + } + } + } + } + } + + try { + JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName, + ports, + targetDirectory, + wsdlJavaPackage, + typeMapping); + codeGenerator.generate(); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + } + + @SuppressWarnings("unchecked") + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, + int genOptions, ResourceSet resourceSet) { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, + String prefix, int genOptions) { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(Collections.singleton(ePackage)); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + // FIXME workaround java.lang.NoClassDefFoundError: + // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + + if (basePackage != null) { + genPackage.setBasePackage(basePackage); + } + if (prefix != null) { + genPackage.setPrefix(prefix); + } + + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /* CodeGenUtil. */shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) { + ePackage.setName(name); + } + return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); + stringTokenizer.hasMoreTokens();) { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" [ -dynamicSDO ]"); + System.out.println(" "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.wsdl"); + } + + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/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/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl new file mode 100644 index 0000000000..e3da5da20f --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + /** + * .java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ + package ; + + import org.osoa.sca.annotations.Remotable; + import org.apache.tuscany.api.annotation.DataType; + + /* + * java interface + */ + + @Remotable + @DataType(name="commonj.sdo.DataObject") + public interface { + + + + + + + + /** + * Auto generated method signatures + * @param + */ + public void + ( + + , + ) throws java.rmi.RemoteException; + + + + + + /** + * Auto generated method signature + * @param + */ + + public void start( + + + , + ,final . callback) throws java.rmi.RemoteException; + + + + + + + + + /** + * Auto generated method signature + + *@param + + */ + public void + ( + + , + + ) throws java.rmi.RemoteException; + + + + + + // + } + + + + \ No newline at end of file diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java new file mode 100644 index 0000000000..e679496509 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.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.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerValue { + + public int getValue(String custId, String stockSymbol) { + return 0; + } + + public Customer getCustomerDetails(String custId) { + return new Customer(); + } + + public String noArgsServiceMethod() + { + return new String(); + } + + private void privateServiceMethod() + { + + } + +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java new file mode 100644 index 0000000000..4b5a795f2c --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.tuscany.tools.java2wsdl.generate.account.Account; +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + +public class CustomerWithAccount { + + private Customer customer = new Customer(); + + private Account[] accounts; + + public int getValue(String custId, String stockSymbol) { + return 123; + } + + public Customer getCustomerDetails(String custId) { + return customer; + } + + public Account getCustomerAccount(String custId, String accountId) { + return accounts[0]; + } + + public Account[] getAccounts() { + return accounts; + } + + public void setAccounts(Account[] accounts) { + this.accounts = accounts; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java new file mode 100644 index 0000000000..a72321c9b1 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * A JUnit test case to test the Tuscany Java 2 WSDL Generation + */ +public class TuscanyJava2WSDLTestCase extends TestCase { + + /** + * setup the pre-requisites for the test case to run + * + * @exception Exception + */ + protected void setUp() throws Exception { + // System.out.println("inside setup"); + super.setUp(); + } + + /** + * @exception Exception + */ + protected void tearDown() throws Exception { + // System.out.println("inside tearDown"); + super.tearDown(); + } + + + /** + * Simple WSDL generation test. + */ + public void testSimpleWSDLGeneration() { + String[] arguments = new String[] { "-cn","org.apache.tuscany.tools.java2wsdl.generate.CustomerValue", + "-o", "target/java2wsdl-source", + "-xc", "org.apache.tuscany.tools.java2wsdl.generate.extra.GoldCustomer"}; + + + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + /** + * Test WSDL generation where a parameter Object[] is involved. + */ + public void testWsdlGeneration2() { + + String[] arguments = new String[] + { + "-cn", + "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount", + "-o", "target/java2wsdl-source", }; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + public void testWsdlGeneration_SDO_Static() + { + //tests for SDOs where XSD exist. Hence no XSDs must be generated + String[] arguments = new String[] { + "-cn", + "org.soapinterop.CreditScoreDocLit", + "-o", "target/java2wsdl-source", + "-ixsd", "[http://www.example.org/creditscore/doclit/," + + "http://www.example.org/creditscore/doclit/xsd]"}; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CreditScoreDocLit.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + + + /** + * Test WSDL generation from a java interface and then generate the java + * interface using the generated WSDL. + */ + public void _testRoundTrip() { + // TODO implement round trip + // this should re-generate java interfaces from the generated wsdl + // and compile (?) the generated java code. + // fail(); + + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java new file mode 100644 index 0000000000..84d59164ee --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java @@ -0,0 +1,53 @@ +/* + * 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.tools.java2wsdl.generate.account; + +import java.math.BigDecimal; + +public class Account { + int accountType; + + String accountNo; + + BigDecimal balance; + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public int getAccountType() { + return accountType; + } + + public void setAccountType(int accountType) { + this.accountType = accountType; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java new file mode 100644 index 0000000000..a28399e7fe --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.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.tools.java2wsdl.generate.customer; + +public class Customer { + private String name = ""; + + public int custType = 0; + + public String getName() { + return name; + } +} + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java new file mode 100644 index 0000000000..afc68a3217 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate.extra; + +import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer; + + + + +public class GoldCustomer extends Customer { + public String goldCustNumber = ""; + + public String getGoldCustNumber() { + return goldCustNumber; + } + + public void setGoldCustNumber(String goldCustNumber) { + this.goldCustNumber = goldCustNumber; + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java new file mode 100644 index 0000000000..e2a2d332c5 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.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.tools.wsdl2java.generate; + +import java.io.IOException; +import java.io.FileReader; +import java.io.Reader; + +import junit.framework.TestCase; + +/** + * Test case for WSDL2Java + */ +public class WSDL2JavaGeneratorTestCase extends TestCase { + + public void testAccountService() { + + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + } + + public void testDynamicSDO() throws IOException { + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + "-dynamicSDO", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + char buffer[] = new char[1024]; + Reader file = new FileReader("target/wsdl2java-source/org/apache/tuscany/tools/wsdl2java/generate/account/AccountService.java"); + file.read(buffer); + file.close(); + assertTrue(new String(buffer).indexOf("commonj.sdo.DataObject") != -1); + } +} diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java new file mode 100644 index 0000000000..e9e8aa882a --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java @@ -0,0 +1,25 @@ +/* + * 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.soapinterop; + +public interface CreditScoreDocLit { + public org.example.creditscore.doclit.CreditReport getCreditScore( + org.example.creditscore.doclit.Customer param0) throws java.rmi.RemoteException; + } + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl new file mode 100644 index 0000000000..e7be3ce5ba --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl new file mode 100644 index 0000000000..09d1a58589 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl new file mode 100644 index 0000000000..051f604bb2 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl new file mode 100644 index 0000000000..820c26ca34 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..a565f3fa65 --- /dev/null +++ b/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3