From f4e3e383071b6947d56794d9af5e9e6438aa3235 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 15 Sep 2008 00:17:09 +0000 Subject: Temporarily renamed sca-android branch to pull a recent revision of trunk into sca-android. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@695316 13f79535-47bb-0310-9956-ffa450edef68 --- branches/sca-android/modules/assembly/DISCLAIMER | 8 - branches/sca-android/modules/assembly/LICENSE | 205 --- branches/sca-android/modules/assembly/NOTICE | 6 - branches/sca-android/modules/assembly/pom.xml | 50 - .../tuscany/sca/assembly/AbstractContract.java | 77 -- .../tuscany/sca/assembly/AbstractProperty.java | 122 -- .../tuscany/sca/assembly/AbstractReference.java | 43 - .../tuscany/sca/assembly/AbstractService.java | 28 - .../tuscany/sca/assembly/AssemblyFactory.java | 155 --- .../java/org/apache/tuscany/sca/assembly/Base.java | 43 - .../org/apache/tuscany/sca/assembly/Binding.java | 63 - .../org/apache/tuscany/sca/assembly/Callback.java | 40 - .../org/apache/tuscany/sca/assembly/Component.java | 132 -- .../tuscany/sca/assembly/ComponentProperty.java | 88 -- .../tuscany/sca/assembly/ComponentReference.java | 74 - .../tuscany/sca/assembly/ComponentService.java | 59 - .../apache/tuscany/sca/assembly/ComponentType.java | 77 -- .../org/apache/tuscany/sca/assembly/Composite.java | 110 -- .../tuscany/sca/assembly/CompositeReference.java | 37 - .../tuscany/sca/assembly/CompositeService.java | 56 - .../tuscany/sca/assembly/ConfiguredOperation.java | 59 - .../tuscany/sca/assembly/ConstrainingType.java | 72 - .../org/apache/tuscany/sca/assembly/Contract.java | 81 -- .../sca/assembly/DefaultAssemblyFactory.java | 31 - .../apache/tuscany/sca/assembly/Extensible.java | 37 - .../tuscany/sca/assembly/Implementation.java | 27 - .../apache/tuscany/sca/assembly/Multiplicity.java | 49 - .../sca/assembly/OperationsConfigurator.java | 33 - .../tuscany/sca/assembly/OptimizableBinding.java | 66 - .../org/apache/tuscany/sca/assembly/Property.java | 41 - .../org/apache/tuscany/sca/assembly/Reference.java | 56 - .../apache/tuscany/sca/assembly/SCABinding.java | 27 - .../tuscany/sca/assembly/SCABindingFactory.java | 36 - .../org/apache/tuscany/sca/assembly/Service.java | 29 - .../java/org/apache/tuscany/sca/assembly/Wire.java | 67 - .../assembly/builder/ComponentPreProcessor.java | 28 - .../sca/assembly/builder/CompositeBuilder.java | 40 - .../builder/CompositeBuilderException.java | 45 - .../assembly/builder/CompositeBuilderMonitor.java | 36 - .../sca/assembly/builder/DomainBuilder.java | 80 -- .../tuscany/sca/assembly/builder/Problem.java | 45 - .../builder/impl/BindingPolicyComputer.java | 262 ---- .../sca/assembly/builder/impl/BindingUtil.java | 142 -- .../builder/impl/CompositeBuilderImpl.java | 121 -- .../builder/impl/CompositeCloneBuilderImpl.java | 107 -- .../impl/CompositeConfigurationBuilderImpl.java | 1417 -------------------- .../builder/impl/CompositeIncludeBuilderImpl.java | 93 -- .../builder/impl/CompositeWireBuilderImpl.java | 998 -------------- .../builder/impl/DomainWireBuilderImpl.java | 289 ---- .../builder/impl/ImplementationPolicyComputer.java | 134 -- .../builder/impl/PolicyComputationException.java | 36 - .../sca/assembly/builder/impl/PolicyComputer.java | 372 ----- .../sca/assembly/builder/impl/PrintUtil.java | 273 ---- .../sca/assembly/builder/impl/ProblemImpl.java | 112 -- .../sca/assembly/builder/impl/PropertyUtil.java | 208 --- .../sca/assembly/builder/impl/ReferenceUtil.java | 94 -- .../sca/assembly/impl/AbstractPropertyImpl.java | 114 -- .../sca/assembly/impl/AbstractReferenceImpl.java | 46 - .../sca/assembly/impl/AbstractServiceImpl.java | 36 - .../sca/assembly/impl/AssemblyFactoryImpl.java | 121 -- .../apache/tuscany/sca/assembly/impl/BaseImpl.java | 45 - .../tuscany/sca/assembly/impl/CallbackImpl.java | 82 -- .../tuscany/sca/assembly/impl/ComponentImpl.java | 174 --- .../sca/assembly/impl/ComponentPropertyImpl.java | 93 -- .../sca/assembly/impl/ComponentReferenceImpl.java | 86 -- .../sca/assembly/impl/ComponentServiceImpl.java | 71 - .../sca/assembly/impl/ComponentTypeImpl.java | 115 -- .../tuscany/sca/assembly/impl/CompositeImpl.java | 143 -- .../sca/assembly/impl/CompositeReferenceImpl.java | 51 - .../sca/assembly/impl/CompositeServiceImpl.java | 62 - .../sca/assembly/impl/ConfiguredOperationImpl.java | 91 -- .../sca/assembly/impl/ConstrainingTypeImpl.java | 105 -- .../tuscany/sca/assembly/impl/ContractImpl.java | 91 -- .../tuscany/sca/assembly/impl/ExtensibleImpl.java | 44 - .../sca/assembly/impl/ImplementationImpl.java | 74 - .../tuscany/sca/assembly/impl/PropertyImpl.java | 59 - .../tuscany/sca/assembly/impl/ReferenceImpl.java | 116 -- .../tuscany/sca/assembly/impl/ServiceImpl.java | 99 -- .../apache/tuscany/sca/assembly/impl/WireImpl.java | 96 -- ...org.apache.tuscany.sca.assembly.AssemblyFactory | 18 - .../sca/assembly/AssemblyFactoryTestCase.java | 214 --- .../apache/tuscany/sca/assembly/TestBinding.java | 55 - .../tuscany/sca/assembly/TestImplementation.java | 61 - .../apache/tuscany/sca/assembly/TestInterface.java | 42 - .../sca/assembly/TestInterfaceContract.java | 41 - .../apache/tuscany/sca/assembly/TestOperation.java | 30 - .../builder/impl/CalculateBindingURITestCase.java | 554 -------- .../builder/impl/CompositeBuilderTestCase.java | 128 -- .../assembly/builder/impl/PrintUtilTestCase.java | 229 ---- 89 files changed, 10502 deletions(-) delete mode 100644 branches/sca-android/modules/assembly/DISCLAIMER delete mode 100644 branches/sca-android/modules/assembly/LICENSE delete mode 100644 branches/sca-android/modules/assembly/NOTICE delete mode 100644 branches/sca-android/modules/assembly/pom.xml delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java delete mode 100644 branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java delete mode 100644 branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java (limited to 'branches/sca-android/modules/assembly') diff --git a/branches/sca-android/modules/assembly/DISCLAIMER b/branches/sca-android/modules/assembly/DISCLAIMER deleted file mode 100644 index d68a410903..0000000000 --- a/branches/sca-android/modules/assembly/DISCLAIMER +++ /dev/null @@ -1,8 +0,0 @@ -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. - diff --git a/branches/sca-android/modules/assembly/LICENSE b/branches/sca-android/modules/assembly/LICENSE deleted file mode 100644 index 6e529a25c4..0000000000 --- a/branches/sca-android/modules/assembly/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - diff --git a/branches/sca-android/modules/assembly/NOTICE b/branches/sca-android/modules/assembly/NOTICE deleted file mode 100644 index 1325efd8bf..0000000000 --- a/branches/sca-android/modules/assembly/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/sca-android/modules/assembly/pom.xml b/branches/sca-android/modules/assembly/pom.xml deleted file mode 100644 index b34e5d21a1..0000000000 --- a/branches/sca-android/modules/assembly/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-modules - 2.0-incubating-SNAPSHOT - ../pom.xml - - tuscany-assembly - Apache Tuscany SCA Assembly Model - - - - org.apache.tuscany.sca - tuscany-policy - 2.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface - 2.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-definitions - 2.0-incubating-SNAPSHOT - - - diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java deleted file mode 100644 index a234083bef..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.policy.IntentAttachPoint; - -/** - * Interface contracts define one or more business functions. These business - * functions are provided by services and are used by references. - * - * @version $Rev: 598005 $ $Date: 2007-11-25 08:36:27 -0800 (Sun, 25 Nov 2007) $ - */ -public interface AbstractContract extends Base, Extensible, IntentAttachPoint, OperationsConfigurator { - - /** - * Returns the name of the contract. - * - * @return the name of the contract - */ - String getName(); - - /** - * Sets the name of the contract. - * - * @param name the name of the contract - */ - void setName(String name); - - /** - * Returns the interface contract defining the interface and callback - * interface for the contract. - * - * @return the interface contract - */ - InterfaceContract getInterfaceContract(); - - /** - * Sets the interface contract defining the interface and callback - * interface for the contract. - * - * @param interfaceContract the interface contract - */ - void setInterfaceContract(InterfaceContract interfaceContract); - - /** - * Returns true if this contract is a reference or service created internally - * to handle a callback interface of another contract, false otherwise. - * - * @return true for a callback contract, false otherwise - */ - boolean isCallback(); - - /** - * Sets a flag indicating whether this is a callback contract. - * - * @param isCallback true for a callback contract, false otherwise - */ - void setIsCallback(boolean isCallback); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java deleted file mode 100644 index 514106208d..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.policy.IntentAttachPoint; - -/** - * A property allows for the configuration of an implementation with externally - * set data values. An implementation can have zero or more properties. Each - * property has a data type, which may be either simple or complex. An - * implementation may also define a default value for a property. - */ -public interface AbstractProperty extends Base, Extensible, IntentAttachPoint { - - /** - * Returns the property name. - * - * @return the property name - */ - String getName(); - - /** - * Sets the property name. - * - * @param name the property name - */ - void setName(String name); - - /** - * Returns the default value of the property. - * - * @return the default value of this property - */ - Object getValue(); - - /** - * Sets the default value of the property. - * - * @param defaultValue the default value of this property - */ - void setValue(Object defaultValue); - - /** - * Returns true if the property allows multiple values. - * - * @return true if the property allows multiple values - */ - boolean isMany(); - - /** - * Sets whether or not the property allows multiple values. - * - * @param many true if the property should allow multiple values - */ - void setMany(boolean many); - - /** - * Returns true if a value must be supplied for the property. - * - * @return true is a value must be supplied for the property - */ - boolean isMustSupply(); - - /** - * Sets whether a value must be supplied for the property. - * - * @param mustSupply set to true to require that a value be supplied for - * uses of this property - */ - void setMustSupply(boolean mustSupply); - - /** - * Returns the data type of this property. This is the qualified name of an - * XML schema type. - * - * @return the type of this property - */ - QName getXSDType(); - - /** - * Sets the data type of this property. This is the qualified name of an XML - * schema type. - * - * @param type the type of this property - */ - void setXSDType(QName type); - - /** - * Returns the element defining the data type of this property. This is the - * qualified name of an XML schema element. - * - * @return the element defining the type of this property - */ - QName getXSDElement(); - - /** - * Sets the element defining the data type of this property. This is the - * qualified name of an XML schema element. - * - * @param element the element defining the type of this property - */ - void setXSDElement(QName element); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java deleted file mode 100644 index 9cdb51dad0..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represents a reference contract. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public interface AbstractReference extends AbstractContract { - - /** - * Returns the multiplicity allowed for wires connected to this reference. - * - * @return the multiplicity allowed for wires connected to this reference - */ - Multiplicity getMultiplicity(); - - /** - * Sets the multiplicity allowed for wires connected to this reference. - * - * @param multiplicity the multiplicity allowed for wires connected to this - * reference - */ - void setMultiplicity(Multiplicity multiplicity); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java deleted file mode 100644 index 13e69cef36..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represents a service contract. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public interface AbstractService extends AbstractContract { - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java deleted file mode 100644 index 04f0dd8b47..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * A factory for the assembly model - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public interface AssemblyFactory { - - /** - * Create a new abstract property. - * - * @return a new abstract property - */ - AbstractProperty createAbstractProperty(); - - /** - * Create a new abstract reference. - * - * @return a new abstract reference - */ - AbstractReference createAbstractReference(); - - /** - * Create a new abstract service. - * - * @return a new abstract service - */ - AbstractService createAbstractService(); - - /** - * Create a new callback. - * - * @return - */ - Callback createCallback(); - - /** - * Create a new component. - * - * @return a new component - */ - Component createComponent(); - - /** - * Create a new component property. - * - * @return a new component property - */ - ComponentProperty createComponentProperty(); - - /** - * Create a new component reference. - * - * @return a new component reference - */ - ComponentReference createComponentReference(); - - /** - * Create a new component service. - * - * @return a new component service - */ - ComponentService createComponentService(); - - /** - * Create a new component type - * - * @return a new component type - */ - ComponentType createComponentType(); - - /** - * Create a new composite. - * - * @return a new composite - */ - Composite createComposite(); - - /** - * Create a new composite reference. - * - * @return a new composite reference - */ - CompositeReference createCompositeReference(); - - /** - * Create a new composite service. - * - * @return a new composite service - */ - CompositeService createCompositeService(); - - /** - * Create a new constraining type. - * - * @return a new constraining type - */ - ConstrainingType createConstrainingType(); - - /** - * Create a new property. - * - * @return a new property - */ - Property createProperty(); - - /** - * Create a new reference. - * - * @return a new reference - */ - Reference createReference(); - - /** - * Create a new service. - * - * @return a new service - */ - Service createService(); - - /** - * Create a new wire. - * - * @return a new wire - */ - Wire createWire(); - - /** - * Create a new configured operation. - * - * @return a new ConfiguredOperation - */ - ConfiguredOperation createConfiguredOperation(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java deleted file mode 100644 index dba3e9f1ae..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * Base interface for all assembly model objects. - * - * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $ - */ -public interface Base { - - /** - * Returns true if the model element is unresolved. - * - * @return true if the model element is unresolved. - */ - boolean isUnresolved(); - - /** - * Sets whether the model element is unresolved. - * - * @param unresolved whether the model element is unresolved - */ - void setUnresolved(boolean unresolved); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java deleted file mode 100644 index 028a10c995..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * Represents a binding. - * - * @version $Rev: 639224 $ $Date: 2008-03-20 02:37:04 -0700 (Thu, 20 Mar 2008) $ - */ -public interface Binding extends Base, Cloneable { - - /** - * Returns the binding URI. - * - * @return the binding URI - */ - String getURI(); - - /** - * Sets the binding URI. - * - * @param uri the binding URI - */ - void setURI(String uri); - - /** - * Returns the binding name. - * - * @return the binding name - */ - String getName(); - - /** - * Sets the binding name. - * - * @param name the binding name - */ - void setName(String name); - - /** - * Clone the binding - * - * @return - */ - Object clone() throws CloneNotSupportedException; -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java deleted file mode 100644 index c8a36cc555..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -import org.apache.tuscany.sca.policy.IntentAttachPoint; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * Represents a callback object describing the bindings to use for callbacks. - * - * @version $Rev: 605979 $ $Date: 2007-12-20 09:01:57 -0800 (Thu, 20 Dec 2007) $ - */ -public interface Callback extends Base, Extensible, IntentAttachPoint, PolicySetAttachPoint, OperationsConfigurator { - - /** - * Returns the bindings supported for callbacks. - * - * @return the bindings supported for callbacks - */ - List getBindings(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java deleted file mode 100644 index 132569ded3..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * Represents a component. A component is a configured instance of an - * implementation. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public interface Component extends Base, Extensible, PolicySetAttachPoint, Cloneable { - - /** - * Returns the URI of the component. - * - * @return the URI of the component - */ - String getURI(); - - /** - * Sets the URI of the component. - * - * @param uri the URI of the component - */ - void setURI(String uri); - - /** - * Returns the name of the component. - * - * @return the name of the component - */ - String getName(); - - /** - * Sets the name of the component. - * - * @param name the name of the component - */ - void setName(String name); - - /** - * Returns the component implementation. - * - * @return the component implementation - */ - Implementation getImplementation(); - - /** - * Sets the component implementation - * - * @param implementation the component implementation - */ - void setImplementation(Implementation implementation); - - /** - * Returns a list of references used by the component. - * - * @return a list of references used by the component - */ - List getReferences(); - - /** - * Returns a list of services exposed by the component. - * - * @return a list of services exposed by the component - */ - List getServices(); - - /** - * Returns a list of properties for the component. - * - * @return a list of properties - */ - List getProperties(); - - /** - * Returns a constraining type defining the shape of the component. - * - * @return a constraining type - */ - ConstrainingType getConstrainingType(); - - /** - * Sets a constraining type defining the shape of the component. - * - * @param constrainingType the constraining type - */ - void setConstrainingType(ConstrainingType constrainingType); - - /** - * Return the Boolean value of autowire - * @return null/TRUE/FALSE - */ - Boolean getAutowire(); - - /** - * Sets whether component references should be autowired. - * - * @param autowire whether component references should be autowired - */ - void setAutowire(Boolean autowire); - - - /** - * Returns a clone of the component. - * - * @return a clone of the component - * @throws CloneNotSupportedException - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java deleted file mode 100644 index 998540612b..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import javax.xml.xpath.XPathExpression; - -/** - * Represents a configured property of a component. - * - * @version $Rev: 639224 $ $Date: 2008-03-20 02:37:04 -0700 (Thu, 20 Mar 2008) $ - */ -public interface ComponentProperty extends Property { - - /** - * Returns the property defined by the component implementation. - * - * @return the property defined by the component implementation - */ - Property getProperty(); - - /** - * Sets the property type that defines this property. - * - * @param type the property that defines this property - */ - void setProperty(Property property); - - /** - * Returns an XPath expression referencing a property of the enclosing - * composite. - * - * @return an XPath expression referencing a property of the enclosing - * composite - */ - String getSource(); - - /** - * Sets an XPath expression referencing a property of the enclosing - * composite. - * - * @param source an XPath expression referencing a property of the enclosing - * composite - */ - void setSource(String source); - - /** - * Get the XPath expression for the source attribute - * @return the XPath expression for the source attribute - */ - XPathExpression getSourceXPathExpression(); - - /** - * Set the XPath expression for the source attribute - * @param sourceXPathExpression the XPath expression for the source attribute - */ - void setSourceXPathExpression(XPathExpression sourceXPathExpression); - - /** - * Returns a URI to a file containing the property value. - * - * @return a URI to a file containing the property value - */ - String getFile(); - - /** - * Sets a URI to a file containing the property value. - * - * @param file a URI to a file containing the property value - */ - void setFile(String file); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java deleted file mode 100644 index 5ce75aa7b4..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - - -/** - * An instance of a reference associated with a particular component. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public interface ComponentReference extends Reference { - - /** - * Returns the reference defined by the implementation for this reference. - * - * @return the implementation reference - */ - Reference getReference(); - - /** - * Sets the reference defined by the implementation for this reference. - * - * @param reference the implementation reference - */ - void setReference(Reference reference); - - /** - * Return the Boolean value of autowire - * @return null/TRUE/FALSE - */ - Boolean getAutowire(); - - /** - * Sets whether component references should be autowired. - * - * @param autowire whether component references should be autowired - */ - void setAutowire(Boolean autowire); - - - /** - * Returns the callback service created internally as a target endpoint - * for callbacks to this reference. - * - * @return the callback service - */ - ComponentService getCallbackService(); - - /** - * Sets the callback service created internally as a target endpoint - * for callbacks to this reference. - * - * @param callbackService the callback service - */ - void setCallbackService(ComponentService callbackService); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java deleted file mode 100644 index 74110329f5..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * An addressable instance of a service associated with a particular component. - * - * @version $Rev: 564107 $ $Date: 2007-08-08 23:05:29 -0700 (Wed, 08 Aug 2007) $ - */ -public interface ComponentService extends Service { - - /** - * Returns the service defined by the implementation for this service. - * - * @return - */ - Service getService(); - - /** - * Sets the service defined by the implementation for this service. - * - * @param service - */ - void setService(Service service); - - /** - * Returns the callback reference created internally as a source endpoint - * for callbacks from this service. - * - * @return the callback reference - */ - ComponentReference getCallbackReference(); - - /** - * Sets the callback reference created internally as a source endpoint - * for callbacks from this service. - * - * @param callbackReference the callback reference - */ - void setCallbackReference(ComponentReference callbackReference); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java deleted file mode 100644 index c4ad4fa0cb..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -/** - * Describes an implementation and represents its configurable aspects. - * - * @version $Rev: 567222 $ $Date: 2007-08-17 20:47:14 -0700 (Fri, 17 Aug 2007) $ - */ -public interface ComponentType extends Base { - - /** - * Returns the URI of this component type. - * @return the URI of the component type - */ - String getURI(); - - /** - * Sets the URI of this component type. - * @param uri the URI of the component type - */ - void setURI(String uri); - - /** - * Returns a list of services that are offered. - * - * @return a list of services that are offered - */ - List getServices(); - - /** - * Returns the list of reference types that are used. - * - * @return the list of reference types that are used - */ - List getReferences(); - - /** - * Returns the list of properties that can be set. - * - * @return the list of properties that can be set - */ - List getProperties(); - - /** - * Returns a constraining type defining the shape of the implementation. - * - * @return a constraining type - */ - ConstrainingType getConstrainingType(); - - /** - * Sets a constraining type defining the shape of the implementation. - * - * @param constrainingType the constraining type to set - */ - void setConstrainingType(ConstrainingType constrainingType); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java deleted file mode 100644 index bd8f97910e..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - - -/** - * Represents a composite. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public interface Composite extends Implementation, Extensible, Cloneable, PolicySetAttachPoint { - - /** - * Returns the name of the composite. - * - * @return the name of the composite - */ - QName getName(); - - /** - * Sets the name of the composite. - * - * @param name the name of the composite - */ - void setName(QName name); - - /** - * Returns a list of composites included in this composite. - * - * @return a list of composites included in this composite. - */ - List getIncludes(); - - /** - * Returns a list of components contained in this composite. - * - * @return a list of components contained in this composite - */ - List getComponents(); - - /** - * Returns a list of wires contained in this composite. - * - * @return a list of wires contained in this composite - */ - List getWires(); - - /** - * Returns true if all the components within the composite must run in the - * same process. - * - * @return true if all the components within the composite must run in the - * same process - */ - boolean isLocal(); - - /** - * Sets whether all the components within the composite must run in the same - * process. - * - * @param local whether all the components within the composite must run in - * the same process - */ - void setLocal(boolean local); - - /** - * Return the Boolean value of autowire - * @return null/TRUE/FALSE - */ - Boolean getAutowire(); - - /** - * Sets whether component references should be autowired. - * - * @param autowire whether component references should be autowired - */ - void setAutowire(Boolean autowire); - - - /** - * Returns a clone of the component type. - * - * @return a clone of the component type - * @throws CloneNotSupportedException - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java deleted file mode 100644 index 8b55127870..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -/** - * Represents composite reference. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public interface CompositeReference extends Reference { - - /** - * Returns the promoted composite references. - * - * @return the promoted composite references - */ - List getPromotedReferences(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java deleted file mode 100644 index 2f7b2d0da4..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represents a composite service. - * - * @version $Rev: 566036 $ $Date: 2007-08-14 23:16:47 -0700 (Tue, 14 Aug 2007) $ - */ -public interface CompositeService extends Service { - - /** - * Returns the promoted component. - * - * @return the promoted component. - */ - Component getPromotedComponent(); - - /** - * Sets the promoted component - * - * @param promotedComponent the promoted component. - */ - void setPromotedComponent(Component promotedComponent); - - /** - * Returns the promoted component service . - * - * @return the promoted component service. - */ - ComponentService getPromotedService(); - - /** - * Sets the promoted component service - * - * @param promotedService the promoted component service. - */ - void setPromotedService(ComponentService promotedService); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java deleted file mode 100644 index a412bcee24..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * Represents an Operation. Typically Operation elements are used when there is a - * need to apply certain facets such as intents and policysets only to a specific - * operation provided by a service or reference. - */ -public interface ConfiguredOperation extends Base, PolicySetAttachPoint { - /** - * Returns the name of the operation. - * - * @return the name of the operation - */ - String getName(); - - /** - * Sets the name of the operation. - * - * @param name the name of the operation - */ - void setName(String name); - - /** - * Returns the name of the service or reference to which this operation belongs. - * This method is particularly useful when operation elements are specified under implementation - * elements and it is necessary to identify which of the various services provided by the - * implementation is referred to by the operation element in question - * - * @return the name of the contract to which this operation belongs - */ - String getContractName(); - - /** - * Sets the name of the service or reference to which this operation belongs. - * - * @param the name of the contract to which this operation belongs - */ - void setContractName(String contractName); -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java deleted file mode 100644 index 1bd27d07b3..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.policy.IntentAttachPoint; - -/** - * A constrainingType provides the "shape" for a component and its - * implementation. Any component configuration that points to a constrainingType - * is constrained by this shape. The constrainingType specifies the services, - * references and properties that must be implemented. - * - * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $ - */ -public interface ConstrainingType extends Base, Extensible, IntentAttachPoint { - - /** - * Returns the name of the constrainingType. - * - * @return the name of the constrainingType - */ - QName getName(); - - /** - * Sets the name of the constrainingType. - * - * @param name the name of the constrainingType - */ - void setName(QName name); - - /** - * Returns a list of services that are offered. - * - * @return a list of services that are offered - */ - List getServices(); - - /** - * Returns the list of references that are used. - * - * @return the list of references that are used - */ - List getReferences(); - - /** - * Returns the list of properties that can be set. - * - * @return the list of properties that can be set - */ - List getProperties(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java deleted file mode 100644 index a717715554..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * Represents a contract. A contract can be either a service or a reference. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public interface Contract extends AbstractContract, PolicySetAttachPoint, Cloneable { - - /** - * Returns the bindings supported by this contract. - * - * @return the bindings supported by this contract - */ - List getBindings(); - - /** - * Returns a binding of the specified type or null if there is no such - * binding configured on this contract. - * - * @param the binding type - * @param bindingClass the binding type class - * @return the binding or null if there is no binding of the specified type - */ - B getBinding(Class bindingClass); - - /** - * Returns a callback binding of the specified type or null if there is no such - * callback binding configured on this contract. - * - * @param the callback binding type - * @param bindingClass the callback binding type class - * @return the callback binding or null if there is no callback binding of the specified type - */ - B getCallbackBinding(Class bindingClass); - - /** - * Returns a callback definition of the bindings to use for callbacks. - * - * @return a definition of the bindings to use for callbacks - */ - Callback getCallback(); - - /** - * Sets a callback definition of the bindings to use for callbacks - * - * @param callback a definition of the bindings to use for callbacks - */ - void setCallback(Callback callback); - - /** - * Returns a clone of the contract. - * - * @return a clone of the reference - * @throws CloneNotSupportedException - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java deleted file mode 100644 index 1205c4ce6c..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.assembly.impl.AssemblyFactoryImpl; - -/** - * A factory for the assembly model. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory { - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java deleted file mode 100644 index ce998c0662..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -/** - * Base interface for extensible assembly model objects. - * - * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $ - */ -public interface Extensible { - - /** - * Returns a list of extension objects contained in this model object. - * - * @return a list of extension objects container in this model object - */ - List getExtensions(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java deleted file mode 100644 index ad47c4c5aa..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represents a component implementation. - * - * @version $Rev: 596604 $ $Date: 2007-11-20 02:35:30 -0800 (Tue, 20 Nov 2007) $ - */ -public interface Implementation extends ComponentType { -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java deleted file mode 100644 index a93c3c5ee3..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Enumeration for multiplicity. Defines the number of wires that can connect a - * reference to target services. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public enum Multiplicity { - - /** - * Zero or one wire can have the reference as a source. - */ - ZERO_ONE, - - /** - * The default setting, one wire can have the reference as a source. - */ - ONE_ONE, - - /** - * Zero or more wires can have the reference as a source. - */ - ZERO_N, - - /** - * One or more wires can have the reference as a source. - */ - ONE_N - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java deleted file mode 100644 index 2ca8589b1a..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.ConfiguredOperation; - -/** - * Interface to be implemented by SCA artifacts that support configuration of 'operation' child - * elements for policies etc. - */ - -public interface OperationsConfigurator { - List getConfiguredOperations(); -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java deleted file mode 100644 index 1eb2188568..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represent a reference binding that supports optimized SCA local wiring between component - * references and services - * - * @version $Rev: 575759 $ $Date: 2007-09-14 10:09:31 -0700 (Fri, 14 Sep 2007) $ - * - */ -public interface OptimizableBinding extends Binding, Cloneable { - - /** - * @param component - */ - void setTargetComponent(Component component); - - /** - * @param service - */ - void setTargetComponentService(ComponentService service); - - /** - * @param binding - */ - void setTargetBinding(Binding binding); - - /** - * @return - */ - Binding getTargetBinding(); - - /** - * @return - */ - Component getTargetComponent(); - - /** - * @return - */ - ComponentService getTargetComponentService(); - - /** - * Clone the binding - * @return - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java deleted file mode 100644 index 8828e36970..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * A property allows for the configuration of an implementation with externally - * set data values. An implementation can have zero or more properties. Each - * property has a data type, which may be either simple or complex. An - * implementation may also define a default value for a property. - * - * @version $Rev: 560488 $ $Date: 2007-07-27 21:18:42 -0700 (Fri, 27 Jul 2007) $ - */ -public interface Property extends AbstractProperty, PolicySetAttachPoint, Cloneable { - - /** - * Returns a clone of the property. - * - * @return a clone of the property - * @throws CloneNotSupportedException - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java deleted file mode 100644 index 874164e78a..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import java.util.List; - -/** - * Represents a reference. References within an implementation represent links - * to services that the implementation uses that must be provided by other - * components. - * - * @version $Rev: 560488 $ $Date: 2007-07-27 21:18:42 -0700 (Fri, 27 Jul 2007) $ - */ -public interface Reference extends AbstractReference, Contract { - - /** - * Returns a boolean value, "false" by default, which indicates that the - * implementation wires this reference dynamically. - * - * @return true if the implementation wires this reference dynamically - */ - boolean isWiredByImpl(); - - /** - * Sets a boolean value, "false" by default, which indicates that the - * implementation wires this reference dynamically. - * - * @param wiredByImpl whether the implementation wires this reference - * dynamically - */ - void setWiredByImpl(boolean wiredByImpl); - - /** - * Returns the targets of this reference. - * - * @return the targets of this reference. - */ - List getTargets(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java deleted file mode 100644 index ece8eeb028..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represents an SCA binding. - * - * @version $Rev: 566036 $ $Date: 2007-08-14 23:16:47 -0700 (Tue, 14 Aug 2007) $ - */ -public interface SCABinding extends Binding { -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java deleted file mode 100644 index 881d7df5e4..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * A factory for the SCA binding model - * - * @version $Rev: 538819 $ $Date: 2007-05-16 23:54:50 -0700 (Wed, 16 May 2007) $ - */ -public interface SCABindingFactory { - - /** - * Create a new SCA binding. - * - * @return a new SCA binding - */ - SCABinding createSCABinding(); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java deleted file mode 100644 index c63bee0303..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -/** - * Represents a service. Services are used to publish services provided by - * implementations, so that they are addressable by other components. - * - * @version $Rev: 560488 $ $Date: 2007-07-27 21:18:42 -0700 (Fri, 27 Jul 2007) $ - */ -public interface Service extends AbstractService, Contract { - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java deleted file mode 100644 index bd457b3c34..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.policy.IntentAttachPoint; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * Represents a wire. - * - * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $ - */ -public interface Wire extends Base, Extensible, IntentAttachPoint, PolicySetAttachPoint, Cloneable { - - /** - * Returns the source of the wire. - * - * @return the source of the wire - */ - ComponentReference getSource(); - - /** - * Sets the source of the wire. - * - * @param source the source of the wire - */ - void setSource(ComponentReference source); - - /** - * Returns the target of the wire. - * - * @return the target of the wire - */ - ComponentService getTarget(); - - /** - * Sets the target of the wire. - * - * @param target the target of the wire - */ - void setTarget(ComponentService target); - - /** - * Returns a clone of the wire. - * - * @return a clone of the wire - * @throws CloneNotSupportedException - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java deleted file mode 100644 index e0ac9ada03..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder; - -import org.apache.tuscany.sca.assembly.Component; - -public interface ComponentPreProcessor { - - void preProcess(Component component); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java deleted file mode 100644 index 050a7e5cb5..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder; - -import org.apache.tuscany.sca.assembly.Composite; - -/** - * A builder that handles the configuration of the components inside a - * composite and the wiring of component references to component services. - * - * @version $Rev: 563358 $ $Date: 2007-08-06 17:26:27 -0700 (Mon, 06 Aug 2007) $ - */ -public interface CompositeBuilder { - - /** - * Build, configure and wire a composite. - * - * @param composite - * @throws CompositeBuilderException - */ - void build(Composite composite) throws CompositeBuilderException; - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java deleted file mode 100644 index c2c91f715e..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder; - -/** - * Reports a composite builder exception. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public class CompositeBuilderException extends Exception { - private static final long serialVersionUID = -8916323176803443856L; - - public CompositeBuilderException() { - } - - public CompositeBuilderException(String message) { - super(message); - } - - public CompositeBuilderException(Throwable cause) { - super(cause); - } - - public CompositeBuilderException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java deleted file mode 100644 index 5630d19366..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder; - -/** - * A monitor for the composite builder. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public interface CompositeBuilderMonitor { - - /** - * Reports a build problem. - * - * @param problem - */ - void problem(Problem problem); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java deleted file mode 100644 index 88468938fd..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.Service; - -/** - * A builder that handles the configuration of the components inside a - * composite and the wiring of component references to component services. - * - * @version $Rev: 563358 $ $Date: 2007-08-07 01:26:27 +0100 (Tue, 07 Aug 2007) $ - */ -public interface DomainBuilder { - - /** - * Wire up the references and service in a domain returning a list - * of the composites that have changed - * - * @param domainLevelCompsite - * @return a list of change composites - * @throws CompositeBuilderException - */ - public List wireDomain(Composite domainLevelComposite); - - /** - * Locates the referenced service and updates the URI on the identified binding - * - * @param domainLevelComposite - * @param referenceName - * @param bindingClassName - * @param URI - */ - public void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI); - - /** - * Get the component name out of the reference name that might look like Component/Service - * - * @param referenceName - * @return - */ - public String getComponentNameFromReference(String referenceName); - - /** - * Get the service name out of the reference name that might look like Component/Service - * - * @param referenceName - * @return - */ - public String getServiceNameFromReference(String referenceName); - - /** - * Find the service object given a reference name - * - * @param composite - * @param referenceName - * @return - */ - public Service findServiceForReference(Composite composite, String referenceName); - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java deleted file mode 100644 index 70ec19288a..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder; - - -/** - * Reports a composite assembly problem. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public interface Problem { - - public enum Severity { - INFO, - WARNING, - ERROR - } - - Severity getSeverity(); - - String getMessage(); - - Object getModel(); - - Object getResource(); - - Exception getCause(); -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java deleted file mode 100644 index ec25c8e2a7..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.Contract; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPoint; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyComputationUtils; -import org.apache.tuscany.sca.policy.util.PolicyValidationException; - -/** - * Policy computation methods pertaining to computing Binding policies - */ -public class BindingPolicyComputer extends PolicyComputer { - - public BindingPolicyComputer() { - super(); - } - - public void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException { - for (Binding binding : contract.getBindings()) { - if (binding instanceof PolicySetAttachPoint) { - computeIntents((IntentAttachPoint)binding, contract.getRequiredIntents()); - - aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(), - ((PolicySetAttachPoint)binding).getApplicablePolicySets()); - - computePolicySets((PolicySetAttachPoint)binding, contract.getPolicySets()); - - if ( binding instanceof OperationsConfigurator && - contract instanceof OperationsConfigurator ) { - //add or merge service operations to the binding - addInheritedOpConfOnBindings((OperationsConfigurator)contract, - (OperationsConfigurator)binding, - (PolicySetAttachPoint)binding); - - computeIntentsForOperations((IntentAttachPoint)binding); - computePolicySetsForOperations(contract.getApplicablePolicySets(), - (PolicySetAttachPoint)binding); - } - } - } - - if ( contract.getCallback() != null ) { - for (Binding binding : contract.getCallback().getBindings()) { - if (binding instanceof PolicySetAttachPoint) { - computeIntents((IntentAttachPoint)binding, contract.getCallback().getRequiredIntents()); - - aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(), - ((PolicySetAttachPoint)binding).getApplicablePolicySets()); - - computePolicySets((PolicySetAttachPoint)binding, contract.getCallback().getPolicySets()); - } - } - } - } - - - private void computeIntents(IntentAttachPoint policiedBinding, List inheritedIntents) - throws PolicyValidationException { - //since the parent component could also contain intents that apply to implementation - //and binding elements within, we filter out only those that apply to this binding type - List prunedIntents = computeInheritableIntents(policiedBinding.getType(), - inheritedIntents); - policiedBinding.getRequiredIntents().addAll(prunedIntents); - - normalizeIntents(policiedBinding); - } - - - private void computePolicySets(PolicySetAttachPoint policiedBinding, - List inheritedPolicySets) throws PolicyValidationException { - - List prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets, - policiedBinding.getApplicablePolicySets()); - policiedBinding.getPolicySets().addAll(prunedPolicySets); - normalizePolicySets(policiedBinding); - } - - public void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyComputationException { - List intentsCopy = null; - for (Binding aBinding : source.getBindings()) { - if (aBinding instanceof PolicySetAttachPoint) { - PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding; - IntentAttachPointType bindingType = policiedBinding.getType(); - - - intentsCopy = new ArrayList(policiedBinding.getRequiredIntents()); - // add the target component's intents to the reference binding - if (target != null) { - for (Intent intent : target.getRequiredIntents()) { - if (!policiedBinding.getRequiredIntents().contains(intent)) { - for (QName constrained : intent.getConstrains()) { - if (bindingType != null && bindingType.getName().getNamespaceURI() - .equals(constrained.getNamespaceURI()) - && bindingType.getName().getLocalPart().startsWith(constrained - .getLocalPart())) { - policiedBinding.getRequiredIntents().add(intent); - break; - } - } - } - } - } - - //trim intents specified in operations. First check for policysets specified on the operation - //and then in the parent implementation - if ( aBinding instanceof OperationsConfigurator ) { - OperationsConfigurator opConfigurator = (OperationsConfigurator)aBinding; - - for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) { - List opsIntentsCopy = new ArrayList(confOp.getRequiredIntents()); - - trimInherentlyProvidedIntents(policiedBinding.getType(), - confOp.getRequiredIntents()); - trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets()); - trimProvidedIntents(confOp.getRequiredIntents(), policiedBinding.getPolicySets()); - - determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(), - confOp, - policiedBinding.getType()); - - if (confOp.getRequiredIntents().size() > 0) { - new PolicyComputationException("The following are unfulfilled intents for operations configured in " - + "binding - " + aBinding.getName() + "\nUnfulfilled Intents = " + - confOp.getRequiredIntents()); - } - - //the intents list could have been trimmed when matching for policysets - //since the bindings may need the original set of intents we copy that back - confOp.getRequiredIntents().clear(); - confOp.getRequiredIntents().addAll(opsIntentsCopy); - - } - } - - trimInherentlyProvidedIntents(policiedBinding.getType(), - policiedBinding.getRequiredIntents()); - trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding - .getPolicySets()); - - // determine additional policysets that match remaining intents - // TODO: resolved to domain policy registry and attach suitable - // policy sets to the binding - // for now using the SCA Definitions instead of registry - // if there are intents that are not provided by any policy set - // throw a warning - determineApplicableDomainPolicySets(source, policiedBinding); - - //the intents list could have been trimmed when matching for policysets - //since the bindings may need the original set of intents we copy that back - policiedBinding.getRequiredIntents().clear(); - policiedBinding.getRequiredIntents().addAll(intentsCopy); - - } - } - } - - private void determineApplicableDomainPolicySets(Contract contract, - PolicySetAttachPoint policiedBinding) - throws PolicyComputationException { - //if ( domainPolicySets != null) { - determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(), - policiedBinding, - policiedBinding.getType()); - - if ( policiedBinding.getRequiredIntents().size() > 0 ) { - if ( contract instanceof Service ) { - throw new PolicyComputationException("The following are unfulfilled intents for " + - "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " + - policiedBinding.getRequiredIntents()); - } else { - throw new PolicyComputationException("The are unfulfilled intents for " + - "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " + - policiedBinding.getRequiredIntents()); - } - } - //} - } - - private void addInheritedOpConfOnBindings(OperationsConfigurator source, - OperationsConfigurator target, - PolicySetAttachPoint attachPoint) throws PolicyValidationException { - boolean found = false; - - List additionalOperations = new ArrayList(); - for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) { - for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) { - if ( sourceConfOp.getName().equals(targetConfOp.getName())) { - List prunedIntents = computeInheritableIntents(attachPoint.getType(), - sourceConfOp.getRequiredIntents()); - PolicyComputationUtils.addInheritedIntents(prunedIntents, - targetConfOp.getRequiredIntents()); - - List prunedPolicySets = computeInheritablePolicySets(sourceConfOp.getPolicySets(), - attachPoint.getApplicablePolicySets()); - PolicyComputationUtils.addInheritedPolicySets(prunedPolicySets, targetConfOp.getPolicySets(), true); - found = true; - break; - } - } - - if ( !found ) { - additionalOperations.add(sourceConfOp); - } - } - - if ( !additionalOperations.isEmpty() ) { - target.getConfiguredOperations().addAll(additionalOperations); - } - } - - /*private void addInheritedOpConfOnBindings(Contract contract) { - for ( Binding binding : contract.getBindings() ) { - if ( binding instanceof OperationsConfigurator ) { - addInheritedOperationConfigurations(contract, (OperationsConfigurator)binding); - } - } - }*/ - - private void aggregateAndPruneApplicablePolicySets(List source, List target) { - target.addAll(source); - //strip duplicates - Hashtable policySetTable = new Hashtable(); - for ( PolicySet policySet : target ) { - policySetTable.put(policySet.getName(), policySet); - } - - target.clear(); - target.addAll(policySetTable.values()); - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java deleted file mode 100644 index 791d131871..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.OptimizableBinding; -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * This class encapsulates utility methods to deal with binding definitions - */ -class BindingUtil { - private static boolean hasCompatiblePolicySets(Binding refBinding, Binding svcBinding) { - boolean isCompatible = true;; - if ( refBinding instanceof PolicySetAttachPoint && svcBinding instanceof PolicySetAttachPoint ) { - //TODO : need to add more compatibility checks at the policy attachment levels - for ( PolicySet svcPolicySet : ((PolicySetAttachPoint)svcBinding).getPolicySets() ) { - isCompatible = false; - for ( PolicySet refPolicySet : ((PolicySetAttachPoint)refBinding).getPolicySets() ) { - if ( svcPolicySet.equals(refPolicySet) ) { - isCompatible = true; - break; - } - } - //if there exists no matching policy set in the reference binding - if ( !isCompatible ) { - return isCompatible; - } - } - } - return isCompatible; - } - - - public static Binding matchBinding(Component component, ComponentService service, List source, List target) { - List matched = new ArrayList(); - // Find the corresponding bindings from the service side - for (Binding binding : source) { - for (Binding serviceBinding : target) { - if (binding.getClass() == serviceBinding.getClass() && - hasCompatiblePolicySets(binding, serviceBinding)) { - - try { - Binding cloned = (Binding)binding.clone(); - - //Customise the binding name to make it unique - // regardless of how many bindings or targets there are - if ( component != null){ - cloned.setName(binding.getName() + "#" + component.getName() + "/" + serviceBinding.getName()); - } else { - cloned.setName(binding.getName() + "#" + serviceBinding.getName()); - } - - // Set the binding URI to the URI of the target service - // that has been matched - if (binding.getURI() == null) { - cloned.setURI(serviceBinding.getURI()); - } - - if (binding instanceof OptimizableBinding) { - OptimizableBinding endpoint = ((OptimizableBinding)cloned); - endpoint.setTargetComponent(component); - endpoint.setTargetComponentService(service); - endpoint.setTargetBinding(serviceBinding); - } - - matched.add(cloned); - break; - } catch (Exception ex) { - // do nothing - } - } - } - } - if (matched.isEmpty()) { - // No matching binding - return null; - } else { - for (Binding binding : matched) { - // If binding.sca is present, use it - if (SCABinding.class.isInstance(binding)) { - return binding; - } - } - // Use the first one - return matched.get(0); - } - } - - /** - * Choose a binding for the reference based on the bindings available on the - * service - * - * @param reference The component reference - * @param service The component service - * @return Resolved binding - */ - static Binding resolveBindings(ComponentReference reference, Component component, ComponentService service) { - List source = reference.getBindings(); - List target = service.getBindings(); - - return matchBinding(component, service, source, target); - - } - - - /** - * @param reference - * @param service - * @return - */ - static Binding resolveCallbackBindings(ComponentReference reference, Component component, ComponentService service) { - List source = reference.getCallback().getBindings(); - List target = service.getCallback().getBindings(); - - return matchBinding(component, service, source, target); - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java deleted file mode 100644 index caa212ccdf..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; -import org.apache.tuscany.sca.assembly.builder.Problem; -import org.apache.tuscany.sca.assembly.builder.Problem.Severity; -import org.apache.tuscany.sca.definitions.SCADefinitions; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; - -/** - * A builder that handles the configuration of the components inside a composite - * and the wiring of component references to component services. - * - * @version $Rev: 643489 $ $Date: 2008-04-01 10:06:42 -0800 (Tue, 01 Apr 2008) $ - */ -public class CompositeBuilderImpl implements CompositeBuilder { - private final static Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName()); - private CompositeIncludeBuilderImpl includeBuilder; - private CompositeWireBuilderImpl wireBuilder; - private CompositeCloneBuilderImpl cloneBuilder; - private CompositeConfigurationBuilderImpl configurationBuilder; - - /** - * Constructs a new composite util. - * - * @param assemblyFactory - * @param interfaceContractMapper - */ - public CompositeBuilderImpl(AssemblyFactory assemblyFactory, - SCABindingFactory scaBindingFactory, - IntentAttachPointTypeFactory intentAttachPointTypeFactory, - InterfaceContractMapper interfaceContractMapper, - CompositeBuilderMonitor monitor) { - - if (monitor == null) { - // Create a default monitor that logs using the JDK logger. - monitor = new CompositeBuilderMonitor() { - public void problem(Problem problem) { - if (problem.getSeverity() == Severity.INFO) { - logger.info(problem.toString()); - } else if (problem.getSeverity() == Severity.WARNING) { - logger.warning(problem.toString()); - } else if (problem.getSeverity() == Severity.ERROR) { - if (problem.getCause() != null) { - logger.log(Level.SEVERE, problem.toString(), problem.getCause()); - } else { - logger.severe(problem.toString()); - } - } - } - }; - } - - includeBuilder = new CompositeIncludeBuilderImpl(monitor); - wireBuilder = new CompositeWireBuilderImpl(assemblyFactory, interfaceContractMapper, monitor); - cloneBuilder = new CompositeCloneBuilderImpl(monitor); - configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, monitor); - - } - - public CompositeBuilderImpl(AssemblyFactory assemblyFactory, - SCABindingFactory scaBindingFactory, - IntentAttachPointTypeFactory intentAttachPointTypeFactory, - InterfaceContractMapper interfaceContractMapper, - CompositeBuilderMonitor monitor, - SCADefinitions scaDefns) { - this(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, monitor); - configurationBuilder.setScaDefinitions(scaDefns); - } - - public void build(Composite composite) throws CompositeBuilderException { - - // Collect and fuse includes - includeBuilder.fuseIncludes(composite); - - // Expand nested composites - cloneBuilder.expandCompositeImplementations(composite); - - // Configure all components - configurationBuilder.configureComponents(composite); - - // Wire the composite - wireBuilder.wireComposite(composite); - - // Activate composite services - configurationBuilder.activateCompositeServices(composite); - - // Wire composite references - wireBuilder.wireCompositeReferences(composite); - - // Fuse nested composites - //cloneBuilder.fuseCompositeImplementations(composite); - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java deleted file mode 100644 index 142bed9d63..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; - -public class CompositeCloneBuilderImpl { - - public CompositeCloneBuilderImpl(CompositeBuilderMonitor monitor) { - } - - /** - * Expand composite component implementations. - * - * @param composite - * @param problems - */ - public void expandCompositeImplementations(Composite composite) { - for (Component component : composite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - - Composite compositeImplementation = (Composite)implementation; - Composite clone; - try { - clone = (Composite)compositeImplementation.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); - } - component.setImplementation(clone); - expandCompositeImplementations(clone); - } - } - } - - /** - * Collect all nested composite implementations in a graph of composites. - * - * @param composite - * @param nested - */ - private void collectNestedComposites(Composite composite, List nested) { - for (Component component : composite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - Composite nestedComposite = (Composite)implementation; - nested.add(nestedComposite); - collectNestedComposites(nestedComposite, nested); - } - } - } - - /** - * Fuse nested composites into a top level composite. - * - * @param composite - */ - public void fuseCompositeImplementations(Composite composite) { - - // First collect all nested composites - List nested = new ArrayList(); - collectNestedComposites(composite, nested); - - // Then add all the non-composite components they contain - for (Composite nestedComposite : nested) { - for (Component component: nestedComposite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (!(implementation instanceof Composite)) { - composite.getComponents().add(component); - } - } - } - - // Clear the initial list of composite components - for (Iterator i = composite.getComponents().iterator(); i.hasNext();) { - Component component = i.next(); - if (component.getImplementation() instanceof Composite) { - i.remove(); - } - } - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java deleted file mode 100644 index 9040b8bd99..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java +++ /dev/null @@ -1,1417 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; -import org.apache.tuscany.sca.assembly.builder.Problem.Severity; -import org.apache.tuscany.sca.definitions.SCADefinitions; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.policy.IntentAttachPoint; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -public class CompositeConfigurationBuilderImpl { - private final static String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0"; - private final static String BINDING_SCA = "binding.sca"; - private final static QName BINDING_SCA_QNAME = new QName(SCA10_NS, BINDING_SCA); - - private AssemblyFactory assemblyFactory; - private SCABindingFactory scaBindingFactory; - private CompositeBuilderMonitor monitor; - private InterfaceContractMapper interfaceContractMapper; - private IntentAttachPointTypeFactory intentAttachPointTypeFactory; - private SCADefinitions scaDefinitions = null; - - public CompositeConfigurationBuilderImpl(AssemblyFactory assemblyFactory, - SCABindingFactory scaBindingFactory, - IntentAttachPointTypeFactory intentAttachPointTypeFactory, - InterfaceContractMapper interfaceContractMapper, - CompositeBuilderMonitor monitor) { - this.assemblyFactory = assemblyFactory; - this.scaBindingFactory = scaBindingFactory; - this.intentAttachPointTypeFactory = intentAttachPointTypeFactory; - this.interfaceContractMapper = interfaceContractMapper; - this.monitor = monitor; - } - - /** - * Configure components in the composite. - * - * @param composite - * @param problems - */ - public void configureComponents(Composite composite) throws CompositeBuilderException { - configureComponents(composite, null); - configureSourcedProperties(composite, null); - configureBindingURIs(composite, null, null); - } - - /** - * Configure components in the composite. - * - * @param composite - * @param uri - * @param problems - */ - private void configureComponents(Composite composite, String uri) { - String parentURI = uri; - - // Process nested composites recursively - for (Component component : composite.getComponents()) { - - // Initialize component URI - String componentURI; - if (parentURI == null) { - componentURI = component.getName(); - } else { - componentURI = URI.create(parentURI + '/').resolve(component.getName()).toString(); - } - component.setURI(componentURI); - - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - - // Process nested composite - configureComponents((Composite)implementation, componentURI); - } - } - - // Initialize service bindings - List compositeServices = composite.getServices(); - for (Service service : compositeServices) { - // Set default binding names - - // Create default SCA binding - if (service.getBindings().isEmpty()) { - SCABinding scaBinding = createSCABinding(); - service.getBindings().add(scaBinding); - } - - // Initialize binding names and URIs - for (Binding binding : service.getBindings()) { - - // Binding name defaults to the service name - if (binding.getName() == null) { - binding.setName(service.getName()); - } - } - - if (service.getCallback() != null) { - for (Binding binding : service.getCallback().getBindings()) { - if (binding.getName() == null) { - binding.setName(service.getName()); - } - } - } - } - - // Initialize reference bindings - for (Reference reference : composite.getReferences()) { - // Create default SCA binding - if (reference.getBindings().isEmpty()) { - SCABinding scaBinding = createSCABinding(); - reference.getBindings().add(scaBinding); - } - - // Set binding names - for (Binding binding : reference.getBindings()) { - if (binding.getName() == null) { - binding.setName(reference.getName()); - } - } - - if (reference.getCallback() != null) { - for (Binding binding : reference.getCallback().getBindings()) { - if (binding.getName() == null) { - binding.setName(reference.getName()); - } - } - } - } - - // Initialize all component services and references - Map components = new HashMap(); - for (Component component : composite.getComponents()) { - - // Index all components and check for duplicates - if (components.containsKey(component.getName())) { - warning("Duplicate component name: " + composite.getName() - + " : " - + component.getName(), composite); - } else { - components.put(component.getName(), component); - } - - // Propagate the autowire flag from the composite to components - if (component.getAutowire() == null) { - component.setAutowire(composite.getAutowire()); - } - - if (component.getImplementation() instanceof ComponentPreProcessor) { - ((ComponentPreProcessor)component.getImplementation()).preProcess(component); - } - - // Index properties, services and references - Map services = new HashMap(); - Map references = new HashMap(); - Map properties = new HashMap(); - indexImplementationPropertiesServicesAndReferences(component, - services, - references, - properties); - - // Index component services, references and properties - // Also check for duplicates - Map componentServices = - new HashMap(); - Map componentReferences = - new HashMap(); - Map componentProperties = - new HashMap(); - indexComponentPropertiesServicesAndReferences(component, - componentServices, - componentReferences, - componentProperties); - - // Reconcile component services/references/properties and - // implementation services/references and create component - // services/references/properties for the services/references - // declared by the implementation - reconcileServices(component, services, componentServices); - reconcileReferences(component, references, componentReferences); - reconcileProperties(component, properties, componentProperties); - - // Configure or create callback services for component's references - // with callbacks - configureCallbackServices(component, componentServices); - - // Configure or create callback references for component's services - // with callbacks - configureCallbackReferences(component, componentReferences); - - // Create self references to the component's services -// if (!(component.getImplementation() instanceof Composite)) { -// createSelfReferences(component); -// } - - // Initialize service bindings - for (ComponentService componentService : component.getServices()) { - - // Create default SCA binding - if (componentService.getBindings().isEmpty()) { - SCABinding scaBinding = createSCABinding(); - componentService.getBindings().add(scaBinding); - } - - // Set binding names - for (Binding binding : componentService.getBindings()) { - - // Binding name defaults to the service name - if (binding.getName() == null) { - binding.setName(componentService.getName()); - } - } - if (componentService.getCallback() != null) { - for (Binding binding : componentService.getCallback().getBindings()) { - if (binding.getName() == null) { - binding.setName(componentService.getName()); - } - } - } - } - - // Initialize reference bindings - for (ComponentReference componentReference : component.getReferences()) { - - // Create default SCA binding - if (componentReference.getBindings().isEmpty()) { - SCABinding scaBinding = createSCABinding(); - componentReference.getBindings().add(scaBinding); - } - - // Set binding names - for (Binding binding : componentReference.getBindings()) { - if (binding.getName() == null) { - binding.setName(componentReference.getName()); - } - } - if (componentReference.getCallback() != null) { - for (Binding binding : componentReference.getCallback().getBindings()) { - if (binding.getName() == null) { - binding.setName(componentReference.getName()); - } - } - } - } - } - } - - /** - * Report a warning. - * - * @param problems - * @param message - * @param model - */ - private void warning(String message, Object model) { - monitor.problem(new ProblemImpl(Severity.WARNING, message, model)); - } - - /** - * Reconcile component properties and the properties defined by the - * component type. - * - * @param component - * @param properties - * @param componentProperties - * @param problems - */ - private void reconcileProperties(Component component, - Map properties, - Map componentProperties) { - - // Connect component properties to their properties - for (ComponentProperty componentProperty : component.getProperties()) { - Property property = properties.get(componentProperty.getName()); - if (property != null) { - componentProperty.setProperty(property); - } else { - warning("Property not found for component property: " + component.getName() - + "/" - + componentProperty.getName(), component); - } - } - - // Create component properties for all properties - if (component.getImplementation() != null) { - for (Property property : component.getImplementation().getProperties()) { - if (!componentProperties.containsKey(property.getName())) { - ComponentProperty componentProperty = assemblyFactory.createComponentProperty(); - componentProperty.setName(property.getName()); - componentProperty.setMany(property.isMany()); - componentProperty.setXSDElement(property.getXSDElement()); - componentProperty.setXSDType(property.getXSDType()); - componentProperty.setProperty(property); - component.getProperties().add(componentProperty); - } - } - } - - // Reconcile component properties and their properties - for (ComponentProperty componentProperty : component.getProperties()) { - Property property = componentProperty.getProperty(); - if (property != null) { - - // Check that a component property does not override the - // mustSupply attribute - if (!property.isMustSupply() && componentProperty.isMustSupply()) { - warning("Component property mustSupply attribute incompatible with property: " + component - .getName() - + "/" - + componentProperty.getName(), - component); - } - - // Default to the mustSupply attribute specified on the property - if (!componentProperty.isMustSupply()) - componentProperty.setMustSupply(property.isMustSupply()); - - // Default to the value specified on the property - if (componentProperty.getValue() == null) { - componentProperty.setValue(property.getValue()); - } - - // Override the property value for the composite - if(component.getImplementation() instanceof Composite) { - property.setValue(componentProperty.getValue()); - } - - // Check that a value is supplied - if (componentProperty.getValue() == null && property.isMustSupply()) { - warning("No value configured on a mustSupply property: " + component.getName() - + "/" - + componentProperty.getName(), component); - } - - // Check that a a component property does not override the - // many attribute - if (!property.isMany() && componentProperty.isMany()) { - warning("Component property many attribute incompatible with property: " + component - .getName() - + "/" - + componentProperty.getName(), - component); - } - - // Default to the many attribute defined on the property - componentProperty.setMany(property.isMany()); - - // Default to the type and element defined on the property - if (componentProperty.getXSDType() == null) { - componentProperty.setXSDType(property.getXSDType()); - } - if (componentProperty.getXSDElement() == null) { - componentProperty.setXSDElement(property.getXSDElement()); - } - - // Check that a type or element are specified - if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) { - warning("No type specified on component property: " + component.getName() - + "/" - + componentProperty.getName(), component); - } - } - } - } - - /** - * Reconcile component references with the references defined on the - * component type. - * - * @param component - * @param references - * @param componentReferences - * @param problems - */ - private void reconcileReferences(Component component, - Map references, - Map componentReferences) { - - // Connect each component reference to the corresponding reference - for (ComponentReference componentReference : component.getReferences()) { - if (componentReference.getReference() != null || componentReference.isCallback()) { - continue; - } - Reference reference = references.get(componentReference.getName()); - if (reference != null) { - componentReference.setReference(reference); - } else { - if (!componentReference.getName().startsWith("$self$.")) { - warning("Reference not found for component reference: " + component.getName() - + "/" - + componentReference.getName(), component); - } - } - } - - // Create a component reference for each reference - if (component.getImplementation() != null) { - for (Reference reference : component.getImplementation().getReferences()) { - if (!componentReferences.containsKey(reference.getName())) { - ComponentReference componentReference = - assemblyFactory.createComponentReference(); - componentReference.setIsCallback(reference.isCallback()); - componentReference.setName(reference.getName()); - componentReference.setReference(reference); - component.getReferences().add(componentReference); - } - } - } - - // Reconcile each component reference with its reference - for (ComponentReference componentReference : component.getReferences()) { - Reference reference = componentReference.getReference(); - if (reference != null) { - // Reconcile multiplicity - if (componentReference.getMultiplicity() != null) { - if (!ReferenceUtil.isValidMultiplicityOverride(reference.getMultiplicity(), - componentReference - .getMultiplicity())) { - warning("Component reference multiplicity incompatible with reference multiplicity: " + component - .getName() - + "/" - + componentReference.getName(), - component); - } - } else { - componentReference.setMultiplicity(reference.getMultiplicity()); - } - - // Reconcile interface - if (componentReference.getInterfaceContract() != null) { - if (!componentReference.getInterfaceContract().equals(reference - .getInterfaceContract())) { - if (!interfaceContractMapper.isCompatible(reference.getInterfaceContract(), - componentReference - .getInterfaceContract())) { - warning("Component reference interface incompatible with reference interface: " + component - .getName() - + "/" - + componentReference.getName(), - component); - } - } - } else { - componentReference.setInterfaceContract(reference.getInterfaceContract()); - } - - // Reconcile bindings - if (componentReference.getBindings().isEmpty()) { - componentReference.getBindings().addAll(reference.getBindings()); - } - - // Reconcile callback bindings - if (componentReference.getCallback() == null) { - componentReference.setCallback(reference.getCallback()); - if (componentReference.getCallback() == null) { - // Create an empty callback to avoid null check - componentReference.setCallback(assemblyFactory.createCallback()); - } - - } else if (componentReference.getCallback().getBindings().isEmpty() && reference - .getCallback() != null) { - componentReference.getCallback().getBindings().addAll(reference.getCallback() - .getBindings()); - } - - // Propagate autowire setting from the component - if (componentReference.getAutowire() == null) { - componentReference.setAutowire(component.getAutowire()); - } - - // Reconcile targets - if (componentReference.getTargets().isEmpty()) { - componentReference.getTargets().addAll(reference.getTargets()); - } - } - } - } - - /** - * Reconcile component services and services defined on the component type. - * - * @param component - * @param services - * @param componentServices - * @param problems - */ - private void reconcileServices(Component component, - Map services, - Map componentServices) { - - // Connect each component service to the corresponding service - for (ComponentService componentService : component.getServices()) { - if (componentService.getService() != null || componentService.isCallback()) { - continue; - } - Service service = services.get(componentService.getName()); - if (service != null) { - componentService.setService(service); - } else { - warning("Service not found for component service: " + component.getName() - + "/" - + componentService.getName(), component); - } - } - - // Create a component service for each service - if (component.getImplementation() != null) { - for (Service service : component.getImplementation().getServices()) { - if (!componentServices.containsKey(service.getName())) { - ComponentService componentService = assemblyFactory.createComponentService(); - componentService.setIsCallback(service.isCallback()); - String name = service.getName(); - componentService.setName(name); - componentService.setService(service); - component.getServices().add(componentService); - componentServices.put(name, componentService); - } - } - } - - //Reconcile each component service with its service - for (ComponentService componentService : component.getServices()) { - Service service = componentService.getService(); - if (service != null) { - // Reconcile interface - if (componentService.getInterfaceContract() != null) { - if (!componentService.getInterfaceContract().equals(service - .getInterfaceContract())) { - if (!interfaceContractMapper.isCompatible(componentService - .getInterfaceContract(), service.getInterfaceContract())) { - warning("Component service interface incompatible with service interface: " + component - .getName() - + "/" - + componentService.getName(), - component); - } - } - } else { - componentService.setInterfaceContract(service.getInterfaceContract()); - } - - // Reconcile bindings - if (componentService.getBindings().isEmpty()) { - componentService.getBindings().addAll(service.getBindings()); - } - - // Reconcile callback bindings - if (componentService.getCallback() == null) { - componentService.setCallback(service.getCallback()); - if (componentService.getCallback() == null) { - // Create an empty callback to avoid null check - componentService.setCallback(assemblyFactory.createCallback()); - } - } else if (componentService.getCallback().getBindings().isEmpty() && service - .getCallback() != null) { - componentService.getCallback().getBindings().addAll(service.getCallback() - .getBindings()); - } - } - } - } - - private void indexComponentPropertiesServicesAndReferences(Component component, - Map componentServices, - Map componentReferences, - Map componentProperties) { - for (ComponentService componentService : component.getServices()) { - if (componentServices.containsKey(componentService.getName())) { - warning("Duplicate component service name: " + component.getName() - + "/" - + componentService.getName(), component); - } else { - componentServices.put(componentService.getName(), componentService); - } - } - for (ComponentReference componentReference : component.getReferences()) { - if (componentReferences.containsKey(componentReference.getName())) { - warning("Duplicate component reference name: " + component.getName() - + "/" - + componentReference.getName(), component); - } else { - componentReferences.put(componentReference.getName(), componentReference); - } - } - for (ComponentProperty componentProperty : component.getProperties()) { - if (componentProperties.containsKey(componentProperty.getName())) { - warning("Duplicate component property name: " + component.getName() - + "/" - + componentProperty.getName(), component); - } else { - componentProperties.put(componentProperty.getName(), componentProperty); - } - } - - } - - private void indexImplementationPropertiesServicesAndReferences(Component component, - Map services, - Map references, - Map properties) { - // First check that the component has a resolved implementation - Implementation implementation = component.getImplementation(); - if (implementation == null) { - - // A component must have an implementation - warning("No implementation for component: " + component.getName(), component); - - } else if (implementation.isUnresolved()) { - - // The implementation must be fully resolved - warning("Component implementation not found: " + component.getName() - + " : " - + implementation.getURI(), component); - - } else { - - // Index properties, services and references, also check for - // duplicates - for (Property property : implementation.getProperties()) { - if (properties.containsKey(property.getName())) { - warning("Duplicate property name: " + component.getName() - + "/" - + property.getName(), component); - } else { - properties.put(property.getName(), property); - } - } - for (Service service : implementation.getServices()) { - if (services.containsKey(service.getName())) { - warning("Duplicate service name: " + component.getName() - + "/" - + service.getName(), component); - } else { - services.put(service.getName(), service); - } - } - for (Reference reference : implementation.getReferences()) { - if (references.containsKey(reference.getName())) { - warning("Duplicate reference name: " + component.getName() - + "/" - + reference.getName(), component); - } else { - references.put(reference.getName(), reference); - } - } - } - - } - - /** - * For all the references with callbacks, create a corresponding callback - * service. - * - * @param component - */ - private void configureCallbackServices(Component component, - Map componentServices) { - for (ComponentReference reference : component.getReferences()) { - if (reference.getInterfaceContract() != null && // can be null in - // unit tests - reference.getInterfaceContract().getCallbackInterface() != null) { - ComponentService service = - componentServices.get(reference.getName()); - if (service == null) { - service = createCallbackService(component, reference); - } - if (reference.getCallback() != null) { - if (service.getBindings().isEmpty()) { - service.getBindings().addAll(reference.getCallback().getBindings()); - } - } - reference.setCallbackService(service); - } - } - } - - /** - * Create a callback service for a component reference - * - * @param component - * @param reference - */ - private ComponentService createCallbackService(Component component, ComponentReference reference) { - ComponentService componentService = assemblyFactory.createComponentService(); - componentService.setIsCallback(true); - componentService.setName(reference.getName()); - try { - InterfaceContract contract = - (InterfaceContract)reference.getInterfaceContract().clone(); - contract.setInterface(contract.getCallbackInterface()); - contract.setCallbackInterface(null); - componentService.setInterfaceContract(contract); - } catch (CloneNotSupportedException e) { - // will not happen - } - Reference implReference = reference.getReference(); - if (implReference != null) { - Service implService = assemblyFactory.createService(); - implService.setName(implReference.getName()); - try { - InterfaceContract implContract = - (InterfaceContract)implReference.getInterfaceContract().clone(); - implContract.setInterface(implContract.getCallbackInterface()); - implContract.setCallbackInterface(null); - implService.setInterfaceContract(implContract); - } catch (CloneNotSupportedException e) { - // will not happen - } - componentService.setService(implService); - } - component.getServices().add(componentService); - return componentService; - } - - /** - * For all the services with callbacks, create a corresponding callback - * reference. - * - * @param component - */ - private void configureCallbackReferences(Component component, - Map componentReferences) { - for (ComponentService service : component.getServices()) { - if (service.getInterfaceContract() != null && // can be null in - // unit tests - service.getInterfaceContract().getCallbackInterface() != null) { - ComponentReference reference = - componentReferences.get(service.getName()); - if (reference == null) { - reference = createCallbackReference(component, service); - } - if (service.getCallback() != null) { - if (reference.getBindings().isEmpty()) { - reference.getBindings().addAll(service.getCallback().getBindings()); - } - } - service.setCallbackReference(reference); - } - } - } - - /** - * Create a callback reference for a component service - * - * @param component - * @param service - */ - private ComponentReference createCallbackReference(Component component, ComponentService service) { - ComponentReference componentReference = assemblyFactory.createComponentReference(); - componentReference.setIsCallback(true); - componentReference.setName(service.getName()); - try { - InterfaceContract contract = (InterfaceContract)service.getInterfaceContract().clone(); - contract.setInterface(contract.getCallbackInterface()); - contract.setCallbackInterface(null); - componentReference.setInterfaceContract(contract); - } catch (CloneNotSupportedException e) { - // will not happen - } - Service implService = service.getService(); - if (implService != null) { - Reference implReference = assemblyFactory.createReference(); - implReference.setName(implService.getName()); - try { - InterfaceContract implContract = - (InterfaceContract)implService.getInterfaceContract().clone(); - implContract.setInterface(implContract.getCallbackInterface()); - implContract.setCallbackInterface(null); - implReference.setInterfaceContract(implContract); - } catch (CloneNotSupportedException e) { - // will not happen - } - componentReference.setReference(implReference); - } - component.getReferences().add(componentReference); - return componentReference; - } - - /** - * Activate composite services in nested composites. - * - * @param composite - * @param problems - */ - public void activateCompositeServices(Composite composite) { - - // Process nested composites recursively - activateNestedCompositeServices(composite); - - // Process top level composite services - for (Service service : composite.getServices()) { - CompositeService compositeService = (CompositeService)service; - - // Get the inner most promoted service - ComponentService promotedService = getPromotedComponentService(compositeService); - if (promotedService != null) { - Component promotedComponent = getPromotedComponent(compositeService); - - // Default to use the interface from the promoted service - if (compositeService.getInterfaceContract() == null && promotedService.getInterfaceContract() != null) { - compositeService.setInterfaceContract(promotedService.getInterfaceContract()); - } - - // Create a new component service to represent this composite - // service on the promoted component - ComponentService newComponentService = assemblyFactory.createComponentService(); - newComponentService.setName("$promoted$." + compositeService.getName()); - promotedComponent.getServices().add(newComponentService); - newComponentService.setService(promotedService.getService()); - newComponentService.getBindings().addAll(compositeService.getBindings()); - newComponentService.setInterfaceContract(compositeService.getInterfaceContract()); - if (compositeService.getInterfaceContract() != null && compositeService - .getInterfaceContract().getCallbackInterface() != null) { - newComponentService.setCallback(assemblyFactory.createCallback()); - if (compositeService.getCallback() != null) { - newComponentService.getCallback().getBindings().addAll(compositeService - .getCallback().getBindings()); - } - } - - // Change the composite service to now promote the newly - // created component service directly - compositeService.setPromotedComponent(promotedComponent); - compositeService.setPromotedService(newComponentService); - } - } - } - - /** - * Activate composite services in nested composites. - * - * @param composite - * @param problems - */ - public void activateNestedCompositeServices(Composite composite) { - - // Process nested composites recursively - for (Component component : composite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - - // First process nested composites - activateNestedCompositeServices((Composite)implementation); - - // Process the component services declared on components - // in this composite - for (ComponentService componentService : component.getServices()) { - Service implService = componentService.getService(); - if (implService != null && implService instanceof CompositeService) { - CompositeService compositeService = (CompositeService)implService; - - // Get the inner most promoted service - ComponentService promotedService = - getPromotedComponentService(compositeService); - if (promotedService != null) { - Component promotedComponent = getPromotedComponent(compositeService); - - // Default to use the interface from the promoted - // service - if (compositeService.getInterfaceContract() == null) { - compositeService.setInterfaceContract(promotedService - .getInterfaceContract()); - } - if (componentService.getInterfaceContract() == null) { - componentService.setInterfaceContract(promotedService - .getInterfaceContract()); - } - - // Create a new component service to represent this - // composite service on the promoted component - ComponentService newComponentService = - assemblyFactory.createComponentService(); - newComponentService.setName("$promoted$." + compositeService.getName()); - promotedComponent.getServices().add(newComponentService); - newComponentService.setService(promotedService.getService()); - newComponentService.getBindings() - .addAll(compositeService.getBindings()); - newComponentService.setInterfaceContract(compositeService - .getInterfaceContract()); - if (compositeService.getInterfaceContract() != null && compositeService - .getInterfaceContract().getCallbackInterface() != null) { - newComponentService.setCallback(assemblyFactory.createCallback()); - if (compositeService.getCallback() != null) { - newComponentService.getCallback().getBindings() - .addAll(compositeService.getCallback().getBindings()); - } - } - - // Change the composite service to now promote the - // newly created component service directly - compositeService.setPromotedComponent(promotedComponent); - compositeService.setPromotedService(newComponentService); - } - } - } - } - } - } - - /** - * @param composite - */ - private void configureSourcedProperties(Composite composite, List propertySettings) { - // Resolve properties - Map compositeProperties = new HashMap(); - ComponentProperty componentProperty = null; - for (Property p : composite.getProperties()) { - componentProperty = getComponentPropertyByName(p.getName(), propertySettings); - if (componentProperty != null) { - compositeProperties.put(p.getName(), componentProperty); - } else { - compositeProperties.put(p.getName(), p); - } - } - - for (Component component : composite.getComponents()) { - try { - PropertyUtil.sourceComponentProperties(compositeProperties, component); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - Implementation impl = component.getImplementation(); - if (impl instanceof Composite) { - configureSourcedProperties((Composite)impl, component.getProperties()); - } - } - } - - /** - * Follow a service promotion chain down to the inner most (non composite) - * component service. - * - * @param topCompositeService - * @return - */ - static ComponentService getPromotedComponentService(CompositeService compositeService) { - ComponentService componentService = compositeService.getPromotedService(); - if (componentService != null) { - Service service = componentService.getService(); - if (componentService.getName() != null && service instanceof CompositeService) { - - // Continue to follow the service promotion chain - return getPromotedComponentService((CompositeService)service); - - } else { - - // Found a non-composite service - return componentService; - } - } else { - - // No promoted service - return null; - } - } - - /** - * Follow a service promotion chain down to the inner most (non composite) - * component. - * - * @param compositeService - * @return - */ - private static Component getPromotedComponent(CompositeService compositeService) { - ComponentService componentService = compositeService.getPromotedService(); - if (componentService != null) { - Service service = componentService.getService(); - if (componentService.getName() != null && service instanceof CompositeService) { - - // Continue to follow the service promotion chain - return getPromotedComponent((CompositeService)service); - - } else { - - // Found a non-composite service - return compositeService.getPromotedComponent(); - } - } else { - - // No promoted service - return null; - } - } - - private ComponentProperty getComponentPropertyByName(String propertyName, List properties) { - if (properties != null) { - for (ComponentProperty aProperty : properties) { - if (aProperty.getName().equals(propertyName)) { - return aProperty; - } - } - } - return null; - } - - private SCABinding createSCABinding() { - SCABinding scaBinding = scaBindingFactory.createSCABinding(); - - if ( scaDefinitions != null ) { - for ( IntentAttachPointType attachPointType : scaDefinitions.getBindingTypes() ) { - if ( attachPointType.getName().equals(BINDING_SCA_QNAME)) { - ((IntentAttachPoint)scaBinding).setType(attachPointType); - } - } - } - - return scaBinding; - } - - /** - * Fully resolve the binding URIs based on available information. This includes information - * from the ".composite" files, from resources associated with the binding, e.g. WSDL files, - * from any associated policies and from the default information for each binding type. - * - * TODO: Share the URL calculation algorithm with the configureComponents() method above - * although keeping the configureComponents() methods signature as is because when - * a composite is actually build in a node the node default information is currently - * available - * - * @param composite the composite to be configured - * @param uri the path to the composite provided through any nested composite component implementations - * @param defaultBindings list of default binding configurations - */ - public void configureBindingURIs(Composite composite, String uri, List defaultBindings) throws CompositeBuilderException { - - String parentComponentURI = uri; - - // Process nested composites recursively - for (Component component : composite.getComponents()) { - - // Initialize component URI - String componentURI; - if (parentComponentURI == null) { - componentURI = component.getName(); - } else { - componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString(); - } - component.setURI(componentURI); - - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - - // Process nested composite - configureBindingURIs((Composite)implementation, componentURI, defaultBindings); - } - } - - // Initialize composite service binding URIs - List compositeServices = composite.getServices(); - for (Service service : compositeServices) { - // Set default binding names - - // Create default SCA binding - if (service.getBindings().isEmpty()) { - SCABinding scaBinding = createSCABinding(); - service.getBindings().add(scaBinding); - } - - // Initialize binding names and URIs - for (Binding binding : service.getBindings()) { - constructBindingName(service, binding); - constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings); - } - } - - // Initialize component service binding URIs - for (Component component : composite.getComponents()) { - - // Index properties, services and references - Map services = new HashMap(); - Map references = new HashMap(); - Map properties = new HashMap(); - indexImplementationPropertiesServicesAndReferences(component, - services, - references, - properties); - - // Index component services, references and properties - // Also check for duplicates - Map componentServices = - new HashMap(); - Map componentReferences = - new HashMap(); - Map componentProperties = - new HashMap(); - indexComponentPropertiesServicesAndReferences(component, - componentServices, - componentReferences, - componentProperties); - - // Reconcile component services/references/properties and - // implementation services/references and create component - // services/references/properties for the services/references - // declared by the implementation - reconcileServices(component, services, componentServices); - reconcileReferences(component, references, componentReferences); - reconcileProperties(component, properties, componentProperties); - - for (ComponentService service : component.getServices()) { - - // Create default SCA binding - if (service.getBindings().isEmpty()) { - SCABinding scaBinding = createSCABinding(); - service.getBindings().add(scaBinding); - } - - // Initialize binding names and URIs - for (Binding binding : service.getBindings()) { - - constructBindingName(service, binding); - constructBindingURI(component, service, binding, defaultBindings); - } - } - } - } - - /** - * If a binding name is not provided by the user construct it based on the service name - * - * @param service - * @param binding - */ - private void constructBindingName(Service service, Binding binding) throws CompositeBuilderException{ - - // set the default binding name if one is required - // if there is no name on the binding then set it to the service name - if (binding.getName() == null){ - binding.setName(service.getName()); - } - - // Check that multiple bindings do not have the same name - for (Binding otherBinding : service.getBindings()) { - if (otherBinding == binding) { - // Skip the current binding - continue; - } - if (binding.getClass() != otherBinding.getClass()) { - // Look for a binding of the same type - continue; - } - if (binding.getName().equals(otherBinding.getName())) { - warning("Multiple bindings for service " + - service.getName() + - " have the same binding type and name " + - binding.getName() + - ". Tuscany SCA can't create unique URIs to differentiate these bindings ", binding); - } - } - } - - /** - * URI construction for composite bindings based on Assembly Specification section 1.7.2, This method - * assumes that the component URI part of the binding URI is formed from the part to the - * composite in question and just calls the generic constructBindingURI method with this - * information - * - * @param parentComponentURI - * @param composite - * @param service - * @param binding - * @param defaultBindings - */ - private void constructBindingURI(String parentComponentURI, Composite composite, Service service, Binding binding, List defaultBindings) - throws CompositeBuilderException{ - // This is a composite service so there is no component to provide a component URI - // The path to this composite (through nested composites) is used. - boolean includeBindingName = composite.getServices().size() != 1; - constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings); - } - - /** - * URI construction for component bindings based on Assembly Specification section 1.7.2. This method - * calculates the component URI part based on component information before calling the generic - * constructBindingURI method - * - * @param component the component that holds the service - * @param service the service that holds the binding - * @param binding the binding for which the URI is being constructed - * @param defaultBindings the list of default binding configurations - */ - private void constructBindingURI(Component component, Service service, Binding binding, List defaultBindings) - throws CompositeBuilderException{ - boolean includeBindingName = component.getServices().size() != 1; - constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings); - } - - /** - * Generic URI construction for bindings based on Assembly Specification section 1.7.2 - * - * @param componentURIString the string version of the URI part that comes from the component name - * @param service the service in question - * @param binding the binding for which the URI is being constructed - * @param includeBindingName when set true the serviceBindingURI part should be used - * @param defaultBindings the list of default binding configurations - * @throws CompositeBuilderException - */ - private void constructBindingURI(String componentURIString, Service service, Binding binding, boolean includeBindingName, List defaultBindings) - throws CompositeBuilderException{ - - try { - // calculate the service binding URI - URI bindingURI; - if (binding.getURI() != null){ - bindingURI = new URI(binding.getURI()); - - // if the user has provided an absolute binding URI then use it - if (bindingURI.isAbsolute()){ - binding.setURI(bindingURI.toString()); - return; - } - } else { - bindingURI = null; - } - - // Get the service binding name - URI bindingName; - if (binding.getName() != null) { - bindingName = new URI(binding.getName()); - } else { - bindingName = new URI(""); - } - - // calculate the component URI - URI componentURI; - if (componentURIString != null) { - componentURI = new URI(addSlashToPath(componentURIString)); - } else { - componentURI = null; - } - - // if the user has provided an absolute component URI then use it - if (componentURI != null && componentURI.isAbsolute()){ - binding.setURI(constructBindingURI(null, componentURI, bindingURI, includeBindingName, bindingName)); - return; - } - - // calculate the base URI - - // get the protocol for this binding/URI -/* some code that allows binding specific code to run. Being discussed on ML - BindingURICalculator uriCalculator = bindingURICalcualtorExtensionPoint.getBindingURICalculator(binding); - - if (uriCalculator != null){ - String protocol = uriCalculator.getProtocol(binding); - - // find the default binding with the right protocol - Binding defaultBinding = nodeInfo.getBindingDefault(binding, protocol); - - if (defaultBinding != null){ - baseURI = new URI(defaultBinding.getURI()); - } else { - baseURI = null; - } - - } else { - baseURI = null; - } -*/ - // as a simpler alternative to the above commented out code. - URI baseURI = null; - if (defaultBindings != null) { - for (Binding defaultBinding : defaultBindings){ - if (binding.getClass() == defaultBinding.getClass()){ - baseURI = new URI(addSlashToPath(defaultBinding.getURI())); - break; - } - } - } - - binding.setURI(constructBindingURI(baseURI, componentURI, bindingURI, includeBindingName, bindingName)); - } catch (URISyntaxException ex) { - warning("URLSyntaxException when creating binding URI at component " + - componentURIString + - " service " + - service.getName() + - " binding " + - binding.getName(), - ex); - } - } - - /** - * Use to ensure that URI paths end in "/" as here we want to maintain the - * last path element of an base URI when other URI are resolved against it. This is - * not the default behaviour of URI resolution as defined in RFC 2369 - * - * @param path the path string to which the "/" is to be added - * @return the resulting path with a "/" added if it not already there - */ - private String addSlashToPath(String path){ - if (path.endsWith("/")){ - return path; - } else { - return path + "/"; - } - } - - /** - * Concatenate binding URI parts together based on Assembly Specification section 1.7.2 - * - * @param baseURI the base of the binding URI - * @param componentURI the middle part of the binding URI derived from the component name - * @param bindingURI the end part of the binding URI - * @param includeBindingName when set true the binding name part should be used - * @param bindingName the binding name - * @return the resulting URI as a string - */ - private String constructBindingURI(URI baseURI, URI componentURI, URI bindingURI, boolean includeBindingName, URI bindingName){ - String uriString; - - if (baseURI == null) { - if (componentURI == null){ - if (bindingURI != null ) { - uriString = bindingURI.toString(); - } else { - uriString = bindingName.toString(); - } - } else { - if (bindingURI != null ) { - uriString = componentURI.resolve(bindingURI).toString(); - } else { - if (includeBindingName) { - uriString = componentURI.resolve(bindingName).toString(); - } else { - uriString = componentURI.toString(); - } - } - } - } else { - if (componentURI == null){ - if (bindingURI != null ) { - uriString = baseURI.resolve(bindingURI).toString(); - } else { - if (includeBindingName) { - uriString = baseURI.resolve(bindingName).toString(); - } else { - uriString = baseURI.toString(); - } - } - } else { - if (bindingURI != null ) { - uriString = baseURI.resolve(componentURI).resolve(bindingURI).toString(); - } else { - if (includeBindingName) { - uriString = baseURI.resolve(componentURI).resolve(bindingName).toString(); - } else { - uriString = baseURI.resolve(componentURI).toString(); - } - } - } - } - - // tidy up by removing any trailing "/" - if (uriString.endsWith("/")){ - uriString = uriString.substring(0, uriString.length()-1); - } - - URI uri = URI.create(uriString); - if (!uri.isAbsolute()) { - uri = URI.create("/").resolve(uri); - } - return uri.toString(); - } - - public SCADefinitions getScaDefinitions() { - return scaDefinitions; - } - - public void setScaDefinitions(SCADefinitions scaDefinitions) { - this.scaDefinitions = scaDefinitions; - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java deleted file mode 100644 index cda3c5b91a..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -public class CompositeIncludeBuilderImpl { - - public static Logger logger = Logger.getLogger(CompositeIncludeBuilderImpl.class.getName()); - - public CompositeIncludeBuilderImpl(CompositeBuilderMonitor monitor) { - } - - /** - * Collect all includes in a graph of includes. - * - * @param composite - * @param includes - */ - private void collectIncludes(Composite composite, List includes, Set visited) { - for (Composite include : composite.getIncludes()) { - if (visited.contains(include)) { - logger.warning("Composite " + include.getName() + " has already been included."); - continue; - } - - includes.add(include); - visited.add(include); - collectIncludes(include, includes, visited); - } - } - - /** - * Copy a list of includes into a composite. - * - * @param composite - */ - public void fuseIncludes(Composite composite) { - - // First collect all includes - List includes = new ArrayList(); - Set visited = new HashSet(); - visited.add(composite); - collectIncludes(composite, includes, visited); - // Then clone them - for (Composite include : includes) { - Composite clone; - try { - clone = (Composite)include.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); - } - composite.getComponents().addAll(clone.getComponents()); - composite.getServices().addAll(clone.getServices()); - composite.getReferences().addAll(clone.getReferences()); - composite.getProperties().addAll(clone.getProperties()); - composite.getWires().addAll(clone.getWires()); - if ( composite instanceof PolicySetAttachPoint ) { - ((PolicySetAttachPoint)composite).getPolicySets().addAll(((PolicySetAttachPoint)clone).getPolicySets()); - ((PolicySetAttachPoint)composite).getRequiredIntents().addAll(((PolicySetAttachPoint)clone).getRequiredIntents()); - } - } - - // Clear the list of includes - composite.getIncludes().clear(); - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java deleted file mode 100644 index c7a4990230..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java +++ /dev/null @@ -1,998 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Multiplicity; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.assembly.OptimizableBinding; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.Wire; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; -import org.apache.tuscany.sca.assembly.builder.Problem.Severity; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.policy.util.PolicyComputationUtils; - -public class CompositeWireBuilderImpl { - - private CompositeBuilderMonitor monitor; - private AssemblyFactory assemblyFactory; - private InterfaceContractMapper interfaceContractMapper; - - private BindingPolicyComputer bindingPolicyComputer = null; - private ImplementationPolicyComputer implPolicyComputer = null; - - //Represents a target component and service - private class Target { - Component component; - ComponentService service; - - Target(Component component, ComponentService service) { - this.component = component; - this.service = service; - } - - Component getComponent() { - return component; - } - - ComponentService getService() { - return service; - } - }; - - public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor monitor) { - this.assemblyFactory = assemblyFactory; - this.interfaceContractMapper = interfaceContractMapper; - this.monitor = monitor; - - this.bindingPolicyComputer = new BindingPolicyComputer(); - this.implPolicyComputer = new ImplementationPolicyComputer(); - } - - /** - * Wire component references to component services and connect promoted - * services/references to component services/references inside a composite. - * - * @param composite - */ - public void wireComposite(Composite composite) { - - // Wire nested composites recursively - for (Component component : composite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - wireComposite((Composite)implementation); - } - } - - // Index components, services and references - Map components = new HashMap(); - Map componentServices = new HashMap(); - Map componentReferences = new HashMap(); - indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences); - - // Connect composite services and references to the component - // services and references that they promote - connectCompositeServices(composite, components, componentServices); - connectCompositeReferences(composite, componentReferences); - - // Compute the policies before connecting component references - computePolicies(composite); - - // Connect component references as described in wires - connectWires(composite, componentServices, componentReferences); - - // Connect component references to their targets - connectComponentReferences(composite, components, componentServices, componentReferences); - - // Validate that references are wired or promoted, according - // to their multiplicity - for (ComponentReference componentReference : componentReferences.values()) { - if (!ReferenceUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(), componentReference - .getTargets(), componentReference.getBindings())) { - if (componentReference.getTargets().isEmpty()) { - - // No warning if the reference is promoted out of the current composite - boolean promoted = false; - for (Reference reference : composite.getReferences()) { - CompositeReference compositeReference = (CompositeReference)reference; - if (compositeReference.getPromotedReferences().contains(componentReference)) { - promoted = true; - break; - } - } - if (!promoted && !componentReference.isCallback()) { - warning("No targets for reference: " + componentReference.getName(), composite); - } - } else { - warning("Too many targets on reference: " + componentReference.getName(), composite); - } - } - } - } - - /** - * Index components, services and references inside a composite. - * @param composite - * @param components - * @param componentServices - * @param componentReferences - */ - private void indexComponentsServicesAndReferences(Composite composite, - Map components, - Map componentServices, - Map componentReferences) { - - for (Component component : composite.getComponents()) { - - // Index components by name - components.put(component.getName(), component); - - ComponentService nonCallbackService = null; - int nonCallbackServices = 0; - for (ComponentService componentService : component.getServices()) { - - // Index component services by component name / service name - String uri = component.getName() + '/' + componentService.getName(); - componentServices.put(uri, componentService); - if (!componentService.isCallback()) { - - // Check how many non callback services we have - if (nonCallbackServices == 0) { - nonCallbackService = componentService; - } - nonCallbackServices++; - } - } - if (nonCallbackServices == 1) { - // If we have a single non callback service, index it by - // component name as well - componentServices.put(component.getName(), nonCallbackService); - } - - // Index references by component name / reference name - for (ComponentReference componentReference : component.getReferences()) { - String uri = component.getName() + '/' + componentReference.getName(); - componentReferences.put(uri, componentReference); - } - } - } - - /** - * Report a warning. - * - * @param problems - * @param message - * @param model - */ - private void warning(String message, Object model) { - monitor.problem(new ProblemImpl(Severity.WARNING, message, model)); - } - - /** - * Connect composite services to the component services that they promote. - * - * @param composite - * @param componentServices - * @param problems - */ - private void connectCompositeServices(Composite composite, - Map components, - Map componentServices) { - - // Propagate interfaces from inner composite components' services to - // their component services - for (Component component : composite.getComponents()) { - if (component.getImplementation() instanceof Composite) { - for (ComponentService componentService : component.getServices()) { - Service service = componentService.getService(); - if (service != null) { - if (componentService.getInterfaceContract() == null) { - componentService.setInterfaceContract(service.getInterfaceContract()); - } - } - } - } - } - - // Connect composite services to the component services that they - // promote - for (Service service : composite.getServices()) { - CompositeService compositeService = (CompositeService)service; - ComponentService componentService = compositeService.getPromotedService(); - if (componentService != null && componentService.isUnresolved()) { - - String promotedComponentName = compositeService.getPromotedComponent().getName(); - String promotedServiceName; - if (componentService.getName() != null) { - promotedServiceName = promotedComponentName + '/' + componentService.getName(); - } else { - promotedServiceName = promotedComponentName; - } - ComponentService promotedService = componentServices.get(promotedServiceName); - if (promotedService != null) { - - // Point to the resolved component - Component promotedComponent = components.get(promotedComponentName); - compositeService.setPromotedComponent(promotedComponent); - - // Point to the resolved component service - compositeService.setPromotedService(promotedService); - - // Use the interface contract from the component service if - // none is specified on the composite service - if (compositeService.getInterfaceContract() == null) { - compositeService.setInterfaceContract(promotedService.getInterfaceContract()); - } - - } else { - warning("Promoted component service not found: " + promotedServiceName, composite); - } - } - } - - } - - /** - * Resolves promoted references. - * - * @param composite - * @param componentReferences - * @param problems - */ - private void connectCompositeReferences(Composite composite, Map componentReferences) { - - // Propagate interfaces from inner composite components' references to - // their component references - for (Component component : composite.getComponents()) { - if (component.getImplementation() instanceof Composite) { - for (ComponentReference componentReference : component.getReferences()) { - Reference reference = componentReference.getReference(); - if (reference != null) { - if (componentReference.getInterfaceContract() == null) { - componentReference.setInterfaceContract(reference.getInterfaceContract()); - } - } - } - } - } - - // Connect composite references to the component references - // that they promote - for (Reference reference : composite.getReferences()) { - CompositeReference compositeReference = (CompositeReference)reference; - List promotedReferences = compositeReference.getPromotedReferences(); - for (int i = 0, n = promotedReferences.size(); i < n; i++) { - ComponentReference componentReference = promotedReferences.get(i); - if (componentReference.isUnresolved()) { - String componentReferenceName = componentReference.getName(); - componentReference = componentReferences.get(componentReferenceName); - if (componentReference != null) { - - // Point to the resolved component reference - promotedReferences.set(i, componentReference); - - // Use the interface contract from the component - // reference if none - // is specified on the composite reference - if (compositeReference.getInterfaceContract() == null) { - compositeReference.setInterfaceContract(componentReference.getInterfaceContract()); - } - - } else { - warning("Promoted component reference not found: " + componentReferenceName, composite); - } - } - } - } - } - - private List createComponentReferenceTargets(Composite composite, - Map components, - Map componentServices, - ComponentReference componentReference) { - List targets = new ArrayList(); - - if (componentReference.getAutowire() == Boolean.TRUE) { - - // Find suitable targets in the current composite for an - // autowired reference - Multiplicity multiplicity = componentReference.getMultiplicity(); - for (Component targetComponent : composite.getComponents()) { - for (ComponentService targetComponentService : targetComponent.getServices()) { - if (componentReference.getInterfaceContract() == null || - interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) { - Target target = new Target(targetComponent, targetComponentService); - targets.add(target); - if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) { - break; - } - } - } - } - - if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) { - if (targets.size() == 0) { - warning("No target services found for the component reference to be autowired: " + componentReference - .getName(), - componentReference); - } - } - - } else if (!componentReference.getTargets().isEmpty()) { - - // Resolve targets specified on the component reference - for (ComponentService componentService : componentReference.getTargets()) { - - // Resolve the target component and service - String name = componentService.getName(); - ComponentService targetComponentService = componentServices.get(name); - Component targetComponent; - int s = name.indexOf('/'); - if (s == -1) { - targetComponent = components.get(name); - } else { - targetComponent = components.get(name.substring(0, s)); - } - - if (targetComponentService != null) { - - // Check that the target component service provides - // a superset of the component reference interface - if (componentReference.getInterfaceContract() == null || - interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) { - - Target target = new Target(targetComponent, targetComponentService); - targets.add(target); - - // mark the reference target as resolved. Used later when we are looking to - // see if an sca binding is associated with a resolved target or not - componentService.setUnresolved(false); - } else { - warning("Incompatible interfaces on component reference and target: " + componentReference - .getName() - + " : " - + componentService.getName(), - composite); - } - } else { - // add all the reference bindings into the target so that they - // can be used for comparison when the target is resolved at runtime - componentService.getBindings().addAll(componentReference.getBindings()); - - // The bindings will be cloned back into the reference when the - // target is finally resolved. - - warning("Component reference target not found, it might be a remote service: " + componentService.getName(), composite); - } - } - } else if (componentReference.getReference() != null) { - - // Resolve targets from the corresponding reference in the - // componentType - for (ComponentService componentService : componentReference.getReference().getTargets()) { - - // Resolve the target component and service - String name = componentService.getName(); - ComponentService targetComponentService = componentServices.get(name); - Component targetComponent; - int s = name.indexOf('/'); - if (s == -1) { - targetComponent = components.get(name); - } else { - targetComponent = components.get(name.substring(0, s)); - } - - if (targetComponentService != null) { - - // Check that the target component service provides - // a superset of - // the component reference interface - if (componentReference.getInterfaceContract() == null || - interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) { - - Target target = new Target(targetComponent, targetComponentService); - targets.add(target); - - // mark the reference target as resolved. Used later when we are looking to - // see if an sca binding is associated with a resolved target or not - componentService.setUnresolved(false); - } else { - warning("Incompatible interfaces on component reference and target: " + componentReference - .getName() - + " : " - + componentService.getName(), - composite); - } - } else { - // add all the reference bindings into the target so that they - // can be used for comparison when the target is resolved at runtime - componentService.getBindings().addAll(componentReference.getBindings()); - - // The bindings will be cloned back into the reference when the - // target is finally resolved. - - warning("Component reference target from component type not found, it might be a remote service: " + componentService.getName(), composite); - } - } - } - return targets; - } - - - /** - * Connect references to their targets. - * - * @param composite - * @param componentServices - * @param componentReferences - * @param problems - */ - private void connectComponentReferences(Composite composite, - Map components, - Map componentServices, - Map componentReferences) { - for (ComponentReference componentReference : componentReferences.values()) { - - List targets = createComponentReferenceTargets(composite, - components, - componentServices, - componentReference); - - // Select the reference bindings matching the target service bindings - List selectedBindings = new ArrayList(); - - // Handle callback - boolean bidirectional = false; - if (componentReference.getInterfaceContract() != null && componentReference.getInterfaceContract().getCallbackInterface() != null) { - bidirectional = true; - } - List selectedCallbackBindings = bidirectional ? new ArrayList() : null; - - for (Target target : targets) { - - Component targetComponent = target.getComponent(); - ComponentService targetComponentService = target.getService(); - if (targetComponentService.getService() instanceof CompositeService) { - CompositeService compositeService = (CompositeService) targetComponentService.getService(); - // Find the promoted component service - targetComponentService = CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService); - } - - try { - bindingPolicyComputer.determineApplicableBindingPolicySets(componentReference, targetComponentService); - } catch ( Exception e ) { - warning("Policy related exception: " + e, e); - //throw new RuntimeException(e); - } - - // Match the binding against the bindings of the target service - Binding selected = BindingUtil.resolveBindings(componentReference, targetComponent, targetComponentService); - if (selected == null) { - warning("Component reference doesn't have a matching binding", componentReference); - } else { - selectedBindings.add(selected); - } - if (bidirectional) { - Binding selectedCallback = BindingUtil.resolveCallbackBindings(componentReference, targetComponent, targetComponentService); - if (selectedCallback != null) { - selectedCallbackBindings.add(selectedCallback); - } - } - } - - if (!targets.isEmpty()) { - - // Add all the effective bindings - componentReference.getBindings().clear(); - componentReference.getBindings().addAll(selectedBindings); - if (bidirectional) { - componentReference.getCallback().getBindings().clear(); - componentReference.getCallback().getBindings().addAll(selectedCallbackBindings); - } - } - - // Need to tidy up the reference binding list. The situation so far... - // Wired reference (1 or more targets are specified) - // Binding.uri = null - remove as its left over from target resolution - // the binding will have been moved to the target from where - // it will be resolved later - // Binding.uri != null - the reference was resolved - // Unwired reference (0 targets) - // Binding.uri = null - Either a callback reference or the reference is yet to be wired - // either manually or via autowire so leave the binding where it is - // Binding.uri != null - from the composite file so leave it - if (componentReference.getTargets().size() > 0){ - List bindingsToRemove = new ArrayList(); - for(Binding binding : componentReference.getBindings()){ - if(binding.getURI() == null){ - bindingsToRemove.add(binding); - } - } - - componentReference.getBindings().removeAll(bindingsToRemove); - } - } - } - - /** - * Resolve wires and connect the sources to their targets - * - * @param composite - * @param componentServices - * @param componentReferences - * @param problems - */ - private void connectWires(Composite composite, - Map componentServices, - Map componentReferences) { - - // For each wire, resolve the source reference, the target service, and - // add it to the list of targets of the reference - List wires = composite.getWires(); - for (int i = 0, n = wires.size(); i < n; i++) { - Wire wire = wires.get(i); - - ComponentReference resolvedReference; - ComponentService resolvedService; - - // Resolve the source reference - ComponentReference source = wire.getSource(); - if (source != null && source.isUnresolved()) { - resolvedReference = componentReferences.get(source.getName()); - if (resolvedReference != null) { - wire.setSource(resolvedReference); - } else { - warning("Wire source not found: " + source.getName(), composite); - } - } else { - resolvedReference = wire.getSource(); - } - - // Resolve the target service - ComponentService target = wire.getTarget(); - if (target != null && target.isUnresolved()) { - resolvedService = componentServices.get(target.getName()); - if (resolvedService != null) { - wire.setTarget(target); - } else { - warning("Wire target not found: " + source.getName(), composite); - } - } else { - resolvedService = wire.getTarget(); - } - - // Add the target service to the list of targets of the - // reference - if (resolvedReference != null && resolvedService != null) { - // Check that the target component service provides - // a superset of - // the component reference interface - if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper - .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) { - - //resolvedReference.getTargets().add(resolvedService); - resolvedReference.getTargets().add(wire.getTarget()); - } else { - warning("Incompatible interfaces on wire source and target: " + source.getName() - + " : " - + target.getName(), composite); - } - } - } - - // Clear the list of wires - composite.getWires().clear(); - } - - /** - * Wire composite references in nested composites. - * - * @param composite - * @param problems - */ - public void wireCompositeReferences(Composite composite) { - - // Process nested composites recursively - for (Component component : composite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - wireCompositeReferences((Composite)implementation); - } - } - - // Process composite references declared in this composite - for (Reference reference : composite.getReferences()) { - CompositeReference compositeReference = (CompositeReference)reference; - List promotedReferences = getPromotedComponentReferences(compositeReference); - for (ComponentReference promotedReference : promotedReferences) { - - reconcileReferenceBindings(compositeReference, promotedReference); - if (compositeReference.getInterfaceContract() != null && // can be null in unit tests - compositeReference.getInterfaceContract().getCallbackInterface() != null) { - SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class); - if (promotedReference.getCallback() != null) { - promotedReference.getCallback().getBindings().clear(); - } else { - promotedReference.setCallback(assemblyFactory.createCallback()); - } - if (scaCallbackBinding != null) { - promotedReference.getCallback().getBindings().add(scaCallbackBinding); - } - if (compositeReference.getCallback() != null) { - promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback() - .getBindings()); - } - } - } - } - - // Process the component references declared on components - // in this composite - for (Component component : composite.getComponents()) { - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - for (ComponentReference componentReference : component.getReferences()) { - Reference implReference = componentReference.getReference(); - if (implReference != null && implReference instanceof CompositeReference) { - CompositeReference compositeReference = (CompositeReference)implReference; - List promotedReferences = - getPromotedComponentReferences(compositeReference); - for (ComponentReference promotedReference : promotedReferences) { - - // Override the configuration of the promoted reference - reconcileReferenceBindings(componentReference, promotedReference); - if (componentReference.getInterfaceContract() != null && // can be null in unit tests - componentReference.getInterfaceContract().getCallbackInterface() != null) { - SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class); - if (promotedReference.getCallback() != null) { - promotedReference.getCallback().getBindings().clear(); - } else { - promotedReference.setCallback(assemblyFactory.createCallback()); - } - if (scaCallbackBinding != null) { - promotedReference.getCallback().getBindings().add(scaCallbackBinding); - } - if (componentReference.getCallback() != null) { - promotedReference.getCallback().getBindings().addAll(componentReference - .getCallback().getBindings()); - } - } - - // Wire the promoted reference to the actual - // non-composite component services - if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference - .getMultiplicity() == Multiplicity.ONE_ONE) { - // promotedReference.getTargets().clear(); - } - for (ComponentService target : componentReference.getTargets()) { - if (target.getService() instanceof CompositeService) { - - // Wire to the actual component service - // promoted by a composite service - CompositeService compositeService = (CompositeService)target.getService(); - // Find the promoted component service - ComponentService componentService = CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService); - if (componentService != null) { - promotedReference.getTargets().add(componentService); - } - } else { - - // Wire to a non-composite target service - promotedReference.getTargets().add(target); - } - } - } - } - } - } else { - for (ComponentReference componentReference : component.getReferences()) { - - // Wire the component reference to the actual - // non-composite component services - List targets = componentReference.getTargets(); - for (int i = 0, n = targets.size(); i < n; i++) { - ComponentService target = targets.get(i); - if (target.getService() instanceof CompositeService) { - - // Wire to the actual component service - // promoted by a composite service - CompositeService compositeService = (CompositeService)target.getService(); - ComponentService componentService = compositeService.getPromotedService(); - if (componentService != null) { - targets.set(i, componentService); - } - } - } - } - } - } - } - - /** - * Follow a reference promotion chain down to the inner most (non composite) - * component references. - * - * @param compositeReference - * @return - */ - private List getPromotedComponentReferences(CompositeReference compositeReference) { - List componentReferences = new ArrayList(); - collectPromotedComponentReferences(compositeReference, componentReferences); - return componentReferences; - } - - /** - * Follow a reference promotion chain down to the inner most (non composite) - * component references. - * - * @param compositeReference - * @param componentReferences - * @return - */ - private void collectPromotedComponentReferences(CompositeReference compositeReference, - List componentReferences) { - for (ComponentReference componentReference : compositeReference.getPromotedReferences()) { - Reference reference = componentReference.getReference(); - if (reference instanceof CompositeReference) { - - // Continue to follow the reference promotion chain - collectPromotedComponentReferences((CompositeReference)reference, componentReferences); - - } else if (reference != null) { - - // Found a non-composite reference - componentReferences.add(componentReference); - } - } - } - - /** - * Override the bindings for a promoted reference from an outer component - * reference - * - * @param reference - * @param promotedReference - */ - private void reconcileReferenceBindings(Reference reference, ComponentReference promotedReference) { - Set bindings = new HashSet(); - bindings.addAll(promotedReference.getBindings()); - bindings.addAll(reference.getBindings()); - promotedReference.getBindings().clear(); - for (Binding binding : bindings) { - if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) { - promotedReference.getBindings().add(binding); - } - } - if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) { - if (promotedReference.getBindings().size() > 1) { - warning("Component reference " + promotedReference.getName() + " has more than one wires", - promotedReference); - } - } - Set callbackBindings = new HashSet(); - if (promotedReference.getCallback() != null) { - callbackBindings.addAll(promotedReference.getCallback().getBindings()); - } - if (reference.getCallback() != null) { - callbackBindings.addAll(reference.getCallback().getBindings()); - } - promotedReference.setCallback(assemblyFactory.createCallback()); - for (Binding binding : callbackBindings) { - if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) { - promotedReference.getCallback().getBindings().add(binding); - } - } - } - - private void addPoliciesFromPromotedService(CompositeService compositeService) { - //inherit intents and policies from promoted service - PolicyComputationUtils.addInheritedIntents(compositeService.getPromotedService().getRequiredIntents(), - compositeService.getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(compositeService.getPromotedService().getPolicySets(), - compositeService.getPolicySets(), true); - addInheritedOperationConfigurations(compositeService.getPromotedService(), compositeService); - } - - private void addPoliciesFromPromotedReference(CompositeReference compositeReference) { - for ( Reference promotedReference : compositeReference.getPromotedReferences() ) { - PolicyComputationUtils.addInheritedIntents(promotedReference.getRequiredIntents(), - compositeReference.getRequiredIntents()); - - PolicyComputationUtils.addInheritedPolicySets(promotedReference.getPolicySets(), - compositeReference.getPolicySets(), true); - addInheritedOperationConfigurations(promotedReference, compositeReference); - } - } - - - public void computePolicies(Composite composite) { - - //compute policies for composite service bindings - for (Service service : composite.getServices()) { - addPoliciesFromPromotedService((CompositeService)service); - try { - //compute the intents for operations under service element - bindingPolicyComputer.computeIntentsForOperations(service); - //add or merge service operations to the binding - //addInheritedOpConfOnBindings(service); - bindingPolicyComputer.computeBindingIntentsAndPolicySets(service); - bindingPolicyComputer.determineApplicableBindingPolicySets(service, null); - } catch ( Exception e ) { - warning("Policy related exception: " + e, e); - //throw new RuntimeException(e); - } - - } - - for (Reference reference : composite.getReferences()) { - CompositeReference compReference = (CompositeReference)reference; - addPoliciesFromPromotedReference(compReference); - try { - //compute the intents for operations under service element - bindingPolicyComputer.computeIntentsForOperations(reference); - //addInheritedOpConfOnBindings(reference); - - if (compReference.getCallback() != null) { - PolicyComputationUtils.addInheritedIntents(compReference.getRequiredIntents(), - compReference.getCallback().getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(compReference.getPolicySets(), - compReference.getCallback().getPolicySets(), - false); - } - - bindingPolicyComputer.computeBindingIntentsAndPolicySets(reference); - bindingPolicyComputer.determineApplicableBindingPolicySets(reference, null); - } catch ( Exception e ) { - warning("Policy related exception: " + e, e); - //throw new RuntimeException(e); - } - } - - for (Component component : composite.getComponents()) { - Implementation implemenation = component.getImplementation(); - try { - implPolicyComputer.computeImplementationIntentsAndPolicySets(implemenation, component); - } catch ( Exception e ) { - warning("Policy related exception: " + e, e); - //throw new RuntimeException(e); - } - - for (ComponentService componentService : component.getServices()) { - Service service = componentService.getService(); - if (service != null) { - // reconcile intents and policysets from componentType - PolicyComputationUtils.addInheritedIntents(service.getRequiredIntents(), componentService.getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(service.getPolicySets(), componentService.getPolicySets(), true); - - //reconcile intents and policysets for operations - boolean notFound; - List opsFromComponentType = new ArrayList(); - for ( ConfiguredOperation ctsConfOp : service.getConfiguredOperations() ) { - notFound = true; - for ( ConfiguredOperation csConfOp : componentService.getConfiguredOperations() ) { - if ( csConfOp.getName().equals(ctsConfOp.getName()) ) { - PolicyComputationUtils.addInheritedIntents(ctsConfOp.getRequiredIntents(), csConfOp.getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(ctsConfOp.getPolicySets(), csConfOp.getPolicySets(), true); - notFound = false; - } - } - - if ( notFound ) { - opsFromComponentType.add(ctsConfOp); - } - } - componentService.getConfiguredOperations().addAll(opsFromComponentType); - } - - try { - //compute the intents for operations under service element - bindingPolicyComputer.computeIntentsForOperations(componentService); - //compute intents and policyset for each binding - //addInheritedOpConfOnBindings(componentService); - bindingPolicyComputer.computeBindingIntentsAndPolicySets(componentService); - bindingPolicyComputer.determineApplicableBindingPolicySets(componentService, null); - - } catch ( Exception e ) { - warning("Policy related exception: " + e, e); - //throw new RuntimeException(e); - } - } - - for (ComponentReference componentReference : component.getReferences()) { - Reference reference = componentReference.getReference(); - if (reference != null) { - // reconcile intents and policysets - PolicyComputationUtils.addInheritedIntents(reference.getRequiredIntents(), componentReference.getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(reference.getPolicySets(), componentReference.getPolicySets(), true); - } - - - try { - //compute the intents for operations under reference element - bindingPolicyComputer.computeIntentsForOperations(componentReference); - //compute intents and policyset for each binding - //addInheritedOpConfOnBindings(componentReference); - bindingPolicyComputer.computeBindingIntentsAndPolicySets(componentReference); - bindingPolicyComputer.determineApplicableBindingPolicySets(componentReference, null); - - - if ( componentReference.getCallback() != null ) { - PolicyComputationUtils.addInheritedIntents(componentReference.getRequiredIntents(), - componentReference.getCallback().getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(componentReference.getPolicySets(), - componentReference.getCallback().getPolicySets(), - false); - } - } catch ( Exception e ) { - warning("Policy related exception: " + e, e); - //throw new RuntimeException(e); - } - } - } - } - - private void addInheritedOperationConfigurations(OperationsConfigurator source, - OperationsConfigurator target) { - boolean found = false; - - List additionalOperations = new ArrayList(); - for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) { - for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) { - if ( sourceConfOp.getName().equals(targetConfOp.getName())) { - PolicyComputationUtils.addInheritedIntents(sourceConfOp.getRequiredIntents(), - targetConfOp.getRequiredIntents()); - PolicyComputationUtils.addInheritedPolicySets(sourceConfOp.getPolicySets(), - targetConfOp.getPolicySets(), true); - found = true; - break; - } - } - - if ( !found ) { - additionalOperations.add(sourceConfOp); - } - } - - if ( !additionalOperations.isEmpty() ) { - target.getConfiguredOperations().addAll(additionalOperations); - } - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java deleted file mode 100644 index b2f96c30cc..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; -import org.apache.tuscany.sca.assembly.builder.DomainBuilder; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; - -public class DomainWireBuilderImpl implements DomainBuilder { - - private CompositeWireBuilderImpl wireBuilder; - - public DomainWireBuilderImpl(AssemblyFactory assemblyFactory, - SCABindingFactory scaBindingFactory, - IntentAttachPointTypeFactory intentAttachPointTypeFactory, - InterfaceContractMapper interfaceContractMapper, - CompositeBuilderMonitor monitor) { - wireBuilder = new CompositeWireBuilderImpl(assemblyFactory, interfaceContractMapper, monitor); - } - - public String getComponentNameFromReference(String referenceName){ - // Extract the component name - String componentName = referenceName; - int i = referenceName.indexOf('/'); - if (i != -1) { - componentName = referenceName.substring(0, i); - } - - return componentName; - } - - public String getServiceNameFromReference(String referenceName){ - // Extract the component name - String serviceName = null; - int i = referenceName.indexOf('/'); - if (i != -1) { - serviceName = referenceName.substring(i + 1); - - } - return serviceName; - } - - - public List findReferenceForService(Composite composite, String serviceName){ - - List referenceList = new ArrayList(); - - String componentName = getComponentNameFromReference(serviceName); - - for (Reference reference: composite.getReferences()) { - for (ComponentService componentService : reference.getTargets()){ - if (componentService.getName().equals(serviceName) || - componentService.getName().equals(componentName)) { - referenceList.add(reference); - } - } - } - - for (Component component: composite.getComponents()) { - for (ComponentReference reference: component.getReferences()) { - for (ComponentService componentService : reference.getTargets()){ - if (componentService.getName().equals(serviceName) || - componentService.getName().equals(componentName)) { - referenceList.add(reference); - } - } - } - } - - return referenceList; - } - - public List findDomainLevelReferenceForService(Composite composite, String referenceName){ - List referenceList = new ArrayList(); - - for (Composite tmpComposite : composite.getIncludes()) { - List tmpReferenceList = findReferenceForService(tmpComposite, referenceName); - - referenceList.addAll(tmpReferenceList); - } - - return referenceList; - } - - public Service findServiceForReference(Composite composite, String referenceName){ - - String componentName = getComponentNameFromReference(referenceName); - String serviceName = getServiceNameFromReference(referenceName); - - for (Service service: composite.getServices()) { - if (service.getName().equals(serviceName)){ - return service; - } - } - - for (Component component: composite.getComponents()) { - if (component.getName().equals(componentName)){ - if (component.getServices().size() > 1) { - for (Service service: component.getServices()) { - if (service.getName().equals(serviceName)){ - return service; - } - } - } else if (component.getServices().size() == 1) { - return component.getServices().get(0); - } - } - } - - return null; - } - - public Service findDomainLevelService(Composite composite, String referenceName){ - Service service = null; - - for (Composite tmpComposite : composite.getIncludes()) { - service = findServiceForReference(tmpComposite, referenceName); - if (service != null) { - break; - } - } - - return service; - } - - public void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI){ - - String componentName = getComponentNameFromReference(referenceName); - String serviceName = getServiceNameFromReference(referenceName); - - // get the named service - Service service = null; - for(Composite composite : domainLevelComposite.getIncludes()) { - service = findServiceForReference(composite, referenceName); - if (service != null){ - break; - } - } - - if (service != null) { - // find the named binding - for (Binding binding : service.getBindings()){ - if (binding.getClass().getName().equals(bindingClassName)){ - binding.setURI(URI); - break; - } - } - } - } - - public List wireDomain(Composite domainLevelComposite){ - List changedComposites = new ArrayList(); - - // process wires - - // autowire - - // wire by impl? - - // process all wired references - for(Composite composite : domainLevelComposite.getIncludes()) { - boolean compositeChanged = false; - for(Component component : composite.getComponents()){ - for (Reference reference : component.getReferences()){ - for (ComponentService targetService : reference.getTargets()){ - String targetName = targetService.getName(); - String componentName = getComponentNameFromReference(targetName); - String serviceName = getServiceNameFromReference(targetName); - - Service service = null; - Component serviceComponent = null; - - // find the real target service in the domain - for(Composite tmpComposite : domainLevelComposite.getIncludes()) { - for (Component tmpComponent: tmpComposite.getComponents()) { - if (tmpComponent.getName().equals(componentName)){ - serviceComponent = tmpComponent; - if (tmpComponent.getServices().size() > 1) { - for (Service tmpService: tmpComponent.getServices()) { - if (tmpService.getName().equals(serviceName)){ - service = tmpService; - break; - } - } - } else if (tmpComponent.getServices().size() == 1) { - service = tmpComponent.getServices().get(0); - break; - } - } - } - } - - if ( targetService.isUnresolved()){ - - if (service != null){ - // Find the binding already in use for this target - Binding binding = null; - - for (Binding tmpBinding : reference.getBindings()){ - if ((tmpBinding.getName() != null) && - (tmpBinding.getName().startsWith(reference.getName() + "#" + targetName))){ - binding = tmpBinding; - } - } - - // Resolve the binding that should be used for this target - // TODO - hang onto the old bindings at the domain level, i.e. - // don't rely on the target objects as we still need the - // bindings if we are going to do autowiring - List source = targetService.getBindings(); - List target = service.getBindings(); - Binding newBinding = BindingUtil.matchBinding(serviceComponent, (ComponentService)service, source, target); - - // update the existing binding to the new binding if required - if (newBinding != null) { - if (binding != null){ - // there is a binding already so see if the URI has changed - if ((binding.getURI() == null) || - (!binding.getURI().equals(newBinding.getURI()))){ - binding.setURI(newBinding.getURI()); - compositeChanged = true; - } - } else { - // this is a newly configured binding so add it - reference.getBindings().add(newBinding); - compositeChanged = true; - } - } - } else { - // Do nothing - the target service hasn't been contributed yet - } - } else { - // find the reference binding with the right name - for (Binding refBinding : reference.getBindings()){ - if ((refBinding.getName() != null) && - (refBinding.getName().startsWith(reference.getName() + "#" + targetName))){ - // find the matching service binding - for (Binding serviceBinding : service.getBindings()){ - if (refBinding.getClass() == serviceBinding.getClass()){ - refBinding.setURI(serviceBinding.getURI()); - } - } - } - } - } - } - } - } - - if (compositeChanged) { - changedComposites.add(composite); - } - } - - return changedComposites; - } - - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java deleted file mode 100644 index 2bd010c489..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPoint; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.util.PolicyValidationException; - -/** - * Policy computation methods pertaining to computing Implementation Policies - */ -public class ImplementationPolicyComputer extends PolicyComputer { - - public ImplementationPolicyComputer() { - super(); - } - - public void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent) - throws PolicyValidationException, PolicyComputationException { - if ( implementation instanceof PolicySetAttachPoint ) { - PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)implementation; - //since for an implementation the component has its policy intents and policysets its possible - //that there are some intents there that does not constrain the implementation.. so prune - List prunedIntents = computeInheritableIntents(policiedImplementation.getType(), - parent.getRequiredIntents()); - parent.getRequiredIntents().clear(); - parent.getRequiredIntents().addAll(prunedIntents); - normalizeIntents(parent); - - computeIntentsForOperations((OperationsConfigurator)parent, - (IntentAttachPoint)implementation, - parent.getRequiredIntents()); - - - List prunedPolicySets = computeInheritablePolicySets(parent.getPolicySets(), - parent.getApplicablePolicySets()); - parent.getPolicySets().clear(); - parent.getPolicySets().addAll(prunedPolicySets); - normalizePolicySets(parent); - computePolicySetsForOperations(parent.getApplicablePolicySets(), - (OperationsConfigurator)parent, - (PolicySetAttachPoint)implementation); - - determineApplicableImplementationPolicySets(parent); - } - } - - private void determineApplicableImplementationPolicySets(Component component) throws PolicyComputationException { - List intentsCopy = null; - if ( component.getImplementation() instanceof PolicySetAttachPoint ) { - PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation(); - - //trim intents specified in operations. First check for policysets specified on the operation - //and then in the parent implementation - if ( component instanceof OperationsConfigurator ) { - OperationsConfigurator opConfigurator = (OperationsConfigurator)component; - - for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) { - intentsCopy = new ArrayList(confOp.getRequiredIntents()); - trimInherentlyProvidedIntents(policiedImplementation.getType(), - confOp.getRequiredIntents()); - trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets()); - trimProvidedIntents(confOp.getRequiredIntents(), component.getPolicySets()); - - determineApplicableDomainPolicySets(component.getApplicablePolicySets(), - confOp, - policiedImplementation.getType()); - - if (confOp.getRequiredIntents().size() > 0) { - new PolicyComputationException("The following are unfulfilled intents for operations configured in " - + "component implementation - " + component.getName() + "\nUnfulfilled Intents = " + - confOp.getRequiredIntents()); - } - - //the intents list could have been trimmed when matching for policysets - //since the implementation may need the original set of intents we copy that back - confOp.getRequiredIntents().clear(); - confOp.getRequiredIntents().addAll(intentsCopy); - } - } - - intentsCopy = new ArrayList(component.getRequiredIntents()); - trimInherentlyProvidedIntents(policiedImplementation.getType(), - component.getRequiredIntents()); - trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets()); - - //determine additional policysets that match remaining intents - //if there are intents that are not provided by any policy set throw a warning - //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation - //...for now using the SCA Definitions instead of registry - //if ( domainPolicySets != null) { - determineApplicableDomainPolicySets(component.getApplicablePolicySets(), - component, - policiedImplementation.getType()); - - if (component.getRequiredIntents().size() > 0) { - throw new PolicyComputationException("The following are unfulfilled intents for component implementation - " + component - .getName() + "\nUnfulfilled Intents = " + component.getRequiredIntents()); - } - //} - - //the intents list could have been trimmed when matching for policysets - //since the bindings may need the original set of intents we copy that back - component.getRequiredIntents().clear(); - component.getRequiredIntents().addAll(intentsCopy); - } - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java deleted file mode 100644 index ae9ed87035..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -/** - * Exception to be throw for invalid policy intents / policysets - */ -public class PolicyComputationException extends Exception { - private static final long serialVersionUID = 506979037642587755L; - - public PolicyComputationException(String message) { - super(message); - } - - public PolicyComputationException(Throwable e) { - super(e); - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java deleted file mode 100644 index 0e290865bd..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPoint; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.ProfileIntent; -import org.apache.tuscany.sca.policy.QualifiedIntent; -import org.apache.tuscany.sca.policy.util.PolicyValidationException; -import org.apache.tuscany.sca.policy.util.PolicyValidationUtils; - -/** - * This class contains policy computation methods common to computing implementation and binding policies - */ -public abstract class PolicyComputer { - - protected PolicyComputer() { - - } - - protected List computeInheritableIntents(IntentAttachPointType attachPointType, - List inheritableIntents) throws PolicyValidationException { - List validInheritableIntents = new ArrayList(); - - //expand profile intents in inherited intents - expandProfileIntents(inheritableIntents); - - //validate if inherited intent applies to the attachpoint (binding / implementation) and - //only add such intents to the attachpoint (binding / implementation) - for (Intent intent : inheritableIntents) { - if ( !intent.isUnresolved() ) { - for (QName constrained : intent.getConstrains()) { - if ( PolicyValidationUtils.isConstrained(constrained, attachPointType)) { - validInheritableIntents.add(intent); - break; - } - } - } else { - throw new PolicyValidationException("Policy Intent '" + intent.getName() + "' is not defined in this domain"); - } - } - - return validInheritableIntents; - } - - protected void expandProfileIntents(List intents) { - List expandedIntents = null; - if ( intents.size() > 0 ) { - expandedIntents = findAndExpandProfileIntents(intents); - intents.clear(); - intents.addAll(expandedIntents); - } - } - - protected void normalizeIntents(IntentAttachPoint intentAttachPoint) { - //expand profile intents specified in the attachpoint (binding / implementation) - expandProfileIntents(intentAttachPoint.getRequiredIntents()); - - //remove duplicates and ... - //where qualified form of intent exists retain it and remove the qualifiable intent - filterDuplicatesAndQualifiableIntents(intentAttachPoint); - } - - protected void trimInherentlyProvidedIntents(IntentAttachPointType attachPointType, Listintents) { - //exclude intents that are inherently supported by the - //attachpoint-type (binding-type / implementation-type) - List requiredIntents = new ArrayList(intents); - for ( Intent intent : requiredIntents ) { - if ( isProvidedInherently(attachPointType, intent) ) { - intents.remove(intent); - } - } - } - - - protected void computeIntentsForOperations(IntentAttachPoint intentAttachPoint) throws PolicyValidationException { - if ( intentAttachPoint instanceof OperationsConfigurator ) { - computeIntentsForOperations((OperationsConfigurator)intentAttachPoint, - intentAttachPoint, - intentAttachPoint.getRequiredIntents()); - } - } - - protected void computeIntentsForOperations(OperationsConfigurator opConfigurator, - IntentAttachPoint intentAttachPoint, - List parentIntents) throws PolicyValidationException { - IntentAttachPointType attachPointType = intentAttachPoint.getType(); - - boolean found = false; - for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) { - //expand profile intents specified on operations - expandProfileIntents(confOp.getRequiredIntents()); - - //validateIntents(confOp, attachPointType); - - //add intents specified for parent intent attach point (binding / implementation) - //wherever its not overridden in the operation - Intent tempIntent = null; - List attachPointOpIntents = new ArrayList(); - for (Intent anIntent : parentIntents) { - found = false; - - tempIntent = anIntent; - while ( tempIntent instanceof QualifiedIntent ) { - tempIntent = ((QualifiedIntent)tempIntent).getQualifiableIntent(); - } - - for ( Intent opIntent : confOp.getRequiredIntents() ) { - if ( opIntent.getName().getLocalPart().startsWith(tempIntent.getName().getLocalPart())) { - found = true; - break; - } - } - - if ( !found ) { - attachPointOpIntents.add(anIntent); - } - } - - confOp.getRequiredIntents().addAll(attachPointOpIntents); - - //remove duplicates and ... - //where qualified form of intent exists retain it and remove the qualifiable intent - filterDuplicatesAndQualifiableIntents(confOp); - - //exclude intents that are inherently supported by the parent - //attachpoint-type (binding-type / implementation-type) - if ( attachPointType != null ) { - List requiredIntents = new ArrayList(confOp.getRequiredIntents()); - for ( Intent intent : requiredIntents ) { - if ( isProvidedInherently(attachPointType, intent) ) { - confOp.getRequiredIntents().remove(intent); - } - } - } - } - } - - protected List computeInheritablePolicySets(List inheritablePolicySets, - List applicablePolicySets) - throws PolicyValidationException { - List validInheritablePolicySets = new ArrayList(); - for (PolicySet policySet : inheritablePolicySets) { - if ( !policySet.isUnresolved() ) { - if ( applicablePolicySets.contains(policySet) ) { - validInheritablePolicySets.add(policySet); - } - } else { - throw new PolicyValidationException("Policy Set '" + policySet.getName() - + "' is not defined in this domain "); - } - } - - return validInheritablePolicySets; - } - - protected void normalizePolicySets(PolicySetAttachPoint policySetAttachPoint ) { - //get rid of duplicate entries - HashMap policySetTable = new HashMap(); - for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) { - policySetTable.put(policySet.getName(), policySet); - } - - policySetAttachPoint.getPolicySets().clear(); - policySetAttachPoint.getPolicySets().addAll(policySetTable.values()); - - //expand profile intents - for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) { - expandProfileIntents(policySet.getProvidedIntents()); - } - } - - protected void computePolicySetsForOperations(List applicablePolicySets, - PolicySetAttachPoint policySetAttachPoint) - throws PolicyValidationException { - if ( policySetAttachPoint instanceof OperationsConfigurator ) { - computePolicySetsForOperations(applicablePolicySets, - (OperationsConfigurator)policySetAttachPoint, - policySetAttachPoint); - } - - } - - protected void computePolicySetsForOperations(List applicablePolicySets, - OperationsConfigurator opConfigurator, - PolicySetAttachPoint policySetAttachPoint) - throws PolicyValidationException { - //String appliesTo = null; - //String scdlFragment = ""; - HashMap policySetTable = new HashMap(); - IntentAttachPointType attachPointType = policySetAttachPoint.getType(); - - for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) { - //validate policysets specified for the attachPoint - for (PolicySet policySet : confOp.getPolicySets()) { - if ( !policySet.isUnresolved() ) { - //appliesTo = policySet.getAppliesTo(); - - //if (!PolicyValidationUtils.isPolicySetApplicable(scdlFragment, appliesTo, attachPointType)) { - if (!applicablePolicySets.contains(policySet)) { - throw new PolicyValidationException("Policy Set '" + policySet.getName() - + " specified for operation " + confOp.getName() - + "' does not constrain extension type " - + attachPointType.getName()); - - } - } else { - throw new PolicyValidationException("Policy Set '" + policySet.getName() - + " specified for operation " + confOp.getName() - + "' is not defined in this domain "); - } - } - - //get rid of duplicate entries - for ( PolicySet policySet : confOp.getPolicySets() ) { - policySetTable.put(policySet.getName(), policySet); - } - - confOp.getPolicySets().clear(); - confOp.getPolicySets().addAll(policySetTable.values()); - policySetTable.clear(); - - //expand profile intents - for ( PolicySet policySet : confOp.getPolicySets() ) { - expandProfileIntents(policySet.getProvidedIntents()); - } - } - } - - - protected void trimProvidedIntents(List requiredIntents, List policySets) { - for ( PolicySet policySet : policySets ) { - trimProvidedIntents(requiredIntents, policySet); - } - } - - protected void determineApplicableDomainPolicySets(List applicablePolicySets, - PolicySetAttachPoint policySetAttachPoint, - IntentAttachPointType intentAttachPointType) { - - if (policySetAttachPoint.getRequiredIntents().size() > 0) { - //since the set of applicable policysets for this attachpoint is known - //we only need to check in that list if there is a policyset that matches - for (PolicySet policySet : applicablePolicySets) { - int prevSize = policySetAttachPoint.getRequiredIntents().size(); - trimProvidedIntents(policySetAttachPoint.getRequiredIntents(), policySet); - // if any intent was trimmed off, then this policyset must - // be attached to the intent attachpoint's policyset - if (prevSize != policySetAttachPoint.getRequiredIntents().size()) { - policySetAttachPoint.getPolicySets().add(policySet); - } - } - } - } - - private List findAndExpandProfileIntents(List intents) { - List expandedIntents = new ArrayList(); - for ( Intent intent : intents ) { - if ( intent instanceof ProfileIntent ) { - ProfileIntent profileIntent = (ProfileIntent)intent; - List requiredIntents = profileIntent.getRequiredIntents(); - expandedIntents.addAll(findAndExpandProfileIntents(requiredIntents)); - } else { - expandedIntents.add(intent); - } - } - return expandedIntents; - } - - private boolean isProvidedInherently(IntentAttachPointType attachPointType, Intent intent) { - return ( attachPointType != null && - (( attachPointType.getAlwaysProvidedIntents() != null && - attachPointType.getAlwaysProvidedIntents().contains(intent) ) || - ( attachPointType.getMayProvideIntents() != null && - attachPointType.getMayProvideIntents().contains(intent) ) - ) ); - } - - private void trimProvidedIntents(List requiredIntents, PolicySet policySet) { - for ( Intent providedIntent : policySet.getProvidedIntents() ) { - if ( requiredIntents.contains(providedIntent) ) { - requiredIntents.remove(providedIntent); - } - } - - for ( Intent mappedIntent : policySet.getMappedPolicies().keySet() ) { - if ( requiredIntents.contains(mappedIntent) ) { - requiredIntents.remove(mappedIntent); - } - } - } - - private void filterDuplicatesAndQualifiableIntents(IntentAttachPoint intentAttachPoint) { - //remove duplicates - Map intentsTable = new HashMap(); - for ( Intent intent : intentAttachPoint.getRequiredIntents() ) { - intentsTable.put(intent.getName(), intent); - } - - //where qualified form of intent exists retain it and remove the qualifiable intent - Map intentsTableCopy = new HashMap(intentsTable); - //if qualified form of intent exists remove the unqualified form - for ( Intent intent : intentsTableCopy.values() ) { - if ( intent instanceof QualifiedIntent ) { - QualifiedIntent qualifiedIntent = (QualifiedIntent)intent; - if ( intentsTable.get(qualifiedIntent.getQualifiableIntent().getName()) != null ) { - intentsTable.remove(qualifiedIntent.getQualifiableIntent().getName()); - } - } - } - intentAttachPoint.getRequiredIntents().clear(); - intentAttachPoint.getRequiredIntents().addAll(intentsTable.values()); - } - - private void validateIntents(ConfiguredOperation confOp, IntentAttachPointType attachPointType) throws PolicyValidationException { - boolean found = false; - if ( attachPointType != null ) { - //validate intents specified against the parent (binding / implementation) - found = false; - for (Intent intent : confOp.getRequiredIntents()) { - if ( !intent.isUnresolved() ) { - for (QName constrained : intent.getConstrains()) { - if (PolicyValidationUtils.isConstrained(constrained, attachPointType)) { - found = true; - break; - } - } - - if (!found) { - throw new PolicyValidationException("Policy Intent '" + intent.getName() - + " specified for operation " + confOp.getName() - + "' does not constrain extension type " - + attachPointType.getName()); - } - } else { - throw new PolicyValidationException("Policy Intent '" + intent.getName() - + " specified for operation " + confOp.getName() - + "' is not defined in this domain "); - } - } - } - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java deleted file mode 100644 index e50d65f1d3..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.w3c.dom.Node; - -/** - * A simple print utility class to help print model instances. - * - * @version $Rev: 639224 $ $Date: 2008-03-20 02:37:04 -0700 (Thu, 20 Mar 2008) $ - */ -class PrintUtil { - private boolean useGetters = false; - private PrintWriter out; - private int indent; - - public PrintUtil(PrintWriter out, boolean useGetters) { - this.out = out; - this.useGetters = useGetters; - } - - public PrintUtil(OutputStream out) { - this.out = new PrintWriter(new OutputStreamWriter(out), true); - } - - void indent() { - for (int i = 0; i < indent; i++) { - out.print(" "); - } - } - - /** - * Print an object. - * - * @param object - */ - public void print(Object object) { - Set objects = new HashSet(); - print(object, objects); - } - - /** - * Print an object. - * - * @param object - */ - private void print(Object object, Set printed) { - if (object == null) { - return; - } - int id = System.identityHashCode(object); - if (printed.contains(id)) { - - // If we've already printed an object, print just it's HashCode - indent(); - out.println(object.getClass().getName() + "@" + id); - } else { - printed.add(id); - try { - - // Print the object class name - indent(); - out.println(object.getClass().getSimpleName() + " {"); - - // Get the object's properties - ValueAccessor accessor = useGetters ? new PropertyAccessor(object) : new FieldAccessor(object); - for (int i = 0; i < accessor.size(); i++) { - try { - - // Get the value of each property - Object value = accessor.getValue(i); - if (value != null) { - - // Convert array value into a list - if (value.getClass().isArray()) { - value = Arrays.asList((Object[])value); - } - - // Print elements in a list - if (value instanceof List) { - if (!((List)value).isEmpty()) { - indent++; - indent(); - out.println(accessor.getName(i) + "= ["); - - // Print each element, recursively - for (Object element : (List)value) { - indent++; - print(element, printed); - indent--; - } - indent(); - out.println(" ]"); - indent--; - } - } else { - Class valueClass = value.getClass(); - - // Print a primitive, java built in type or - // enum, using toString() - if (valueClass.isPrimitive() || valueClass.getName().startsWith("java.") - || valueClass.getName().startsWith("javax.") - || valueClass.isEnum()) { - if (!accessor.getName(i).equals("class")) { - if (!(Boolean.FALSE.equals(value))) { - indent++; - indent(); - out.println(accessor.getName(i) + "=" + value.toString()); - indent--; - } - } - } else if (value instanceof Node) { - indent++; - indent(); - out.println(accessor.getName(i) + "=" + value.toString()); - indent--; - } else { - - // Print an object, recursively - indent++; - indent(); - out.println(accessor.getName(i) + "= {"); - indent++; - print(value, printed); - indent--; - indent(); - out.println("}"); - indent--; - } - } - } - } catch (Exception e) { - } - } - indent(); - out.println("}"); - } catch (Exception e) { - indent(); - out.println(e); - } - } - } - - public static interface ValueAccessor { - int size(); - - String getName(int i); - - Object getValue(int i) throws Exception; - } - - /** - * Java field reflection based value accessor - */ - private static class FieldAccessor implements ValueAccessor { - - private Object object; - private List fields; - - public FieldAccessor(Object object) { - this.fields = getAllFields(object.getClass()); - this.object = object; - } - - public String getName(int i) { - return fields.get(i).getName(); - } - - public Object getValue(int i) throws Exception { - return fields.get(i).get(object); - } - - public int size() { - return fields.size(); - } - - } - - /** - * JavaBean-based value accessor - */ - private static class PropertyAccessor implements ValueAccessor { - - private Object object; - private PropertyDescriptor[] fields; - - public PropertyAccessor(Object object) throws IntrospectionException { - BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass()); - this.fields = beanInfo.getPropertyDescriptors(); - this.object = object; - } - - public String getName(int i) { - return fields[i].getName(); - } - - public Object getValue(int i) throws Exception { - Method getter = fields[i].getReadMethod(); - if (getter != null) { - return getter.invoke(object); - } - return null; - } - - public int size() { - return fields.length; - } - - } - - /** - * Returns a collection of fields declared by a class - * or one of its supertypes - */ - private static List getAllFields(Class clazz) { - return getAllFields(clazz, new ArrayList()); - } - - /** - * Recursively evaluates the type hierarchy to return all fields - */ - private static List getAllFields(Class clazz, List fields) { - if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) { - return fields; - } - fields = getAllFields(clazz.getSuperclass(), fields); - Field[] declaredFields = clazz.getDeclaredFields(); - for (final Field field : declaredFields) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - field.setAccessible(true); // ignore Java accessibility - return null; - } - }); - fields.add(field); - } - return fields; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java deleted file mode 100644 index 32a39fbb5f..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import org.apache.tuscany.sca.assembly.builder.Problem; - -/** - * Reports a composite assembly problem. - * - * @version $Rev: 589508 $ $Date: 2007-10-28 23:23:26 -0700 (Sun, 28 Oct 2007) $ - */ -public class ProblemImpl implements Problem { - - private String message; - private Severity severity; - private Object model; - private Object resource; - private Exception cause; - - /** - * Constructs a new problem. - * - * @param severity - * @param message - * @param model - */ - public ProblemImpl(Severity severity, String message, Object model) { - this.severity = severity; - this.message = message; - this.model = model; - } - - /** - * Constructs a new problem. - * - * @param severity - * @param message - * @param model - * @param resource - */ - public ProblemImpl(Severity severity, String message, Object model, Object resource) { - this.severity = severity; - this.message = message; - this.model = model; - this.resource = resource; - } - - /** - * Constructs a new problem. - * - * @param severity - * @param message - * @param cause - */ - public ProblemImpl(Severity severity, String message, Exception cause) { - this.severity = severity; - this.message = message; - this.cause = cause; - } - - public Severity getSeverity() { - return severity; - } - - public String getMessage() { - return message; - } - - public Object getModel() { - return model; - } - - public Object getResource() { - return resource; - } - - public Exception getCause() { - return cause; - } - - @Override - public String toString() { - StringBuffer sb = new StringBuffer(); - if (message != null) { - sb.append(message); - } - if (resource != null) { - if (sb.length() != 0) { - sb.append(" - "); - } - sb.append(resource.toString()); - } - return sb.toString(); - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java deleted file mode 100644 index 396cf011aa..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.net.URLConnection; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.namespace.NamespaceContext; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXSource; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.InputSource; - -import sun.reflect.generics.reflectiveObjects.NotImplementedException; - -/** - * Utility class to deal with processing of component properties that are taking values from the parent - * composite's properties or an external file. - */ -public class PropertyUtil { - //private static final XPathFactory XPATH_FACTORY = XPathFactory.newInstance(); - private static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); - //private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance(); - - static private Document evaluate(Document node, XPathExpression expression) - throws XPathExpressionException, ParserConfigurationException { - - Node value = node.getDocumentElement(); - Node result = (Node)expression.evaluate(value, XPathConstants.NODE); - if (result == null) { - return null; - } - - // TODO: How to wrap the result into a Document? - Document document = DOC_BUILDER_FACTORY.newDocumentBuilder().newDocument(); - if (result instanceof Document) { - return (Document)result; - } else { - //Element root = document.createElementNS(null, "value"); - //document.appendChild(root); - document.appendChild(document.importNode(result, true)); - return document; - } - } - - static private Document loadFromFile(String file) throws MalformedURLException, IOException, - TransformerException, ParserConfigurationException { - URI uri = URI.create(file); - // URI resolution for relative URIs is done when the composite is resolved. - URL url = uri.toURL(); - URLConnection connection = url.openConnection(); - connection.setUseCaches(false); - InputStream is = null; - try { - is = connection.getInputStream(); - - Source streamSource = new SAXSource(new InputSource(is)); - DOMResult result = new DOMResult(); - //javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer(); - //transformer.transform(streamSource, result); - throw new NotImplementedException(); - - //return (Document)result.getNode(); - } finally { - if (is != null) { - is.close(); - } - } - } - - static void sourceComponentProperties(Map compositeProperties, - Component componentDefinition) throws CompositeBuilderException, - ParserConfigurationException, - XPathExpressionException, - TransformerException, - IOException { - - List componentProperties = componentDefinition.getProperties(); - for (ComponentProperty aProperty : componentProperties) { - String source = aProperty.getSource(); - String file = aProperty.getFile(); - if (source != null) { - // $/... - int index = source.indexOf('/'); - if (index == -1) { - // Tolerating $prop - source = source + "/"; - index = source.length() - 1; - } - if (source.charAt(0) == '$') { - String name = source.substring(1, index); - Property compositeProp = compositeProperties.get(name); - if (compositeProp == null) { - throw new CompositeBuilderException("The 'source' cannot be resolved to a composite property: " + source); - } - - Document compositePropDefValues = (Document)compositeProp.getValue(); - - // FIXME: How to deal with namespaces? - Document node = evaluate(compositePropDefValues, aProperty.getSourceXPathExpression()); - - if (node != null) { - aProperty.setValue(node); - } - } else { - throw new CompositeBuilderException("The 'source' has an invalid value: " + source); - } - } else if (file != null) { - aProperty.setValue(loadFromFile(aProperty.getFile())); - - } - } - } - - private static class DOMNamespaceContext implements NamespaceContext { - private Node node; - - /** - * @param node - */ - public DOMNamespaceContext(Node node) { - super(); - this.node = node; - } - - public String getNamespaceURI(String prefix) { - if (prefix == null) { - throw new IllegalArgumentException("Prefix is null"); - } else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) { - return XMLConstants.XML_NS_URI; - } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) { - return XMLConstants.XMLNS_ATTRIBUTE_NS_URI; - } - String ns = node.lookupNamespaceURI(prefix); - return ns == null ? XMLConstants.NULL_NS_URI : ns; - } - - public String getPrefix(String namespaceURI) { - if (namespaceURI == null) { - throw new IllegalArgumentException("Namespace URI is null"); - } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) { - return XMLConstants.XML_NS_PREFIX; - } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - return XMLConstants.XMLNS_ATTRIBUTE; - } - return node.lookupPrefix(namespaceURI); - } - - public Iterator getPrefixes(String namespaceURI) { - // Not implemented - if (namespaceURI == null) { - throw new IllegalArgumentException("Namespace URI is null"); - } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) { - return Arrays.asList(XMLConstants.XML_NS_PREFIX).iterator(); - } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - return Arrays.asList(XMLConstants.XMLNS_ATTRIBUTE).iterator(); - } - String prefix = getPrefix(namespaceURI); - if (prefix == null) { - return Collections.emptyList().iterator(); - } - return Arrays.asList(prefix).iterator(); - } - - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java deleted file mode 100644 index d2eeb51ee7..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Multiplicity; -import org.apache.tuscany.sca.assembly.OptimizableBinding; - -/** - * This class encapsulates utility methods to deal with reference definitions - * - */ -class ReferenceUtil { - static boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) { - if (definedMul != overridenMul) { - switch (definedMul) { - case ZERO_N: - return overridenMul == Multiplicity.ZERO_ONE; - case ONE_N: - return overridenMul == Multiplicity.ONE_ONE; - default: - return false; - } - } else { - return true; - } - } - - static boolean validateMultiplicityAndTargets(Multiplicity multiplicity, - List targets, List bindings) { - - // Count targets - int count = targets.size(); - - //FIXME workaround, this validation is sometimes invoked too early - // before we get a chance to init the multiplicity attribute - if (multiplicity == null) { - return true; - } - - switch (multiplicity) { - case ZERO_N: - break; - case ZERO_ONE: - if (count > 1) { - return false; - } - break; - case ONE_ONE: - if (count != 1) { - if (count == 0) { - for (Binding binding: bindings) { - if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) { - return true; - } - } - } - return false; - } - break; - case ONE_N: - if (count < 1) { - if (count == 0) { - for (Binding binding: bindings) { - if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) { - return true; - } - } - } - return false; - } - break; - } - return true; - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java deleted file mode 100644 index 75cb91189b..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AbstractProperty; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; - -/** - * Represents an abstract property. - * - * @version $Rev: 592745 $ $Date: 2007-11-07 05:36:22 -0800 (Wed, 07 Nov 2007) $ - */ -public class AbstractPropertyImpl extends ExtensibleImpl implements AbstractProperty { - private Object value; - private String name; - private QName xsdType; - private QName xsdElement; - private boolean many; - private boolean mustSupply; - private List requiredIntents = new ArrayList(); - - - public List getRequiredIntents() { - return requiredIntents; - } - - /** - * Constructs a new abstract property. - */ - protected AbstractPropertyImpl() { - } - - public Object getValue() { - return value; - } - - public String getName() { - return name; - } - - public QName getXSDElement() { - return xsdElement; - } - - public QName getXSDType() { - return xsdType; - } - - public boolean isMany() { - return many; - } - - public boolean isMustSupply() { - return mustSupply; - } - - public void setValue(Object defaultValue) { - this.value = defaultValue; - } - - public void setMany(boolean many) { - this.many = many; - } - - public void setMustSupply(boolean mustSupply) { - this.mustSupply = mustSupply; - } - - public void setName(String name) { - this.name = name; - } - - public void setXSDElement(QName element) { - this.xsdElement = element; - } - - public void setXSDType(QName type) { - this.xsdType = type; - } - - public IntentAttachPointType getType() { - return null; - } - - public void setType(IntentAttachPointType type) { - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java deleted file mode 100644 index 16dc8394ce..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import org.apache.tuscany.sca.assembly.AbstractReference; -import org.apache.tuscany.sca.assembly.Multiplicity; - -/** - * Represents an abstract reference - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public class AbstractReferenceImpl extends ContractImpl implements AbstractReference { - private Multiplicity multiplicity = Multiplicity.ONE_ONE; - - /** - * Constructs a new abstract reference. - */ - protected AbstractReferenceImpl() { - } - - public Multiplicity getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(Multiplicity multiplicity) { - this.multiplicity = multiplicity; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java deleted file mode 100644 index ba58b50748..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import org.apache.tuscany.sca.assembly.AbstractService; - -/** - * Represents an abstract service - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public class AbstractServiceImpl extends ContractImpl implements AbstractService { - - /** - * Constructs a new abstract service. - */ - protected AbstractServiceImpl() { - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java deleted file mode 100644 index 9214df05a9..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import org.apache.tuscany.sca.assembly.AbstractProperty; -import org.apache.tuscany.sca.assembly.AbstractReference; -import org.apache.tuscany.sca.assembly.AbstractService; -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Callback; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.Wire; - -/** - * A factory for the assembly model. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public abstract class AssemblyFactoryImpl implements AssemblyFactory { - - public AbstractProperty createAbstractProperty() { - return new AbstractPropertyImpl(); - } - - public AbstractReference createAbstractReference() { - return new AbstractReferenceImpl(); - } - - public AbstractService createAbstractService() { - return new AbstractServiceImpl(); - } - - public Callback createCallback() { - return new CallbackImpl(); - } - - public Component createComponent() { - return new ComponentImpl(); - } - - public ComponentProperty createComponentProperty() { - return new ComponentPropertyImpl(); - } - - public ComponentReference createComponentReference() { - return new ComponentReferenceImpl(); - } - - public ComponentService createComponentService() { - return new ComponentServiceImpl(); - } - - public ComponentType createComponentType() { - return new ComponentTypeImpl(); - } - - public Composite createComposite() { - return new CompositeImpl(); - } - - public CompositeReference createCompositeReference() { - return new CompositeReferenceImpl(); - } - - public CompositeService createCompositeService() { - return new CompositeServiceImpl(); - } - - public ConstrainingType createConstrainingType() { - return new ConstrainingTypeImpl(); - } - - public Property createProperty() { - return new PropertyImpl(); - } - - public Reference createReference() { - return new ReferenceImpl(); - } - - public Service createService() { - return new ServiceImpl(); - } - - public Wire createWire() { - return new WireImpl(); - } - - public ConfiguredOperation createConfiguredOperation() { - return new ConfiguredOperationImpl(); - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java deleted file mode 100644 index f51162598b..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import org.apache.tuscany.sca.assembly.Base; - -/** - * Convenience base class for assembly model objects. - * - * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $ - */ -public abstract class BaseImpl implements Base { - private boolean unresolved; - - /** - * Constructs a new base model object. - */ - protected BaseImpl() { - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean undefined) { - this.unresolved = undefined; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java deleted file mode 100644 index c8af31eee8..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Callback; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a reference. - * - * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $ - */ -public class CallbackImpl extends ExtensibleImpl implements Callback { - private List bindings = new ArrayList(); - private List requiredIntents = new ArrayList(); - private List policySets = new ArrayList(); - private List configuredOperations = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - protected CallbackImpl() { - } - - public List getBindings() { - return bindings; - } - - public IntentAttachPointType getType() { - return null; - } - - public void setType(IntentAttachPointType type) { - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - } - - public List getConfiguredOperations() { - return configuredOperations; - } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java deleted file mode 100644 index e30ff1e725..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a component. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public class ComponentImpl extends ExtensibleImpl implements Component, Cloneable, OperationsConfigurator { - private ConstrainingType constrainingType; - private Implementation implementation; - private String name; - private String uri; - private List properties = new ArrayList(); - private List references = new ArrayList(); - private List services = new ArrayList(); - private List requiredIntents = new ArrayList(); - private List policySets = new ArrayList(); - private Boolean autowire; - private IntentAttachPointType type; - private List configuredImplOperations = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - /** - * Constructs a new component. - */ - protected ComponentImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - ComponentImpl clone = (ComponentImpl)super.clone(); - - clone.properties = new ArrayList(); - for (ComponentProperty property : getProperties()) { - clone.properties.add((ComponentProperty)property.clone()); - } - clone.references = new ArrayList(); - for (ComponentReference reference : getReferences()) { - clone.references.add((ComponentReference)reference.clone()); - } - clone.services = new ArrayList(); - for (ComponentService service : getServices()) { - clone.services.add((ComponentService)service.clone()); - } - return clone; - } - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public ConstrainingType getConstrainingType() { - return constrainingType; - } - - public Implementation getImplementation() { - return implementation; - } - - public String getName() { - return name; - } - - public List getProperties() { - return properties; - } - - public List getReferences() { - return references; - } - - public List getServices() { - return services; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - this.constrainingType = constrainingType; - } - - public void setImplementation(Implementation implementation) { - this.implementation = implementation; - } - - public void setName(String name) { - this.name = name; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public List getPolicySets() { - return policySets; - } - - public boolean isAutowire() { - return (autowire == null) ? false : autowire.booleanValue(); - } - - public void setAutowire(Boolean autowire) { - this.autowire = autowire; - } - - public Boolean getAutowire() { - return autowire; - } - - public IntentAttachPointType getType() { - return type; - } - - public void setType(IntentAttachPointType type) { - this.type = type; - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - - } - - public List getConfiguredOperations() { - return configuredImplOperations; - } - - public void setConfiguredOperations(List configuredOperations) { - this.configuredImplOperations = configuredOperations; - } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java deleted file mode 100644 index e5aa4e2db7..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import javax.xml.xpath.XPathExpression; - -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.Property; - -/** - * Represents a component property. - * - * @version $Rev: 636985 $ $Date: 2008-03-13 20:48:47 -0700 (Thu, 13 Mar 2008) $ - */ -public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty, Cloneable { - private String file; - private Property property; - private String source; - private XPathExpression sourceXPathExpression; - - /** - * Constructs a new component property. - */ - protected ComponentPropertyImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - // FIXME getValue should not delegate to property.getValue() - // Doing this violates the setValue/getValue semantics, as you - // can call setValue() then get a different value from getValue() - @Override - public Object getValue() { - if (super.getValue() == null && property != null) { - return property.getValue(); - } else { - return super.getValue(); - } - } - - public String getFile() { - return file; - } - - public Property getProperty() { - return property; - } - - public String getSource() { - return source; - } - - public void setFile(String file) { - this.file = file; - } - - public void setProperty(Property property) { - this.property = property; - } - - public void setSource(String source) { - this.source = source; - } - - public XPathExpression getSourceXPathExpression() { - return sourceXPathExpression; - } - - public void setSourceXPathExpression(XPathExpression sourceXPathExpression) { - this.sourceXPathExpression = sourceXPathExpression; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java deleted file mode 100644 index 799e1c2e23..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.Reference; - -/** - * Represents a component reference - * - * @version $Rev: 571694 $ $Date: 2007-08-31 22:24:11 -0700 (Fri, 31 Aug 2007) $ - */ -public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable { - private Reference reference; - private Boolean autowire; - private List promotedAs = new ArrayList(); - private ComponentService callbackService; - - /** - * Constructs a new component reference. - */ - protected ComponentReferenceImpl() { - // Set multiplicity to null so that by default it'll inherit from the Reference - setMultiplicity(null); - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public Reference getReference() { - return reference; - } - - public void setReference(Reference reference) { - this.reference = reference; - } - - public boolean isAutowire() { - return (autowire == null) ? false : autowire.booleanValue(); - } - - public void setAutowire(Boolean autowire) { - this.autowire = autowire; - } - - public Boolean getAutowire() { - return autowire; - } - - public List promotedAs() { - return promotedAs; - } - - public ComponentService getCallbackService() { - return callbackService; - } - - public void setCallbackService(ComponentService callbackService) { - this.callbackService = callbackService; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java deleted file mode 100644 index 7432b655e9..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.Service; - -/** - * Represents a component service - * - * @version $Rev: 564107 $ $Date: 2007-08-08 23:05:29 -0700 (Wed, 08 Aug 2007) $ - */ -public class ComponentServiceImpl extends ServiceImpl implements ComponentService, Cloneable { - private Service service; - private List promotedAs = new ArrayList(); - private ComponentReference callbackReference; - - /** - * Constructs a new component service. - */ - protected ComponentServiceImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public Service getService() { - return service; - } - - public void setService(Service service) { - this.service = service; - } - - public List promotedAs() { - return promotedAs; - } - - public ComponentReference getCallbackReference() { - return callbackReference; - } - - public void setCallbackReference(ComponentReference callbackReference) { - this.callbackReference = callbackReference; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java deleted file mode 100644 index a292857cd2..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; - -/** - * Represents a component type. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType, Cloneable { - private String uri; - private ConstrainingType constrainingType; - private List properties = new ArrayList(); - private List references = new ArrayList(); - private List services = new ArrayList(); - /** - * Constructs a new component type. - */ - protected ComponentTypeImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - ComponentTypeImpl clone = (ComponentTypeImpl)super.clone(); - - clone.services = new ArrayList(); - for (Service service : getServices()) { - clone.services.add((Service)service.clone()); - } - clone.references = new ArrayList(); - for (Reference reference : getReferences()) { - clone.references.add((Reference)reference.clone()); - } - clone.properties = new ArrayList(); - for (Property property : getProperties()) { - clone.properties.add((Property)property.clone()); - } - return clone; - } - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public ConstrainingType getConstrainingType() { - return constrainingType; - } - - public List getProperties() { - return properties; - } - - public List getReferences() { - return references; - } - - public List getServices() { - return services; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - this.constrainingType = constrainingType; - } - - @Override - public int hashCode() { - return String.valueOf(getURI()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } else { - if (obj instanceof ComponentType) { - if (getURI() != null) { - return getURI().equals(((ComponentType)obj).getURI()); - } else { - return ((ComponentType)obj).getURI() == null; - } - } else { - return false; - } - } - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java deleted file mode 100644 index 26829aa172..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.Wire; - -public class CompositeImpl extends ImplementationImpl implements Composite, Cloneable { - private List components = new ArrayList(); - private List includes = new ArrayList(); - private QName name; - private List wires = new ArrayList(); - private Boolean autowire; - private boolean local = true; - - /** - * Constructs a new composite. - */ - protected CompositeImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - CompositeImpl clone = (CompositeImpl)super.clone(); - - clone.components = new ArrayList(); - for (Component component : getComponents()) { - Component clonedComponent = (Component)component.clone(); - for (Service service : clone.getServices()) { - CompositeService compositeService = (CompositeService)service; - // Force the promoted component/service to be rebuilt against the clone - if (compositeService.getPromotedComponent() != null) { - compositeService.getPromotedComponent().setUnresolved(true); - } - if (compositeService.getPromotedService() != null) { - compositeService.getPromotedService().setUnresolved(true); - } - } - for (Reference reference : clone.getReferences()) { - CompositeReference compositeReference = (CompositeReference)reference; - for (ComponentReference ref : compositeReference.getPromotedReferences()) { - // Force the promoted reference to be rebuilt against the clone - ref.setUnresolved(true); - } - } - - clone.components.add(clonedComponent); - } - clone.wires = new ArrayList(); - for (Wire wire : getWires()) { - clone.wires.add((Wire)wire.clone()); - } - return clone; - } - - public List getComponents() { - return components; - } - - public List getIncludes() { - return includes; - } - - public QName getName() { - return name; - } - - public List getWires() { - return wires; - } - - public boolean isLocal() { - return local; - } - - public void setLocal(boolean local) { - this.local = local; - } - - public boolean isAutowire() { - return (autowire == null) ? false : autowire.booleanValue(); - } - - public void setAutowire(Boolean autowire) { - this.autowire = autowire; - } - - public Boolean getAutowire() { - return autowire; - } - - public void setName(QName name) { - this.name = name; - } - - @Override - public int hashCode() { - return String.valueOf(getName()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } else if (obj instanceof Composite) { - if (getName() != null) { - return getName().equals(((Composite)obj).getName()); - } else { - return ((Composite)obj).getName() == null; - } - } else { - return false; - } - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java deleted file mode 100644 index 5d9c00ea82..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.CompositeReference; - -/** - * Represents a composite reference. - * - * @version $Rev: 537384 $ $Date: 2007-05-12 04:02:56 -0700 (Sat, 12 May 2007) $ - */ -public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference, Cloneable { - private List promotedReferences = new ArrayList(); - - /** - * Constructs a new composite reference. - */ - protected CompositeReferenceImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public List getPromotedReferences() { - return promotedReferences; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java deleted file mode 100644 index ad91c5ffa4..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.CompositeService; - -/** - * Represents a composite service - * - * @version $Rev: 566036 $ $Date: 2007-08-14 23:16:47 -0700 (Tue, 14 Aug 2007) $ - */ -public class CompositeServiceImpl extends ServiceImpl implements CompositeService, Cloneable { - private ComponentService promotedService; - private Component promotedComponent; - - /** - * Constructs a new composite service. - */ - protected CompositeServiceImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public ComponentService getPromotedService() { - return promotedService; - } - - public void setPromotedService(ComponentService promotedService) { - this.promotedService = promotedService; - } - - public Component getPromotedComponent() { - return promotedComponent; - } - - public void setPromotedComponent(Component promotedComponent) { - this.promotedComponent = promotedComponent; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java deleted file mode 100644 index 3bc3dfc6af..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents an Operation. - */ -public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOperation { - private List policySets = new ArrayList(); - private List requiredIntents = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - - private String name; - private String contractName; - - /** - * Constructs a new Operation. - */ - protected ConfiguredOperationImpl() { - } - - public List getPolicySets() { - return policySets; - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - } - - public String getContractName() { - return contractName; - } - - public void setContractName(String contractName) { - this.contractName = contractName; - } - - public IntentAttachPointType getType() { - return null; - } - - public void setType(IntentAttachPointType type) { - } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java deleted file mode 100644 index 5cf062821a..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AbstractProperty; -import org.apache.tuscany.sca.assembly.AbstractReference; -import org.apache.tuscany.sca.assembly.AbstractService; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; - -/** - * Represents a constraining type. - * - * @version $Rev: 592745 $ $Date: 2007-11-07 05:36:22 -0800 (Wed, 07 Nov 2007) $ - */ -public class ConstrainingTypeImpl extends ExtensibleImpl implements ConstrainingType { - private QName name; - private List properties = new ArrayList(); - private List references = new ArrayList(); - private List services = new ArrayList(); - private List requiredIntents = new ArrayList(); - - /** - * Constructs a new ConstrainingType - */ - protected ConstrainingTypeImpl() { - } - - public QName getName() { - return name; - } - - public void setName(QName name) { - this.name = name; - } - - public List getProperties() { - return properties; - } - - public List getReferences() { - return references; - } - - public List getServices() { - return services; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - @Override - public int hashCode() { - return String.valueOf(getName()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } else if (obj instanceof ConstrainingType) { - if (getName() != null) { - return getName().equals(((ConstrainingType)obj).getName()); - } else { - return ((ConstrainingType)obj).getName() == null; - } - } else { - return false; - } - } - - public IntentAttachPointType getType() { - return null; - } - - public void setType(IntentAttachPointType type) { - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java deleted file mode 100644 index 874efe45da..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.AbstractContract; -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; - -public class ContractImpl extends ExtensibleImpl implements AbstractContract { - private InterfaceContract interfaceContract; - private String name; - private List requiredIntents = new ArrayList(); - private List configuredOperations = new ArrayList(); - - private boolean isCallback = false; - - /** - * Constructs a new contract. - */ - protected ContractImpl() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public InterfaceContract getInterfaceContract() { - return interfaceContract; - } - - public void setInterfaceContract(InterfaceContract interfaceContract) { - this.interfaceContract = interfaceContract; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public boolean isCallback() { - return isCallback; - } - - public void setIsCallback(boolean isCallback) { - this.isCallback = isCallback; - } - - public IntentAttachPointType getType() { - return null; - } - - public void setType(IntentAttachPointType type) { - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - } - - public List getConfiguredOperations() { - return configuredOperations; - } - - public void setConfiguredOperations(List configuredOperations) { - this.configuredOperations = configuredOperations; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java deleted file mode 100644 index 38b6cd7ce3..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Extensible; - -/** - * Convenience base class for extensible assembly model objects. - * - * @version $Rev: 568902 $ $Date: 2007-08-23 02:32:29 -0700 (Thu, 23 Aug 2007) $ - */ -public abstract class ExtensibleImpl extends BaseImpl implements Extensible { - private List extensions = new ArrayList(); - - /** - * Constructs a new base model object. - */ - protected ExtensibleImpl() { - } - - public List getExtensions() { - return extensions; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java deleted file mode 100644 index 81bed59e1a..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -/** - * Base implementation class of Implementation model interface - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public abstract class ImplementationImpl extends ComponentTypeImpl implements Implementation, PolicySetAttachPoint, - OperationsConfigurator { - - private List applicablePolicySets = new ArrayList(); - private List configuredOperations = new ArrayList(); - private IntentAttachPointType type; - private List policySets = new ArrayList(); - private List requiredIntents = new ArrayList(); - - protected ImplementationImpl() { - super(); - } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - public List getConfiguredOperations() { - return configuredOperations; - } - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public IntentAttachPointType getType() { - return type; - } - - public void setType(IntentAttachPointType type) { - this.type = type; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java deleted file mode 100644 index 73604736a5..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a property. - * - * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $ - */ -public class PropertyImpl extends AbstractPropertyImpl implements Property, Cloneable { - private List policySets = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - - /** - * Constructs a new property. - */ - protected PropertyImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public List getPolicySets() { - return policySets; - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java deleted file mode 100644 index 186e98cd5e..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Callback; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a reference. - * - * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $ - */ -public class ReferenceImpl extends AbstractReferenceImpl implements Reference, Cloneable { - private List bindings = new ArrayList(); - private boolean wiredByImpl; - private List policySets = new ArrayList(); - private List targets = new ArrayList(); - private Callback callback; - private List applicablePolicySets = new ArrayList(); - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - /** - * Constructs a new reference. - */ - protected ReferenceImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - ReferenceImpl clone = (ReferenceImpl)super.clone(); - clone.bindings = new ArrayList(); - clone.bindings.addAll(getBindings()); - clone.targets = new ArrayList(); - clone.targets.addAll(getTargets()); - return clone; - } - - public List getBindings() { - return bindings; - } - - public B getBinding(Class bindingClass) { - for (Binding binding : bindings) { - if (bindingClass.isInstance(binding)) { - return bindingClass.cast(binding); - } - } - return null; - } - - public B getCallbackBinding(Class bindingClass) { - if (callback != null) { - for (Binding binding : callback.getBindings()) { - if (bindingClass.isInstance(binding)) { - return bindingClass.cast(binding); - } - } - } - return null; - } - - public boolean isWiredByImpl() { - return wiredByImpl; - } - - public void setWiredByImpl(boolean wiredByImpl) { - this.wiredByImpl = wiredByImpl; - } - - public List getPolicySets() { - return policySets; - } - - public List getTargets() { - return targets; - } - - public Callback getCallback() { - return callback; - } - - public void setCallback(Callback callback) { - this.callback = callback; - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java deleted file mode 100644 index b01bd42a96..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Callback; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a reference. - * - * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $ - */ -public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneable { - private List bindings = new ArrayList(); - private List policySets = new ArrayList(); - private Callback callback; - private List applicablePolicySets = new ArrayList(); - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - /** - * Constructs a new service. - */ - protected ServiceImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - ServiceImpl clone = (ServiceImpl)super.clone(); - clone.bindings = new ArrayList(); - clone.bindings.addAll(getBindings()); - return clone; - } - - public List getBindings() { - return bindings; - } - - public B getBinding(Class bindingClass) { - for (Binding binding : bindings) { - if (bindingClass.isInstance(binding)) { - return bindingClass.cast(binding); - } - } - return null; - } - - public B getCallbackBinding(Class bindingClass) { - if (callback != null) { - for (Binding binding : callback.getBindings()) { - if (bindingClass.isInstance(binding)) { - return bindingClass.cast(binding); - } - } - } - return null; - } - - public List getPolicySets() { - return policySets; - } - - public Callback getCallback() { - return callback; - } - - public void setCallback(Callback callback) { - this.callback = callback; - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - } - -} diff --git a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java deleted file mode 100644 index 2c8f426f82..0000000000 --- a/branches/sca-android/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Wire; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a wire - * - * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $ - */ -public class WireImpl extends ExtensibleImpl implements Wire, Cloneable { - private ComponentReference source; - private ComponentService target; - private List requiredIntents = new ArrayList(); - private List policySets = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - /** - * Constructs a new wire. - */ - protected WireImpl() { - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public ComponentReference getSource() { - return source; - } - - public ComponentService getTarget() { - return target; - } - - public void setSource(ComponentReference source) { - this.source = source; - } - - public void setTarget(ComponentService target) { - this.target = target; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public List getPolicySets() { - return policySets; - } - - public IntentAttachPointType getType() { - return null; - } - - public void setType(IntentAttachPointType type) { - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - } -} diff --git a/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory b/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory deleted file mode 100644 index 859c4bde4b..0000000000 --- a/branches/sca-android/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -org.apache.tuscany.sca.assembly.DefaultAssemblyFactory \ No newline at end of file diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java deleted file mode 100644 index 2c8bf309df..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - - -/** - * Test building of assembly model instances using the assembly factory. - * - * @version $Rev: 567542 $ $Date: 2007-08-19 22:13:29 -0700 (Sun, 19 Aug 2007) $ - */ -public class AssemblyFactoryTestCase extends TestCase { - - AssemblyFactory factory; - - @Override - public void setUp() throws Exception { - factory = new DefaultAssemblyFactory(); - } - - @Override - public void tearDown() throws Exception { - factory = null; - } - - public void testCreateComponent() { - createComponent("AccountServiceComponent1"); - } - - public void testCreateComponentType() { - createComponentType(); - } - - public void testCreateComposite() { - createComposite(); - } - - public void testCreateConstrainingType() { - createConstrainingType(); - } - - /** - * Create a composite - */ - Composite createComposite() { - Composite c = factory.createComposite(); - - Component c1 = createComponent("AccountServiceComponent1"); - c.getComponents().add(c1); - Component c2 = createComponent("AccountServiceComponent2"); - c.getComponents().add(c2); - - Wire w = factory.createWire(); - w.setSource(c1.getReferences().get(0)); - w.setTarget(c2.getServices().get(0)); - c.getWires().add(w); - - CompositeService cs = factory.createCompositeService(); - cs.setName("AccountService"); - cs.setPromotedService(c1.getServices().get(0)); - cs.setInterfaceContract(new TestInterfaceContract(factory)); - c.getServices().add(cs); - cs.getBindings().add(new TestBinding(factory)); - - CompositeReference cr = factory.createCompositeReference(); - cr.setName("StockQuoteService"); - cr.getPromotedReferences().add(c2.getReferences().get(1)); - cr.setInterfaceContract(new TestInterfaceContract(factory)); - c.getReferences().add(cr); - cr.getBindings().add(new TestBinding(factory)); - - return c; - } - - /** - * Create a new component - */ - Component createComponent(String name) { - Component c = factory.createComponent(); - c.setName(name); - - ConstrainingType constraint = createConstrainingType(); - c.setConstrainingType(constraint); - - Implementation i = new TestImplementation(factory); - c.setImplementation(i); - - ComponentProperty p = factory.createComponentProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - p.setProperty(i.getProperties().get(0)); - c.getProperties().add(p); - - ComponentReference ref1 = factory.createComponentReference(); - ref1.setName("accountDataService"); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setReference(i.getReferences().get(0)); - c.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - ComponentReference ref2 = factory.createComponentReference(); - ref2.setName("stockQuoteService"); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setReference(i.getReferences().get(1)); - c.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - ComponentService s = factory.createComponentService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - s.setService(i.getServices().get(0)); - c.getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - return c; - } - - /** - * Create a new component type - * - * @return - */ - ComponentType createComponentType() { - ComponentType ctype = factory.createComponentType(); - - Property p = factory.createProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - Reference ref1 = factory.createReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - Reference ref2 = factory.createReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - Service s = factory.createService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - ctype.getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - return ctype; - } - - /** - * Create a new constraining type - * - * @return - */ - ConstrainingType createConstrainingType() { - ConstrainingType ctype = factory.createConstrainingType(); - - AbstractProperty p = factory.createAbstractProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - AbstractReference ref1 = factory.createAbstractReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - - AbstractReference ref2 = factory.createAbstractReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - - AbstractService s = factory.createAbstractService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - ctype.getServices().add(s); - - return ctype; - } - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java deleted file mode 100644 index a6b594f311..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * A test interface model. - * - * @version $Rev: 604880 $ $Date: 2007-12-17 06:30:07 -0800 (Mon, 17 Dec 2007) $ - */ -public class TestBinding implements Binding { - public TestBinding(AssemblyFactory factory) { - } - - public String getName() { - return null; - } - - public String getURI() { - return "http://test"; - } - - public void setName(String name) { - } - - public void setURI(String uri) { - } - - public void setUnresolved(boolean unresolved) { - } - - public boolean isUnresolved() { - return false; - } - - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java deleted file mode 100644 index 698623ee1a..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; - -/** - * A test component implementation model. - * - * @version $Rev: 637192 $ $Date: 2008-03-14 11:13:01 -0700 (Fri, 14 Mar 2008) $ - */ -public class TestImplementation extends ImplementationImpl implements Implementation { - public TestImplementation(AssemblyFactory factory) { - - Property p = factory.createProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - getProperties().add(p); - - Reference ref1 = factory.createReference(); - ref1.setName("accountDataService"); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - Reference ref2 = factory.createReference(); - ref2.setName("stockQuoteService"); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - Service s = factory.createService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - } - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java deleted file mode 100644 index 8e82efd04b..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl; - -/** - * A test interface model. - * - * @version $Rev: 537744 $ $Date: 2007-05-14 01:00:18 -0700 (Mon, 14 May 2007) $ - */ -public class TestInterface extends InterfaceImpl implements Interface { - - public TestInterface(AssemblyFactory factory) { - - setRemotable(true); - - Operation operation = new TestOperation(); - operation.setName("test"); - getOperations().add(operation); - - } - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java deleted file mode 100644 index e020bdbc9a..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; - -/** - * A test interface contract model. - * - * @version $Rev: 537744 $ $Date: 2007-05-14 01:00:18 -0700 (Mon, 14 May 2007) $ - */ -public class TestInterfaceContract extends InterfaceContractImpl implements InterfaceContract { - - public TestInterfaceContract(AssemblyFactory factory) { - - TestInterface testInterface = new TestInterface(factory); - setInterface(testInterface); - - TestInterface testCallbackInterface = new TestInterface(factory); - setCallbackInterface(testCallbackInterface); - - } - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java deleted file mode 100644 index 996eb40b75..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; - -/** - * A test operation model. - * - * @version $Rev: 567542 $ $Date: 2007-08-19 22:13:29 -0700 (Sun, 19 Aug 2007) $ - */ -public class TestOperation extends OperationImpl { - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java deleted file mode 100644 index 609e1733aa..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor; -import org.apache.tuscany.sca.assembly.builder.Problem; -import org.apache.tuscany.sca.assembly.builder.Problem.Severity; - -public class CalculateBindingURITestCase extends TestCase { - private final static Logger logger = Logger.getLogger(CalculateBindingURITestCase.class.getName()); - private AssemblyFactory assemblyFactory; - private SCABindingFactory scaBindingFactory = null; - private CompositeBuilderMonitor monitor = null; - private CompositeConfigurationBuilderImpl configurationBuilder = null; - private List defaultBindings = new ArrayList(); - - @Override - protected void setUp() throws Exception { - assemblyFactory = new DefaultAssemblyFactory(); - scaBindingFactory = new TestBindingFactory(); - monitor = new CompositeBuilderMonitor() { - public void problem(Problem problem) { - if (problem.getSeverity() == Severity.INFO) { - logger.info(problem.toString()); - } else if (problem.getSeverity() == Severity.WARNING) { - logger.warning(problem.toString()); - } else if (problem.getSeverity() == Severity.ERROR) { - if (problem.getCause() != null) { - logger.log(Level.SEVERE, problem.toString(), problem.getCause()); - } else { - logger.severe(problem.toString()); - } - } - } - }; - configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor); - Binding defaultBinding = new TestBindingImpl(); - defaultBinding.setURI("http://myhost:8080/root"); - defaultBindings.add(defaultBinding); - } - - @Override - protected void tearDown() throws Exception { - assemblyFactory = null; - } - - /** - * Test that URI are generated in accordance with the Assembly Specification section 1.7.2.1 as - * follows. For the 3 parts that make up the URI; - * - * BaseURI / Component URI / Service Binding URI - * - * Test the following combinations for: - * - * NB. The short hand here, e.g. means - * two services appear where the first has the sca binding specified. - * - * component service bindings - * - * http://myhost:8080/root / / - * --> http://myhost:8080/root/c1 - * http://myhost:8080/root / / - * --> http://myhost:8080/root/c1/s1 - * http://myhost:8080/root / / - * --> http://myhost:8080/root/c1/n - * http://myhost:8080/root / / - * --> http://myhost:8080/root/c1/b - * http://myhost:8080/root / / - * --> http://myhost:8080/b - * http://myhost:8080/root / / - * --> http://myhost:8080/b - * - * top level composite service bindings - * - * http://myhost:8080/root / null / - * --> http://myhost:8080/root - * http://myhost:8080/root / null / - * --> http://myhost:8080/root/s1 - * http://myhost:8080/root / null / - * --> http://myhost:8080/root/n - * http://myhost:8080/root / null / - * --> http://myhost:8080/root/b - * http://myhost:8080/root / null / - * --> http://myhost:8080/b - * - * nested composite service bindings - * - * http://myhost:8080/root / implemented by composite with / - * --> http://myhost:8080/root/c1/c2 - * http://myhost:8080/root / implemented by composite with / - * --> http://myhost:8080/root/c1/c2/s1 - * http://myhost:8080/root / implemented by composite with / - * --> http://myhost:8080/root/c1/c2/n - * http://myhost:8080/root / implemented by composite with / - * --> http://myhost:8080/root/c1/c2/b - * http://myhost:8080/root / implemented by composite with / - * --> http://myhost:8080/b - * - * binding name duplication errors - * - * http://myhost:8080/root / implemented by composite with / - * --> Error - * http://myhost:8080/root / implemented by composite with / - * --> Error - */ - - private Composite createComponentServiceBinding() { - Composite composite1 = assemblyFactory.createComposite(); - composite1.setName(new QName("http://foo", "C1")); - - Component c1 = assemblyFactory.createComponent(); - c1.setName("c1"); - composite1.getComponents().add(c1); - - ComponentService s1 = assemblyFactory.createComponentService(); - c1.getServices().add(s1); - s1.setName("s1"); - - ComponentService s2 = assemblyFactory.createComponentService(); - c1.getServices().add(s2); - s2.setName("s2"); - - Binding b1 = new TestBindingImpl(); - s1.getBindings().add(b1); - - Binding b2 = new TestBindingImpl(); - s2.getBindings().add(b2); - - return composite1; - } - - private Composite createTopLevelCompositeServiceBinding(){ - Composite composite1 = assemblyFactory.createComposite(); - composite1.setName(new QName("http://foo", "C1")); - - CompositeService s1 = assemblyFactory.createCompositeService(); - s1.setName("s1"); - composite1.getServices().add(s1); - - Binding b1 = new TestBindingImpl(); - s1.getBindings().add(b1); - - CompositeService s2 = assemblyFactory.createCompositeService(); - s2.setName("s2"); - composite1.getServices().add(s2); - - Binding b2 = new TestBindingImpl(); - s2.getBindings().add(b2); - - return composite1; - } - - private Composite createNestCompositeServiceBinding(){ - Composite composite1 = assemblyFactory.createComposite(); - composite1.setName(new QName("http://foo", "C1")); - - Component c1 = assemblyFactory.createComponent(); - c1.setName("c1"); - composite1.getComponents().add(c1); - - Composite composite2 = assemblyFactory.createComposite(); - c1.setImplementation(composite2); - composite2.setName(new QName("http://foo", "C2")); - - Component c2 = assemblyFactory.createComponent(); - composite2.getComponents().add(c2); - c2.setName("c2"); - - ComponentService s1 = assemblyFactory.createComponentService(); - c2.getServices().add(s1); - s1.setName("s1"); - - ComponentService s2 = assemblyFactory.createComponentService(); - c2.getServices().add(s2); - s2.setName("s2"); - - Binding b1 = new TestBindingImpl(); - s1.getBindings().add(b1); - - Binding b2 = new TestBindingImpl(); - s2.getBindings().add(b2); - - return composite1; - } - - // component service binding tests - - public void testComponentServiceSingleService() { - Composite composite = createComponentServiceBinding(); - composite.getComponents().get(0).getServices().remove(1); - Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testComponentServiceBindingDefault() { - Composite composite = createComponentServiceBinding(); - Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/s1", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testComponentServiceBindingName() { - Composite composite = createComponentServiceBinding(); - Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/n", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testComponentServiceBindingURIRelative() { - Composite composite = createComponentServiceBinding(); - Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testComponentServiceBindingURIAbsolute() { - Composite composite = createComponentServiceBinding(); - Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("http://myhost:8080/b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testComponentServiceBindingURIRelative2() { - Composite composite = createComponentServiceBinding(); - Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("../../b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - // top level composite service binding tests - - public void testCompositeServiceSingleService() { - Composite composite = createTopLevelCompositeServiceBinding(); - composite.getServices().remove(1); - Binding b = composite.getServices().get(0).getBindings().get(0); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testCompositeServiceBindingDefault() { - Composite composite = createTopLevelCompositeServiceBinding(); - Binding b = composite.getServices().get(0).getBindings().get(0); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/s1", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testCompositeServiceBindingName() { - Composite composite = createTopLevelCompositeServiceBinding(); - Binding b = composite.getServices().get(0).getBindings().get(0); - b.setName("n"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/n", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testCompositeServiceBindingURIRelative() { - Composite composite = createTopLevelCompositeServiceBinding(); - Binding b = composite.getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testCompositeServiceBindingURIAbsolute() { - Composite composite = createTopLevelCompositeServiceBinding(); - Binding b = composite.getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("http://myhost:8080/b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - // nested composite service binding tests - - public void testNestedCompositeServiceSingleService() { - Composite composite = createNestCompositeServiceBinding(); - ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().remove(1); - Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/c2", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testNestedCompositeServiceBindingDefault() { - Composite composite = createNestCompositeServiceBinding(); - Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/c2/s1", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testNestedCompositeServiceBindingName() { - Composite composite = createNestCompositeServiceBinding(); - Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/c2/n", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testNestedCompositeServiceBindingURIRelative() { - Composite composite = createNestCompositeServiceBinding(); - Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/root/c1/c2/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - public void testNestedCompositeServiceBindingURIAbsolute() { - Composite composite = createNestCompositeServiceBinding(); - Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0); - b.setName("n"); - b.setURI("http://myhost:8080/b"); - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - - assertEquals("http://myhost:8080/b", b.getURI()); - } catch(Exception ex){ - System.out.println(ex.toString()); - fail(); - } - } - - // component service binding name error tests - - //FIXME Need to find a better way to test these error cases as - // the composite builder now (intentionally) logs warnings instead of - // throwing exceptions - public void FIXMEtestComponentServiceBindingNameError1() { - Composite composite = createComponentServiceBinding(); - Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - Binding b2 = new TestBindingImpl(); - composite.getComponents().get(0).getServices().get(0).getBindings().add(b2); - - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - fail(); - } catch(Exception ex){ - //System.out.println(ex.toString()); - } - } - - //FIXME Need to find a better way to test these error cases as - // the composite builder now (intentionally) logs warnings instead of - // throwing exceptions - public void FIXMEtestComponentServiceBindingNameError2() { - Composite composite = createComponentServiceBinding(); - Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0); - Binding b2 = new TestBindingImpl(); - composite.getComponents().get(0).getServices().get(0).getBindings().add(b2); - - b1.setName("b"); - b2.setName("b"); - - - try { - configurationBuilder.configureBindingURIs(composite, null, defaultBindings); - fail(); - } catch(Exception ex){ - System.out.println(ex.toString()); - } - } - - - public class TestBindingFactory implements SCABindingFactory { - public SCABinding createSCABinding() { - return new TestBindingImpl(); - } - } - - public class TestBindingImpl implements SCABinding { - private String name; - private String uri; - private boolean unresolved; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } - - public boolean isUnresolved() { - return false; - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - } - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java deleted file mode 100644 index bef6b47ee7..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; - -public class CompositeBuilderTestCase extends TestCase { - - private AssemblyFactory assemblyFactory; - - @Override - protected void setUp() throws Exception { - assemblyFactory = new DefaultAssemblyFactory(); - } - - @Override - protected void tearDown() throws Exception { - assemblyFactory = null; - } - - public void testFuseIncludes() { - Composite c1 = assemblyFactory.createComposite(); - c1.setName(new QName("http://foo", "C1")); - Component a = assemblyFactory.createComponent(); - a.setName("a"); - c1.getComponents().add(a); - CompositeService s = assemblyFactory.createCompositeService(); - s.setName("s"); - c1.getServices().add(s); - CompositeReference r = assemblyFactory.createCompositeReference(); - r.setName("r"); - c1.getReferences().add(r); - - Composite c2 = assemblyFactory.createComposite(); - c2.setName(new QName("http://foo", "C2")); - c1.getIncludes().add(c2); - Component b = assemblyFactory.createComponent(); - b.setName("b"); - c2.getComponents().add(b); - - Composite c = assemblyFactory.createComposite(); - c.setName(new QName("http://foo", "C")); - c.getIncludes().add(c1); - - new CompositeIncludeBuilderImpl(null).fuseIncludes(c); - - assertTrue(c.getComponents().get(0).getName().equals("a")); - assertTrue(c.getComponents().get(1).getName().equals("b")); - assertTrue(c.getServices().get(0).getName().equals("s")); - assertTrue(c.getReferences().get(0).getName().equals("r")); - } - - public void testExpandComposites() { - Composite c1 = assemblyFactory.createComposite(); - c1.setName(new QName("http://foo", "C1")); - Component a = assemblyFactory.createComponent(); - a.setName("a"); - c1.getComponents().add(a); - CompositeService s = assemblyFactory.createCompositeService(); - s.setName("s"); - c1.getServices().add(s); - CompositeReference r = assemblyFactory.createCompositeReference(); - r.setName("r"); - c1.getReferences().add(r); - - Composite c2 = assemblyFactory.createComposite(); - c2.setName(new QName("http://foo", "C2")); - Component b = assemblyFactory.createComponent(); - b.setName("b"); - c2.getComponents().add(b); - - Composite c = assemblyFactory.createComposite(); - c.setName(new QName("http://foo", "C")); - Component x = assemblyFactory.createComponent(); - x.setName("x"); - x.setImplementation(c1); - c.getComponents().add(x); - Component y = assemblyFactory.createComponent(); - y.setName("y"); - y.setImplementation(c2); - c.getComponents().add(y); - Component z = assemblyFactory.createComponent(); - z.setName("z"); - z.setImplementation(c1); - c.getComponents().add(z); - - new CompositeCloneBuilderImpl(null).expandCompositeImplementations(c); - - assertTrue(c.getComponents().get(0).getImplementation() != c1); - assertTrue(c.getComponents().get(1).getImplementation() != c2); - assertTrue(c.getComponents().get(2).getImplementation() != c1); - - Composite i = (Composite)c.getComponents().get(0).getImplementation(); - assertTrue(i.getComponents().get(0) != a); - assertTrue(i.getComponents().get(0).getName().equals("a")); - assertTrue(i.getServices().get(0).getName().equals("s")); - assertTrue(i.getServices().get(0) != s); - assertTrue(i.getReferences().get(0).getName().equals("r")); - assertTrue(i.getReferences().get(0) != r); - } - -} diff --git a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java b/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java deleted file mode 100644 index b87ffc5905..0000000000 --- a/branches/sca-android/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AbstractProperty; -import org.apache.tuscany.sca.assembly.AbstractReference; -import org.apache.tuscany.sca.assembly.AbstractService; -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Multiplicity; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.TestBinding; -import org.apache.tuscany.sca.assembly.TestImplementation; -import org.apache.tuscany.sca.assembly.TestInterfaceContract; -import org.apache.tuscany.sca.assembly.Wire; -import org.junit.Test; - -/** - * @version $Rev: 579601 $ $Date: 2007-09-26 04:25:30 -0700 (Wed, 26 Sep 2007) $ - */ -public class PrintUtilTestCase { - - private AssemblyFactory factory = new DefaultAssemblyFactory(); - - /** - * Create a composite - */ - Composite createComposite() { - Composite c = factory.createComposite(); - - Component c1 = createComponent("AccountServiceComponent1"); - c.getComponents().add(c1); - Component c2 = createComponent("AccountServiceComponent2"); - c.getComponents().add(c2); - - Wire w = factory.createWire(); - w.setSource(c1.getReferences().get(0)); - w.setTarget(c2.getServices().get(0)); - c.getWires().add(w); - - CompositeService cs = factory.createCompositeService(); - cs.setName("AccountService"); - cs.setPromotedService(c1.getServices().get(0)); - cs.setInterfaceContract(new TestInterfaceContract(factory)); - c.getServices().add(cs); - cs.getBindings().add(new TestBinding(factory)); - - CompositeReference cr = factory.createCompositeReference(); - cr.setName("StockQuoteService"); - cr.getPromotedReferences().add(c2.getReferences().get(1)); - cr.setInterfaceContract(new TestInterfaceContract(factory)); - c.getReferences().add(cr); - cr.getBindings().add(new TestBinding(factory)); - - return c; - } - - /** - * Create a new component - */ - Component createComponent(String name) { - Component c = factory.createComponent(); - c.setName(name); - - ConstrainingType constraint = createConstrainingType(); - c.setConstrainingType(constraint); - - Implementation i = new TestImplementation(factory); - c.setImplementation(i); - - ComponentProperty p = factory.createComponentProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - p.setProperty(i.getProperties().get(0)); - c.getProperties().add(p); - - ComponentReference ref1 = factory.createComponentReference(); - ref1.setName("accountDataService"); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setReference(i.getReferences().get(0)); - c.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - ComponentReference ref2 = factory.createComponentReference(); - ref2.setName("stockQuoteService"); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setReference(i.getReferences().get(1)); - c.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - ComponentService s = factory.createComponentService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - s.setService(i.getServices().get(0)); - c.getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - return c; - } - - /** - * Create a new component type - * - * @return - */ - ComponentType createComponentType() { - ComponentType ctype = factory.createComponentType(); - - Property p = factory.createProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - Reference ref1 = factory.createReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - Reference ref2 = factory.createReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - Service s = factory.createService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - ctype.getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - return ctype; - } - - /** - * Create a new constraining type - * - * @return - */ - ConstrainingType createConstrainingType() { - ConstrainingType ctype = factory.createConstrainingType(); - - AbstractProperty p = factory.createAbstractProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - AbstractReference ref1 = factory.createAbstractReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - - AbstractReference ref2 = factory.createAbstractReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - - AbstractService s = factory.createAbstractService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - ctype.getServices().add(s); - - return ctype; - } - - @Test - public void testPrint1() { - Composite composite = createComposite(); - StringWriter sw = new StringWriter(); - PrintUtil p = new PrintUtil(new PrintWriter(sw), true); - p.print(composite); - // System.out.println(sw.toString()); - } - - @Test - public void testPrint2() { - Composite composite = createComposite(); - StringWriter sw = new StringWriter(); - PrintUtil p = new PrintUtil(new PrintWriter(sw), false); - p.print(composite); - // System.out.println(sw.toString()); - } -} -- cgit v1.2.3