diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-20 10:09:15 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-20 10:09:15 +0000 |
commit | aee4ccff94e790912b0230b244cc9e46ec62463b (patch) | |
tree | fcbd327fb3541da53e0b7250b7b6819809d92bdf /sandbox/ant/sca/trunk/modules/implementation-osgi | |
parent | bc0c23f2e0653ff34d09c59cc0e325251a543415 (diff) |
Delete test trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@756398 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
82 files changed, 0 insertions, 5946 deletions
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/LICENSE b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/LICENSE deleted file mode 100644 index 6b0b1270ff..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/LICENSE +++ /dev/null @@ -1,203 +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/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF deleted file mode 100644 index 5acde3c935..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF +++ /dev/null @@ -1,34 +0,0 @@ -Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.apache.tuscany.sca.implementation.osgi.runtime
-Bundle-Version: 2.0.0
-Bundle-ActivationPolicy: lazy
-Bundle-Name: Apache Tuscany SCA OSGi Implementation Runtime
-Bundle-Vendor: The Apache Software Foundation
-Eclipse-LazyStart: true
-Bundle-Activator: org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationRuntimeActivator
-Bundle-Description: Apache Tuscany SCA OSGi Implementation
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Import-Package: org.apache.tuscany.sca.assembly;version="2.0.0",
- org.apache.tuscany.sca.core;version="2.0.0",
- org.apache.tuscany.sca.core.factory;version="2.0.0",
- org.apache.tuscany.sca.core.invocation;version="2.0.0",
- org.apache.tuscany.sca.core.scope;version="2.0.0",
- org.apache.tuscany.sca.databinding;version="2.0.0",
- org.apache.tuscany.sca.definitions;version="2.0.0";resolution:=optional,
- org.apache.tuscany.sca.implementation.osgi;version="2.0.0",
- org.apache.tuscany.sca.interfacedef;version="2.0.0",
- org.apache.tuscany.sca.interfacedef.java;version="2.0.0",
- org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
- org.apache.tuscany.sca.invocation;version="2.0.0",
- org.apache.tuscany.sca.monitor;version="2.0.0",
- org.apache.tuscany.sca.policy;version="2.0.0",
- org.apache.tuscany.sca.provider;version="2.0.0",
- org.apache.tuscany.sca.runtime;version="2.0.0",
- org.oasisopen.sca;version="2.0.0",
- org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional,
- org.osgi.framework;version="1.4.0",
- org.osgi.service.packageadmin;version="1.2.0",
- org.osgi.util.tracker;version="1.3.3"
-Bundle-DocURL: http://www.apache.org/
-
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/NOTICE b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/NOTICE deleted file mode 100644 index 25bb89c9b2..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2009 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/pom.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/pom.xml deleted file mode 100644 index 91ee8e3e24..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/pom.xml +++ /dev/null @@ -1,181 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>tuscany-implementation-osgi-runtime</artifactId> - <name>Apache Tuscany SCA OSGi Implementation Extension Runtime</name> - - <packaging>jar</packaging> - - <dependencies> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-osgi</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-contribution-osgi</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-contribution-java</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.eclipse</groupId> - <artifactId>osgi</artifactId> - <version>3.3.0-v20070530</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.osgi</groupId> - <artifactId>services</artifactId> - <version>3.1.200-v20070605</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-api</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca-api</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java-xml</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-xml</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly-xml</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-launcher-equinox</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl-osgi</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-extensibility-equinox</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.5</version> - <scope>test</scope> - </dependency> - - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-sca</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - </dependencies> - -</project> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java deleted file mode 100644 index b00aabde39..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java +++ /dev/null @@ -1,850 +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.implementation.osgi.runtime; - -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -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.Extensible; -import org.apache.tuscany.sca.assembly.Multiplicity; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.core.factory.ObjectCreationException; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; -import org.apache.tuscany.sca.core.scope.Scope; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.implementation.osgi.OSGiProperty; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.EndpointReference; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.apache.tuscany.sca.runtime.RuntimeWire; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.BundleException; -import org.osgi.framework.BundleListener; -import org.osgi.framework.Constants; -import org.osgi.framework.FrameworkEvent; -import org.osgi.framework.FrameworkListener; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceEvent; -import org.osgi.framework.ServiceListener; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -/** - * The runtime instantiation of OSGi component implementations - * - * @version $Rev$ $Date$ - */ -public class OSGiImplementationProvider implements ImplementationProvider, FrameworkListener, BundleListener { - - private static final String COMPONENT_SERVICE_NAME = "component.service.name"; - - // Maximum milliseconds to wait for a method to complete - private static final long METHOD_TIMEOUT_MILLIS = 60000; - // Maximum milliseconds to wait for services to be registered into OSGi service registry - private static final long SERVICE_TIMEOUT_MILLIS = 300000; - - private OSGiImplementation implementation; - private Hashtable<RuntimeWire, Reference> referenceWires = new Hashtable<RuntimeWire, Reference>(); - private Hashtable<RuntimeWire, ComponentReference> componentReferenceWires = - new Hashtable<RuntimeWire, ComponentReference>(); - private HashSet<RuntimeWire> resolvedWires = new HashSet<RuntimeWire>(); - private boolean wiresResolved; - - private AtomicInteger startBundleEntryCount = new AtomicInteger(); - - private Hashtable<String, Object> componentProperties = new Hashtable<String, Object>(); - private RuntimeComponent runtimeComponent; - - Bundle osgiBundle; - private ArrayList<Bundle> dependentBundles = new ArrayList<Bundle>(); - private OSGiServiceListener osgiServiceListener; - private PackageAdmin packageAdmin; - - private ProxyFactoryExtensionPoint proxyFactoryExtensionPoint; - - private boolean packagesRefreshed; - - public OSGiImplementationProvider(RuntimeComponent component, - OSGiImplementation impl, - ProxyFactoryExtensionPoint proxyFactoryExtensionPoint) throws BundleException { - - this.implementation = impl; - this.runtimeComponent = component; - this.proxyFactoryExtensionPoint = proxyFactoryExtensionPoint; - - BundleContext bundleContext = OSGiImplementationRuntimeActivator.getBundleContext(); - osgiBundle = (Bundle)implementation.getBundle(); - bundleContext.addBundleListener(this); - osgiServiceListener = new OSGiServiceListener(osgiBundle); - bundleContext.addServiceListener(osgiServiceListener); - - // PackageAdmin is used to resolve bundles - org.osgi.framework.ServiceReference packageAdminReference = - bundleContext.getServiceReference("org.osgi.service.packageadmin.PackageAdmin"); - if (packageAdminReference != null) { - packageAdmin = (PackageAdmin)bundleContext.getService(packageAdminReference); - bundleContext.addFrameworkListener(this); - } - - } - - protected RuntimeComponent getRuntimeComponent() { - return runtimeComponent; - } - - protected OSGiImplementation getImplementation() { - return implementation; - } - - private String getOSGiFilter(Hashtable<String, Object> props) { - - String filter = ""; - - if (props != null && props.size() > 0) { - int propCount = 0; - for (String propName : props.keySet()) { - if (propName.equals("service.pid")) - continue; - filter = filter + "(" + propName + "=" + props.get(propName) + ")"; - propCount++; - } - - if (propCount > 1) - filter = "(&" + filter + ")"; - } else - filter = null; - return filter; - } - - /* - * Return a matching service registered by the specified bundle. - * If <implementation.osgi /> has the attribute filter defined, return a service - * reference that matches the filter. Otherwise, return a service which has a component - * name equal to this component's name. If not found, return a service which no - * component name set. - * - * Even though services registered by this bundle can be filtered using the - * service listener, we use this method to filter all service references so that - * the service matching functionality of OSGi can be directly used. - */ - private ServiceReference getOSGiServiceReference(String scaServiceName, - String osgiServiceName, - String filter) throws InvalidSyntaxException { - - String compServiceName = runtimeComponent.getName() + "/" + scaServiceName; - if (filter != null && filter.length() > 0) { - org.osgi.framework.ServiceReference[] references = - osgiBundle.getBundleContext().getServiceReferences(osgiServiceName, filter); - - ServiceReference reference = null; - if (references != null) { - for (ServiceReference ref : references) { - if (ref.getBundle() != osgiBundle) - continue; - Object compName = ref.getProperty(COMPONENT_SERVICE_NAME); - if (compName == null && reference == null) - reference = ref; - if (scaServiceName == null || compServiceName.equals(compName)) { - reference = ref; - break; - } - } - } - - return reference; - - } - - filter = scaServiceName == null ? null : "(" + COMPONENT_SERVICE_NAME + "=" + compServiceName + ")"; - - ServiceReference[] references = - osgiBundle.getBundleContext().getServiceReferences(osgiServiceName, filter); - - if (references != null) { - for (ServiceReference ref : references) { - if (ref.getBundle() == osgiBundle) { - return ref; - } - } - } - - references = osgiBundle.getBundleContext().getServiceReferences(osgiServiceName, null); - - ServiceReference reference = null; - - if (references != null) { - for (ServiceReference ref : references) { - - if (ref.getBundle() != osgiBundle) - continue; - Object compName = ref.getProperty(COMPONENT_SERVICE_NAME); - if (compName == null && reference == null) - reference = ref; - if (compServiceName.equals(compName)) { - reference = ref; - break; - } - } - } - - return reference; - } - - /** - * This method is used to avoid full synchronization of methods which should - * be executed only once. - * - * entryCount=0: The count is incremented, and this thread executes the method. Returns true. - * - * entryCount=1: Another thread is already executing this method. - * Wait for the thread to complete if doWait is true. Returns false. - * - * entryCount=2: The method has already been executed. Returns false. - * - * @param doWait If true, and another method is executing this method - * wait for method execution to complete - * @param entryCount Atomic integer used to ensure that the method is - * executed only once - * @return true if this thread has exclusive access to execute this method - */ - private boolean enterMethod(boolean doWait, AtomicInteger entryCount) { - - if (entryCount.compareAndSet(0, 1)) { - return true; - } else { - if (doWait) { - synchronized (entryCount) { - if (entryCount.get() != 2) { - try { - entryCount.wait(METHOD_TIMEOUT_MILLIS); - } catch (InterruptedException e) { - } - } - } - } - return false; - } - } - - /** - * Called on method exit of methods which were entered after - * enterMethod returned true. Increments entryCount, and wakes - * up threads waiting for the method to complete. - * - * @param entryCount Atomic integer used for synchronization - */ - private void exitMethod(AtomicInteger entryCount) { - entryCount.compareAndSet(1, 2); - synchronized (entryCount) { - entryCount.notifyAll(); - } - } - - protected Bundle startBundle(boolean doWait) throws ObjectCreationException { - - try { - - if (enterMethod(doWait, startBundleEntryCount)) { - - configurePropertiesUsingConfigAdmin(); - - resolveBundle(); - - for (Bundle bundle : dependentBundles) { - try { - if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) { - bundle.start(); - } - } catch (BundleException e) { - if (bundle.getHeaders().get("Fragment-Host") == null) - throw e; - } - } - - } - - if (osgiBundle.getState() != Bundle.ACTIVE && osgiBundle.getState() != Bundle.STARTING) { - - int retry = 0; - - while (retry++ < 10) { - try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws BundleException { - osgiBundle.start(); - return null; - } - }); - break; - // } catch ( BundleException e) { - } catch (PrivilegedActionException e) { - // It is possible that the thread "Refresh Packages" is in the process of - // changing the state of this bundle. - Thread.yield(); - - if (retry == 10) - throw e; - } - } - } - - } catch (Exception e) { - throw new ObjectCreationException(e); - } finally { - exitMethod(startBundleEntryCount); - } - return osgiBundle; - } - - // This method is called by OSGiInstanceWrapper.getInstance to obtain the OSGi service reference - // corresponding to the specified service. The properties used to filter the service should - // be chosen based on whether this is a normal service or a callback. - /** - * @param component - * @param service - * @return - */ - protected ServiceReference getOSGiServiceReference(Component component, ComponentService service) - throws ObjectCreationException { - - Hashtable<String, Object> props = getOSGiProperties(service); - - String filter = getOSGiFilter(props); - Interface serviceInterface = service.getInterfaceContract().getInterface(); - String scaServiceName = service.getName(); - - return getOSGiServiceReference(serviceInterface, filter, scaServiceName); - - } - - /** - * Get all the OSGi properties from the extension list - * @param extensible - * @return - */ - private Hashtable<String, Object> getOSGiProperties(Extensible extensible) { - Hashtable<String, Object> props = new Hashtable<String, Object>(); - for (Object ext : extensible.getExtensions()) { - if (ext instanceof OSGiProperty) { - OSGiProperty p = (OSGiProperty)ext; - props.put(p.getName(), p.getValue()); - } - } - return props; - } - - protected ServiceReference getOSGiServiceReference(EndpointReference from, Interface callbackInterface) - throws ObjectCreationException { - - RuntimeWire refWire = null; - String filter = null; - for (RuntimeWire wire : referenceWires.keySet()) { - if (wire.getSource() == from) { - refWire = wire; - break; - } - } - if (refWire != null) { - ComponentReference scaRef = componentReferenceWires.get(refWire); - Hashtable<String, Object> props = getOSGiProperties(scaRef); - filter = getOSGiFilter(props); - } - - return getOSGiServiceReference(callbackInterface, filter, null); - } - - private ServiceReference getOSGiServiceReference(Interface serviceInterface, String filter, String scaServiceName) - throws ObjectCreationException { - - try { - - String serviceInterfaceName = null; - - ServiceReference osgiServiceReference = null; - - if (serviceInterface instanceof JavaInterface) { - serviceInterfaceName = ((JavaInterface)serviceInterface).getJavaClass().getName(); - - if ((osgiServiceReference = getOSGiServiceReference(scaServiceName, serviceInterfaceName, filter)) == null) { - - // The service listener for our bundle will notify us when the service is registered. - synchronized (implementation) { - - // When declarative services are used, the component is started asynchronously - // So this thread has to wait for the service to be registered by the component - // activate method - // For regular bundle activators, bundle.start activates the bundle synchronously - // and hence the service would probably have been started by the bundle activator - long startTime = System.currentTimeMillis(); - while ((osgiServiceReference = - getOSGiServiceReference(scaServiceName, serviceInterfaceName, filter)) == null) { - - // Wait for the bundle to register the service - implementation.wait(100); - if (System.currentTimeMillis() - startTime > SERVICE_TIMEOUT_MILLIS) - break; - } - } - - } - } - - return osgiServiceReference; - - } catch (Exception e) { - throw new ObjectCreationException(e); - } - } - - /** - * For OSGi->Java wires, create a proxy corresponding to the Java interfaces - * and register the proxy with the OSGi registry, so that the source OSGi bundle can - * locate the target Java instance from the registry like a regular OSGi service. - * - * For OSGi->OSGi wires, start the target OSGi bundle, so that references of the - * target are resolved before the source OSGi bundle is started. If the reference - * has properties specified, create a Proxy and register a service with highest - * possible ranking. The Proxy should wire to the correct OSGi instance specified - * in the SCA composite. - * - * The first phase determines whether a proxy should be installed. It also registers - * a dummy bundle if necessary to resolve the bundle. When phase1 is completed on all - * wires of the component, the bundle should be resolved. Phase2 registers the proxy service. - */ - private boolean resolveWireResolveReferences(Bundle bundle, - Class<?> interfaceClass, - RuntimeWire wire, - boolean isOSGiToOSGiWire) throws Exception { - - // FIXME: At the moment injection of values into instances require an instance to be obtained - // through the instance wrapper, and hence requires a proxy. When we do this processing here, - // we don't yet know whether the target requires any property or callback injection. So it is - // safer to create a proxy all the time. - boolean createProxy = true; - - ComponentReference scaRef = componentReferenceWires.get(wire); - Hashtable<String, Object> targetProperties = getOSGiProperties(scaRef); - - if (isOSGiToOSGiWire) { - - OSGiImplementationProvider implProvider = - (OSGiImplementationProvider)wire.getTarget().getComponent().getImplementationProvider(); - - // This is an OSGi->OSGi wire - isOSGiToOSGiWire = true; - - // If the target component is stateless, use a proxy to create a new service each time - if (!implProvider.getScope().equals(Scope.COMPOSITE)) - createProxy = true; - - Interface interfaze = wire.getTarget().getInterfaceContract().getInterface(); - - // If the target interface is remotable, create a proxy to support pass-by-value semantics - // AllowsPassByReference is not detected until the target instance is obtained. - if (interfaze.isRemotable()) - createProxy = true; - - // If any of the operations in the target interface is non-blocking, create a proxy - List<Operation> ops = interfaze.getOperations(); - for (Operation op : ops) { - if (op.isNonBlocking()) - createProxy = true; - } - - // If properties are specified for the reference, create a proxy since rewiring may be required - if (targetProperties.size() > 0) { - createProxy = true; - } - - // If properties are specified for the component, create a proxy for configuring - // the component services. - if (componentProperties.size() > 0) { - createProxy = true; - } - - // Since this is an OSGi->OSGi wire, start the target bundle before starting the - // source bundle if there is no proxy. For direct wiring without a proxy, this ordering - // is irrelevant in terms of class resolution, but the target needs to be started at some - // point. But there is no opportunity later on to start the target OSGi bundle without a proxy. - // When a Proxy is used, the target bundle needs to be resolved for the source bundle - // to be resolved so that the interface is visible to the source. In this case the bundle - // will be started when an instance is needed. - if (!createProxy) { - implProvider.startBundle(false); - } else { - implProvider.resolveBundle(); - } - } else { - createProxy = true; - } - - return createProxy; - } - - // Register proxy service - private void resolveWireRegisterProxyService(final Bundle bundle, final Class interfaceClass, RuntimeWire wire) - throws Exception { - - ComponentReference scaRef = componentReferenceWires.get(wire); - Hashtable<String, Object> targetProperties = getOSGiProperties(scaRef); - targetProperties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE); - - if (targetProperties.get(COMPONENT_SERVICE_NAME) == null && wire.getTarget().getComponent() != null) { - String compServiceName = - wire.getTarget().getComponent().getName() + "/" + wire.getTarget().getContract().getName(); - targetProperties.put(COMPONENT_SERVICE_NAME, compServiceName); - } - - ProxyFactory proxyService = proxyFactoryExtensionPoint.getInterfaceProxyFactory(); - if (!interfaceClass.isInterface()) { - proxyService = proxyFactoryExtensionPoint.getClassProxyFactory(); - } - - // Allow privileged access to load classes. Requires getClassLoader permission in security - // policy. - final Class<?> proxyInterface = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() { - public Class<?> run() throws Exception { - return bundle.loadClass(interfaceClass.getName()); - } - }); - - final Object proxy = proxyService.createProxy(proxyInterface, wire); - final Hashtable<String, Object> finalTargetProperties = targetProperties; - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws Exception { - osgiBundle.getBundleContext().registerService(proxyInterface.getName(), proxy, finalTargetProperties); - return null; - } - }); - - } - - private void refreshPackages() { - - if (packageAdmin != null) { - synchronized (this) { - packagesRefreshed = false; - packageAdmin.refreshPackages(null); - - if (!packagesRefreshed) { - try { - this.wait(2000); - } catch (InterruptedException e) { - // ignore - } - } - packagesRefreshed = false; - } - } - } - - private void resolveBundle() throws ObjectCreationException { - - try { - - if (!wiresResolved) { - wiresResolved = true; - - if (!setReferencesAndProperties()) { - wiresResolved = false; - return; - } - - int refPlusServices = referenceWires.size() + runtimeComponent.getServices().size(); - boolean[] createProxyService = new boolean[refPlusServices]; - Class<?>[] interfaceClasses = new Class<?>[refPlusServices]; - boolean[] isOSGiToOSGiWire = new boolean[refPlusServices]; - boolean[] wireResolved = new boolean[refPlusServices]; - int index = 0; - for (RuntimeWire wire : referenceWires.keySet()) { - - Reference reference = referenceWires.get(wire); - - isOSGiToOSGiWire[index] = - wire.getTarget().getComponent() != null && wire.getTarget().getComponent() - .getImplementationProvider() instanceof OSGiImplementationProvider; - - Interface refInterface = reference.getInterfaceContract().getInterface(); - if (refInterface instanceof JavaInterface) { - interfaceClasses[index] = ((JavaInterface)refInterface).getJavaClass(); - - // if (!isOSGiToOSGiWire[index]) - // resolveWireCreateDummyBundles(interfaceClasses[index]); - - } - - if (!resolvedWires.contains(wire)) { - resolvedWires.add(wire); - } else - wireResolved[index] = true; - - index++; - } - for (ComponentService service : runtimeComponent.getServices()) { - Interface callbackInterface = service.getInterfaceContract().getCallbackInterface(); - if (callbackInterface instanceof JavaInterface) { - interfaceClasses[index] = ((JavaInterface)callbackInterface).getJavaClass(); - -// resolveWireCreateDummyBundles(interfaceClasses[index]); - } - - index++; - } - - index = 0; - for (RuntimeWire wire : referenceWires.keySet()) { - - if (!wireResolved[index]) { - createProxyService[index] = - resolveWireResolveReferences(osgiBundle, - interfaceClasses[index], - wire, - isOSGiToOSGiWire[index]); - } - index++; - } - - refreshPackages(); - - index = 0; - for (RuntimeWire wire : referenceWires.keySet()) { - - if (createProxyService[index] && !wireResolved[index]) - resolveWireRegisterProxyService(osgiBundle, interfaceClasses[index], wire); - index++; - } - } else if (osgiBundle.getState() == Bundle.INSTALLED && packageAdmin != null) { - packageAdmin.resolveBundles(new Bundle[] {osgiBundle}); - } - - } catch (Exception e) { - e.printStackTrace(); - throw new ObjectCreationException(e); - } - } - - @SuppressWarnings("unchecked") - private void configurePropertiesUsingConfigAdmin() { - - try { - - if (componentProperties.size() == 0) - return; - - ServiceReference configAdminReference = - osgiBundle.getBundleContext().getServiceReference("org.osgi.service.cm.ConfigurationAdmin"); - if (configAdminReference != null) { - - Object cm = osgiBundle.getBundleContext().getService(configAdminReference); - Class cmClass = cm.getClass().getClassLoader().loadClass("org.osgi.service.cm.ConfigurationAdmin"); - Method getConfigMethod = cmClass.getMethod("getConfiguration", String.class, String.class); - - Class configClass = cm.getClass().getClassLoader().loadClass("org.osgi.service.cm.Configuration"); - - Method getMethod = configClass.getMethod("getProperties"); - Method updateMethod = configClass.getMethod("update", Dictionary.class); - - List<Service> services = implementation.getServices(); - HashSet<String> pidsProcessed = new HashSet<String>(); - - for (Service service : services) { - - Hashtable<String, Object> properties = getOSGiProperties(service); - String pid = null; - - if (properties != null) { - for (Map.Entry<String, Object> prop : properties.entrySet()) { - pid = (String)prop.getValue(); - } - } - if (pid == null || pidsProcessed.contains(pid)) - continue; - - Object config = getConfigMethod.invoke(cm, pid, null); - Dictionary props = (Dictionary)getMethod.invoke(config); - if (props == null) { - props = new Hashtable<String, Object>(); - } - for (String propertyName : componentProperties.keySet()) { - - props.put(propertyName, componentProperties.get(propertyName)); - } - - updateMethod.invoke(config, props); - - } - - } - - } catch (Exception e) { - e.printStackTrace(); - } - - } - - public boolean isOptimizable() { - return false; - } - - public Scope getScope() { - return Scope.COMPOSITE; - } - - public boolean isEagerInit() { - return false; - } - - public long getMaxAge() { - return 0l; - } - - public long getMaxIdleTime() { - return 0l; - } - - public Invoker createTargetInvoker(RuntimeComponentService service, Operation operation) { - Interface serviceInterface = operation.getInterface(); - Invoker invoker = new OSGiTargetInvoker(operation, this, service); - return invoker; - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - return createTargetInvoker(service, operation); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - private boolean setReferencesAndProperties() { - - for (Reference ref : implementation.getReferences()) { - List<RuntimeWire> wireList = null; - ComponentReference compRef = null; - for (ComponentReference cRef : runtimeComponent.getReferences()) { - if (cRef.getName().equals(ref.getName())) { - - wireList = ((RuntimeComponentReference)cRef).getRuntimeWires(); - - compRef = cRef; - break; - } - } - - if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) { - for (RuntimeWire wire : wireList) { - referenceWires.put(wire, ref); - componentReferenceWires.put(wire, compRef); - } - - } else { - if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) { - throw new IllegalStateException("Required reference is missing: " + ref.getName()); - } - if (wireList != null && !wireList.isEmpty()) { - RuntimeWire wire = wireList.get(0); - referenceWires.put(wire, ref); - componentReferenceWires.put(wire, compRef); - } - - } - - } - - componentProperties = getOSGiProperties(runtimeComponent); - - return true; - - } - - public void start() { - setReferencesAndProperties(); - } - - public void stop() { - - if (osgiServiceListener != null) { - OSGiImplementationRuntimeActivator.getBundleContext().removeServiceListener(osgiServiceListener); - } - } - - public void frameworkEvent(FrameworkEvent event) { - if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) { - synchronized (this) { - packagesRefreshed = true; - this.notifyAll(); - } - } - - } - - public void bundleChanged(BundleEvent event) { - if (event.getType() == BundleEvent.RESOLVED && event.getBundle() == osgiBundle) { - // TODO - } - } - - private class OSGiServiceListener implements ServiceListener { - - private Bundle bundle; - - OSGiServiceListener(Bundle bundle) { - this.bundle = bundle; - } - - public void serviceChanged(org.osgi.framework.ServiceEvent event) { - - ServiceReference reference = event.getServiceReference(); - - if (event.getType() == ServiceEvent.REGISTERED && reference.getBundle() == bundle) { - - synchronized (implementation) { - - implementation.notifyAll(); - } - } - - if (event.getType() == ServiceEvent.UNREGISTERING && reference.getBundle() == bundle) { - // TODO: Process deregistering of OSGi services. - } - } - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java deleted file mode 100644 index 0e4a3ef995..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.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.implementation.osgi.runtime; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.osgi.framework.BundleException; - -/** - * Builds a OSGi-based implementation provider from a component definition - * - * @version $Rev$ $Date$ - */ -public class OSGiImplementationProviderFactory implements ImplementationProviderFactory<OSGiImplementation> { - - private ProxyFactoryExtensionPoint proxyFactoryExtensionPoint; - - public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { - proxyFactoryExtensionPoint = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class); - } - - public ImplementationProvider createImplementationProvider(RuntimeComponent component, - OSGiImplementation implementation) { - - try { - - return new OSGiImplementationProvider(component, implementation, proxyFactoryExtensionPoint); - - } catch (BundleException e) { - throw new RuntimeException(e); - } - - } - - public Class<OSGiImplementation> getModelType() { - return OSGiImplementation.class; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java deleted file mode 100644 index f3d59cc513..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.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.implementation.osgi.runtime; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -/** - * Bundle activator to receive the BundleContext - */ -public class OSGiImplementationRuntimeActivator implements BundleActivator { - private static BundleContext bundleContext; - - public void start(BundleContext context) throws Exception { - bundleContext = context; - } - - public void stop(BundleContext context) throws Exception { - bundleContext = null; - } - - static BundleContext getBundleContext() { - return bundleContext; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiServiceTracker.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiServiceTracker.java deleted file mode 100644 index c7fd3058dc..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiServiceTracker.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.implementation.osgi.runtime; - -import org.osgi.framework.ServiceReference; -import org.osgi.util.tracker.ServiceTrackerCustomizer; - -/** - * A ServiceTracker - */ -public class OSGiServiceTracker implements ServiceTrackerCustomizer { - - public Object addingService(ServiceReference serviceReference) { - return null; - } - - public void modifiedService(ServiceReference serviceReference, Object service) { - } - - public void removedService(ServiceReference serviceReference, Object service) { - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java deleted file mode 100644 index 8e7de6dd8c..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java +++ /dev/null @@ -1,191 +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.implementation.osgi.runtime; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.core.factory.InstanceWrapper; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -/** - * Java->OSGi references use OSGiTargetInvoker to call methods from OSGi bundles - * OSGi->Java references use JDKProxyService and invocation handler and do not use this class - * OSGi->OSGi references go through OSGi reference mechanisms when a proxy is not used - * When a proxy is used, this invoker is used to call methods from OSGi bundles - * A proxy is used for OSGi->OSGi if - * 1) target reference properties are specified OR - * 2) there are one or more non-blocking methods in the target interface OR - * 3) scope is not COMPOSITE - * - * @version $Rev$ $Date$ - */ -public class OSGiTargetInvoker<T> implements Invoker { - - private Operation operation; - protected InstanceWrapper<T> target; - - private final OSGiImplementationProvider provider; - private final RuntimeComponent component; - private final RuntimeComponentService service; - - public OSGiTargetInvoker(Operation operation, OSGiImplementationProvider provider, RuntimeComponentService service) { - - this.operation = operation; - this.service = service; - this.provider = provider; - this.component = provider.getRuntimeComponent(); - - } - - private Object invokeTarget(Message msg) throws InvocationTargetException { - - Operation op = msg.getOperation(); - if (op == null) { - op = this.operation; - } - - try { - BundleContext bundleContext = provider.getImplementation().getBundle().getBundleContext(); - JavaInterface javaInterface = (JavaInterface)op.getInterface(); - // FIXME: What is the filter? - String filter = "(sca.service=" + component.getURI() + "#service-name\\(" + service.getName() + "\\))"; - ServiceReference[] refs = bundleContext.getServiceReferences(javaInterface.getName(), filter); - Object instance = bundleContext.getService(refs[0]); - Method m = findMethod(instance.getClass(), operation); - - Object ret = invokeMethod(instance, m, msg); - - return ret; - } catch (InvocationTargetException e) { - throw e; - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - - protected Object invokeMethod(Object instance, Method m, Message msg) throws InvocationTargetException { - - try { - - Object payload = msg.getBody(); - - if (payload != null && !payload.getClass().isArray()) { - return m.invoke(instance, payload); - } else { - return m.invoke(instance, (Object[])payload); - } - - } catch (InvocationTargetException e) { - throw e; - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - - public Message invoke(Message msg) { - try { - Object resp = invokeTarget(msg); - msg.setBody(resp); - } catch (InvocationTargetException e) { - msg.setFaultBody(e.getCause()); - } - return msg; - } - - /** - * @Deprecated - */ - private static Class<?>[] getPhysicalTypes(Operation operation) { - DataType<List<DataType>> inputType = operation.getInputType(); - if (inputType == null) { - return new Class<?>[] {}; - } - List<DataType> types = inputType.getLogical(); - Class<?>[] javaTypes = new Class<?>[types.size()]; - for (int i = 0; i < javaTypes.length; i++) { - Type physical = types.get(i).getPhysical(); - if (physical instanceof Class<?>) { - javaTypes[i] = (Class<?>)physical; - } else { - throw new UnsupportedOperationException(); - } - } - return javaTypes; - } - - /** - * Return the method on the implementation class that matches the operation. - * - * @param implClass the implementation class or interface - * @param operation the operation to match - * @return the method described by the operation - * @throws NoSuchMethodException if no such method exists - * @Deprecated - */ - public static Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException { - String name = operation.getName(); - if (operation instanceof JavaOperation) { - name = ((JavaOperation)operation).getJavaMethod().getName(); - } - Interface interface1 = operation.getInterface(); - int numParams = operation.getInputType().getLogical().size(); - if (interface1 != null && interface1.isRemotable()) { - List<Method> matchingMethods = new ArrayList<Method>(); - for (Method m : implClass.getMethods()) { - if (m.getName().equals(name) && m.getParameterTypes().length == numParams) { - matchingMethods.add(m); - } - } - - // TUSCANY-2180 If there is only one method then we just match on the name - // (this is the same as the existing behaviour) - if (matchingMethods.size() == 1) { - return matchingMethods.get(0); - } - if (matchingMethods.size() > 1) { - // TUSCANY-2180 We need to check the parameter types too - Class<?>[] paramTypes = getPhysicalTypes(operation); - return implClass.getMethod(name, paramTypes); - } - - // No matching method found - throw new NoSuchMethodException("No matching method for operation " + operation.getName() - + " is found on " - + implClass); - } - Class<?>[] paramTypes = getPhysicalTypes(operation); - return implClass.getMethod(name, paramTypes); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/META-INF/definitions.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/META-INF/definitions.xml deleted file mode 100644 index f531c2c4ed..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/META-INF/definitions.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<sca:definitions xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903" - targetNamespace="http://www.osgi.org/xmlns/sca/intents/v1.0.0"> - - <intent name="passByReference" constrains="sca:implementation" - intentType="implementation"> - <description> - An OSGi intent to pass data by reference - </description> - </intent> - - <intent name="passByValue" constrains="sca:implementation" - intentType="implementation"> - <description> - An OSGi intent to pass data by value - </description> - </intent> - -</sca:definitions>
\ No newline at end of file diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index c2cd957351..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +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.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementation
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/impl-osgi-validation-messages.properties b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/impl-osgi-validation-messages.properties deleted file mode 100644 index 2503be0b13..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/main/resources/impl-osgi-validation-messages.properties +++ /dev/null @@ -1,25 +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. -# -# -ContributionReadException = ContributionReadException occured due to: -ContributionResolveException = ContributionResolveException occured due to: -PropertyShouldSpecifySR = Properties in implementation.osgi should specify service or reference -CouldNotLocateOSGiBundle = Could not locate OSGi bundle: {0} -MissingComponentTypeFile = Missing .componentType side file: {0}
\ No newline at end of file diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorActivator.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorActivator.java deleted file mode 100644 index b2d8ffb44c..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorActivator.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 calculator.dosgi; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.logging.Logger; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -import calculator.dosgi.operations.AddService; - -/** - * - */ -public class CalculatorActivator implements BundleActivator { - private Logger logger = Logger.getLogger(CalculatorActivator.class.getName()); - - private Bundle getBundle(BundleContext bundleContext, Class<?> cls) { - PackageAdmin packageAdmin = null; - // PackageAdmin is used to resolve bundles - ServiceReference ref = bundleContext.getServiceReference("org.osgi.service.packageadmin.PackageAdmin"); - if (ref != null) { - packageAdmin = (PackageAdmin)bundleContext.getService(ref); - Bundle bundle = packageAdmin.getBundle(cls); - if (bundle != null) { - logger.info(cls.getName() + " is loaded by bundle: " + bundle.getSymbolicName()); - } - bundleContext.ungetService(ref); - return bundle; - } - return null; - } - - public void start(BundleContext context) throws Exception { - logger.info("Starting " + context.getBundle()); - Dictionary<String, Object> props = new Hashtable<String, Object>(); - props.put("sca.service", "CalculatorComponent#service-name(Calculator)"); - props.put("calculator", "Calculator"); - logger.info("Registering " + CalculatorService.class.getName()); - CalculatorService calculator = new CalculatorServiceImpl(context); - context.registerService(CalculatorService.class.getName(), calculator, props); - - getBundle(context, AddService.class); - - } - - public void stop(BundleContext context) throws Exception { - logger.info("Stopping " + context.getBundle()); - // Registered services will be automatically unregistered - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorService.java deleted file mode 100644 index 656b78b717..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorService.java +++ /dev/null @@ -1,39 +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 calculator.dosgi; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The Calculator service interface. - */ -@Remotable -public interface CalculatorService extends Remote { - - double add(double n1, double n2) throws RemoteException; - - double subtract(double n1, double n2) throws RemoteException; - - double multiply(double n1, double n2) throws RemoteException; - - double divide(double n1, double n2) throws RemoteException; -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorServiceDSImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorServiceDSImpl.java deleted file mode 100644 index 9a1d64077b..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorServiceDSImpl.java +++ /dev/null @@ -1,113 +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 calculator.dosgi; - -import org.osgi.service.component.ComponentContext; - -import calculator.dosgi.operations.AddService; -import calculator.dosgi.operations.DivideService; -import calculator.dosgi.operations.MultiplyService; -import calculator.dosgi.operations.SubtractService; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceDSImpl implements CalculatorService { - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - public CalculatorServiceDSImpl() { - super(); - System.out.println("CalculatorServiceDSImpl()"); - } - - protected void activate(ComponentContext context) { - System.out.println("Activating " + context); - } - - protected void deactivate(ComponentContext context) { - System.out.println("Deactivating " + context); - } - - /* - * The following setters can be used for DS injection - */ - public void setAddService(AddService addService) { - System.out.println("setAddService()"); - this.addService = addService; - } - - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - /* - * The following setters can be used for DS injection - */ - public void unsetAddService(AddService addService) { - System.out.println("unsetAddService()"); - this.addService = null; - } - - public void unsetSubtractService(SubtractService subtractService) { - this.subtractService = null; - } - - public void unsetDivideService(DivideService divideService) { - this.divideService = null; - } - - public void unsetMultiplyService(MultiplyService multiplyService) { - this.multiplyService = null; - } - private <T> T getService(Class<T> cls) { - for (Object s : new Object[] {addService, subtractService, multiplyService, divideService}) { - if (cls.isInstance(s)) { - return cls.cast(s); - } - } - throw new IllegalStateException(cls.getSimpleName() + " is not available"); - } - - public double add(double n1, double n2) { - return getService(AddService.class).add(n1, n2); - } - - public double subtract(double n1, double n2) { - return getService(SubtractService.class).subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return getService(MultiplyService.class).multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return getService(DivideService.class).divide(n1, n2); - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorServiceImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorServiceImpl.java deleted file mode 100644 index 9f31afbd1f..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/CalculatorServiceImpl.java +++ /dev/null @@ -1,104 +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 calculator.dosgi; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.util.tracker.ServiceTracker; - -import calculator.dosgi.operations.AddService; -import calculator.dosgi.operations.DivideService; -import calculator.dosgi.operations.MultiplyService; -import calculator.dosgi.operations.SubtractService; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { -// private AddService addService; -// private SubtractService subtractService; -// private MultiplyService multiplyService; -// private DivideService divideService; - - private ServiceTracker tracker; - - public CalculatorServiceImpl() { - super(); - } - - public CalculatorServiceImpl(BundleContext context) { - super(); - Filter filter = null; - try { - filter = context.createFilter("(" + Constants.OBJECTCLASS + "=calculator.dosgi.operations.*)"); - } catch (InvalidSyntaxException e) { - e.printStackTrace(); - } - this.tracker = new ServiceTracker(context, filter, null); - tracker.open(); - } - - /* - * The following setters can be used for DS injection - */ - /* - public void setAddService(AddService addService) { - this.addService = addService; - } - - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - */ - - private <T> T getService(Class<T> cls) { - for (Object s : tracker.getServices()) { - if (cls.isInstance(s)) { - return cls.cast(s); - } - } - throw new IllegalStateException(cls.getSimpleName() + " is not available"); - } - - public double add(double n1, double n2) { - return getService(AddService.class).add(n1, n2); - } - - public double subtract(double n1, double n2) { - return getService(SubtractService.class).subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return getService(MultiplyService.class).multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return getService(DivideService.class).divide(n1, n2); - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/AddService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/AddService.java deleted file mode 100644 index 971500782f..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/AddService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the add service - */ -@Remotable -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/AddServiceImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/AddServiceImpl.java deleted file mode 100644 index 6bdbfa5fb5..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/AddServiceImpl.java +++ /dev/null @@ -1,35 +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 calculator.dosgi.operations; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.INFO, "Adding " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/DivideService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/DivideService.java deleted file mode 100644 index 49b8a1c0bf..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/DivideService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the divide service - */ -@Remotable -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/DivideServiceImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/DivideServiceImpl.java deleted file mode 100644 index eafc9b0f4f..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/DivideServiceImpl.java +++ /dev/null @@ -1,35 +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 calculator.dosgi.operations; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.INFO, "Dividing " + n1 + " with " + n2); - return n1 / n2; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/MultiplyService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/MultiplyService.java deleted file mode 100644 index f4e59d12ea..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/MultiplyService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the multiply service - */ -@Remotable -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/MultiplyServiceImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/MultiplyServiceImpl.java deleted file mode 100644 index c2e39ad2f4..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/MultiplyServiceImpl.java +++ /dev/null @@ -1,35 +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 calculator.dosgi.operations; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.INFO, "Multiplying " + n1 + " with " + n2); - return n1 * n2; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/OperationsActivator.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/OperationsActivator.java deleted file mode 100644 index 7db89cd98d..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/OperationsActivator.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 calculator.dosgi.operations; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.logging.Logger; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -/** - * - */ -public class OperationsActivator implements BundleActivator { - private Logger logger = Logger.getLogger(OperationsActivator.class.getName()); - - public void start(BundleContext context) throws Exception { - logger.info("Starting " + context.getBundle()); - - Dictionary<String, Object> props = new Hashtable<String, Object>(); - - logger.info("Registering " + AddService.class.getName()); - props.put("sca.service", "AddComponent#service-name(Add)"); - context.registerService(AddService.class.getName(), new AddServiceImpl(), props); - - logger.info("Registering " + SubtractService.class.getName()); - props.put("sca.service", "SubtractComponent#service-name(Subtract)"); - context.registerService(SubtractService.class.getName(), new SubtractServiceImpl(), props); - - logger.info("Registering " + MultiplyService.class.getName()); - props.put("sca.service", "MultiplyComponent#service-name(Multiply)"); - context.registerService(MultiplyService.class.getName(), new MultiplyServiceImpl(), props); - - logger.info("Registering " + DivideService.class.getName()); - props.put("sca.service", "DivideComponent#service-name(Divide)"); - context.registerService(DivideService.class.getName(), new DivideServiceImpl(), props); - - } - - public void stop(BundleContext context) throws Exception { - logger.info("Stopping " + context.getBundle()); - // Registered services will be automatically unregistered - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/SubtractService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/SubtractService.java deleted file mode 100644 index bfb9b820f7..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/SubtractService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the subtract service - */ -@Remotable -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/SubtractServiceImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/SubtractServiceImpl.java deleted file mode 100644 index 64cc776884..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/operations/SubtractServiceImpl.java +++ /dev/null @@ -1,35 +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 calculator.dosgi.operations; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.INFO, "Subtracting " + n1 + " from " + n2); - return n1 - n2; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java deleted file mode 100644 index b04a08f2f5..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java +++ /dev/null @@ -1,230 +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 calculator.dosgi.test; - -import java.io.File; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.HashSet; -import java.util.Set; - -import org.apache.tuscany.sca.contribution.osgi.impl.OSGiBundleContributionScanner; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles; -import org.apache.tuscany.sca.node.equinox.launcher.EquinoxHost; -import org.apache.tuscany.sca.node.osgi.impl.NodeImpl; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -import calculator.dosgi.CalculatorActivator; -import calculator.dosgi.CalculatorService; -import calculator.dosgi.CalculatorServiceDSImpl; -import calculator.dosgi.CalculatorServiceImpl; -import calculator.dosgi.operations.AddService; -import calculator.dosgi.operations.AddServiceImpl; -import calculator.dosgi.operations.DivideService; -import calculator.dosgi.operations.DivideServiceImpl; -import calculator.dosgi.operations.MultiplyService; -import calculator.dosgi.operations.MultiplyServiceImpl; -import calculator.dosgi.operations.OperationsActivator; -import calculator.dosgi.operations.SubtractService; -import calculator.dosgi.operations.SubtractServiceImpl; - -/** - * - */ -public class CalculatorOSGiNodeTestCase { - private static EquinoxHost host; - - public static URL getCodeLocation(final Class<?> anchorClass) { - return AccessController.doPrivileged(new PrivilegedAction<URL>() { - public URL run() { - return anchorClass.getProtectionDomain().getCodeSource().getLocation(); - } - }); - } - - /** - * @throws java.lang.Exception - */ - @BeforeClass - public static void setUpBeforeClass() throws Exception { - try { - Set<URL> bundles = new HashSet<URL>(); - - File plugins = new File("target/test-classes/plugins"); - for (File f : plugins.listFiles()) { - if (f.isFile()) { - bundles.add(f.toURI().toURL()); - } - } - - bundles.add(getCodeLocation(OSGiImplementation.class)); - bundles.add(getCodeLocation(OSGiBundleContributionScanner.class)); - bundles.add(getCodeLocation(NodeImpl.class)); - - bundles.add(OSGiTestBundles.createBundle("target/test-classes/calculator-bundle.jar", - "calculator/dosgi/META-INF/MANIFEST.MF", - new String[][] { - {"OSGI-INF/calculator-component.xml", null}, - {"calculator/dosgi/bundle.componentType", - "OSGI-INF/sca/bundle.componentType"}, - {"calculator/dosgi/calculator.composite", - "OSGI-INF/sca/bundle.composite"}}, - CalculatorService.class, - CalculatorServiceImpl.class, - CalculatorServiceDSImpl.class, - CalculatorActivator.class)); - - bundles.add(OSGiTestBundles - .createBundle("target/test-classes/operations-bundle.jar", - "calculator/dosgi/operations/META-INF/MANIFEST.MF", - new String[][] { - {"OSGI-INF/add-component.xml", null}, - {"OSGI-INF/subtract-component.xml", null}, - {"OSGI-INF/multiply-component.xml", null}, - {"OSGI-INF/divide-component.xml", null}, - {"calculator/dosgi/operations/bundle.componentType", - "OSGI-INF/sca/bundle.componentType"}, - {"calculator/dosgi/operations/operations.composite", - "OSGI-INF/sca/bundle.composite"}}, - OperationsActivator.class, - AddService.class, - AddServiceImpl.class, - SubtractService.class, - SubtractServiceImpl.class, - MultiplyService.class, - MultiplyServiceImpl.class, - DivideService.class, - DivideServiceImpl.class)); - host = new EquinoxHost(); - BundleContext context = host.start(); - for (URL loc : bundles) { - host.installBundle(loc, null); - } - for (Bundle b : context.getBundles()) { - if (b.getSymbolicName().equals("org.eclipse.equinox.ds") || b.getSymbolicName() - .startsWith("org.apache.tuscany.sca.")) { - try { - b.start(); - } catch (Exception e) { - System.out.println(string(b, false)); - e.printStackTrace(); - } - System.out.println(string(b, false)); - } - } - for (Bundle b : context.getBundles()) { - if (b.getSymbolicName().equals("calculator.dosgi")) { - b.start(); - System.out.println(string(b, false)); - } - } - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - private static <T> T cast(Object obj, Class<T> cls) { - if (cls.isInstance(obj)) { - return cls.cast(obj); - } else { - return cls.cast(Proxy.newProxyInstance(cls.getClassLoader(), - new Class<?>[] {cls}, - new InvocationHandlerImpl(obj))); - } - } - - private static class InvocationHandlerImpl implements InvocationHandler { - private Object instance; - - public InvocationHandlerImpl(Object instance) { - super(); - this.instance = instance; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Method m = instance.getClass().getMethod(method.getName(), method.getParameterTypes()); - return m.invoke(instance, args); - } - - } - - @Test - public void testOSGi() { - - } - - /** - * Returns a string representation of the given bundle. - * - * @param b - * @param verbose - * @return - */ - static String string(Bundle bundle, boolean verbose) { - StringBuffer sb = new StringBuffer(); - sb.append(bundle.getBundleId()).append(" ").append(bundle.getSymbolicName()); - int s = bundle.getState(); - if ((s & Bundle.UNINSTALLED) != 0) { - sb.append(" UNINSTALLED"); - } - if ((s & Bundle.INSTALLED) != 0) { - sb.append(" INSTALLED"); - } - if ((s & Bundle.RESOLVED) != 0) { - sb.append(" RESOLVED"); - } - if ((s & Bundle.STARTING) != 0) { - sb.append(" STARTING"); - } - if ((s & Bundle.STOPPING) != 0) { - sb.append(" STOPPING"); - } - if ((s & Bundle.ACTIVE) != 0) { - sb.append(" ACTIVE"); - } - - if (verbose) { - sb.append(" ").append(bundle.getLocation()); - sb.append(" ").append(bundle.getHeaders()); - } - return sb.toString(); - } - - /** - * @throws java.lang.Exception - */ - @AfterClass - public static void tearDownAfterClass() throws Exception { - if (host != null) { - host.stop(); - } - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java deleted file mode 100644 index 8f9162c749..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java +++ /dev/null @@ -1,211 +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 calculator.dosgi.test; - -import java.io.File; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.net.URL; -import java.util.HashSet; -import java.util.Set; - -import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles; -import org.apache.tuscany.sca.node.equinox.launcher.EquinoxHost; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -import calculator.dosgi.CalculatorActivator; -import calculator.dosgi.CalculatorService; -import calculator.dosgi.CalculatorServiceDSImpl; -import calculator.dosgi.CalculatorServiceImpl; -import calculator.dosgi.operations.AddService; -import calculator.dosgi.operations.AddServiceImpl; -import calculator.dosgi.operations.DivideService; -import calculator.dosgi.operations.DivideServiceImpl; -import calculator.dosgi.operations.MultiplyService; -import calculator.dosgi.operations.MultiplyServiceImpl; -import calculator.dosgi.operations.OperationsActivator; -import calculator.dosgi.operations.SubtractService; -import calculator.dosgi.operations.SubtractServiceImpl; - -/** - * - */ -public class CalculatorOSGiTestCase { - private static EquinoxHost host; - - /** - * @throws java.lang.Exception - */ - @BeforeClass - public static void setUpBeforeClass() throws Exception { - Set<URL> bundles = new HashSet<URL>(); - - File plugins = new File("target/test-classes/plugins"); - for (File f : plugins.listFiles()) { - if (f.isFile()) { - bundles.add(f.toURI().toURL()); - } - } - - bundles.add(OSGiTestBundles.createBundle("target/test-classes/calculator-bundle.jar", - "calculator/dosgi/META-INF/MANIFEST.MF", - new String[][] { - {"OSGI-INF/calculator-component.xml", null}, - {"calculator/dosgi/bundle.componentType", - "OSGI-INF/sca/bundle.componentType"}, - {"calculator/dosgi/calculator.composite", - "OSGI-INF/sca/bundle.composite"}}, - CalculatorService.class, - CalculatorServiceImpl.class, - CalculatorServiceDSImpl.class, - CalculatorActivator.class)); - - bundles.add(OSGiTestBundles - .createBundle("target/test-classes/operations-bundle.jar", - "calculator/dosgi/operations/META-INF/MANIFEST.MF", - new String[][] { - {"OSGI-INF/add-component.xml", null}, - {"OSGI-INF/subtract-component.xml", null}, - {"OSGI-INF/multiply-component.xml", null}, - {"OSGI-INF/divide-component.xml", null}, - {"calculator/dosgi/operations/bundle.componentType", - "OSGI-INF/sca/bundle.componentType"}, - {"calculator/dosgi/operations/operations.composite", - "OSGI-INF/sca/bundle.composite"}}, - OperationsActivator.class, - AddService.class, - AddServiceImpl.class, - SubtractService.class, - SubtractServiceImpl.class, - MultiplyService.class, - MultiplyServiceImpl.class, - DivideService.class, - DivideServiceImpl.class)); - try { - host = new EquinoxHost(bundles); - BundleContext context = host.start(); - for (Bundle b : context.getBundles()) { - if (b.getSymbolicName().equals("org.eclipse.equinox.ds")) { - b.start(); - System.out.println(string(b, false)); - } - } - for (Bundle b : context.getBundles()) { - if (b.getSymbolicName().startsWith("calculator.dosgi")) { - b.start(); - System.out.println(string(b, false)); - } - } - ServiceReference ref = context.getServiceReference(CalculatorService.class.getName()); - CalculatorService calculator = cast(context.getService(ref), CalculatorService.class); - System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0)); - System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0)); - System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0)); - System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0)); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - private static <T> T cast(Object obj, Class<T> cls) { - if (cls.isInstance(obj)) { - return cls.cast(obj); - } else { - return cls.cast(Proxy.newProxyInstance(cls.getClassLoader(), - new Class<?>[] {cls}, - new InvocationHandlerImpl(obj))); - } - } - - private static class InvocationHandlerImpl implements InvocationHandler { - private Object instance; - - public InvocationHandlerImpl(Object instance) { - super(); - this.instance = instance; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Method m = instance.getClass().getMethod(method.getName(), method.getParameterTypes()); - return m.invoke(instance, args); - } - - } - - @Test - public void testOSGi() { - - } - - /** - * Returns a string representation of the given bundle. - * - * @param b - * @param verbose - * @return - */ - static String string(Bundle bundle, boolean verbose) { - StringBuffer sb = new StringBuffer(); - sb.append(bundle.getBundleId()).append(" ").append(bundle.getSymbolicName()); - int s = bundle.getState(); - if ((s & Bundle.UNINSTALLED) != 0) { - sb.append(" UNINSTALLED"); - } - if ((s & Bundle.INSTALLED) != 0) { - sb.append(" INSTALLED"); - } - if ((s & Bundle.RESOLVED) != 0) { - sb.append(" RESOLVED"); - } - if ((s & Bundle.STARTING) != 0) { - sb.append(" STARTING"); - } - if ((s & Bundle.STOPPING) != 0) { - sb.append(" STOPPING"); - } - if ((s & Bundle.ACTIVE) != 0) { - sb.append(" ACTIVE"); - } - - if (verbose) { - sb.append(" ").append(bundle.getLocation()); - sb.append(" ").append(bundle.getHeaders()); - } - return sb.toString(); - } - - /** - * @throws java.lang.Exception - */ - @AfterClass - public static void tearDownAfterClass() throws Exception { - if (host != null) { - host.stop(); - } - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.java deleted file mode 100644 index e95629c611..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.java +++ /dev/null @@ -1,84 +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.implementation.osgi.runtime; - -import java.io.File; -import java.lang.reflect.Proxy; -import java.net.URL; - -import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles; -import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl; -import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.equinox.launcher.Contribution; -import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - * Test the execution of an OSGi implementation type - * - * @version $Rev$ $Date$ - */ -public class OSGiTestCase { - private static NodeLauncher host; - private static Node node; - - @BeforeClass - public static void setUp() throws Exception { - host = NodeLauncher.newInstance(); - String compositeName = "osgitest.composite"; - URL bundle = - OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar", - "osgi.test", - null, - null, - (String[])null, - OSGiTestImpl.class, - OSGiTestInterface.class); - - node = - host.createNode(compositeName, new Contribution("c1", new File("target/test-classes").toURI().toString())); - node.start(); - } - - @AfterClass - public static void tearDown() throws Exception { - if (host != null) { - node.stop(); - host.destroy(); - } - } - - @Test - public void testOSGiComponent() throws Exception { - - OSGiTestInterface testService = node.getService(OSGiTestInterface.class, "OSGiTestServiceComponent"); - assert (testService != null); - - assert (testService instanceof Proxy); - - String str = testService.testService(); - System.out.println(str); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java deleted file mode 100644 index aad5772037..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java +++ /dev/null @@ -1,183 +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.implementation.osgi.test; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.HashSet; -import java.util.Set; -import java.util.jar.JarOutputStream; -import java.util.jar.Manifest; -import java.util.zip.ZipEntry; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.Constants; - -/** - * - * Utility class to create OSGi bundles - * - * @version $Rev$ $Date$ - */ -public class OSGiTestBundles { - private static String getPackageName(Class<?> cls) { - String name = cls.getName(); - int index = name.lastIndexOf('.'); - return index == -1 ? "" : name.substring(0, index); - } - - public static URL createBundle(String jarName, String mfFile, String[][] resources, Class<?>... classes) - throws IOException { - InputStream is = OSGiTestBundles.class.getClassLoader().getResourceAsStream(mfFile); - Manifest manifest = new Manifest(is); - is.close(); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - JarOutputStream jarOut = new JarOutputStream(out, manifest); - - for (Class<?> cls : classes) { - addClass(jarOut, cls); - } - - if (resources != null) { - for (String resource[] : resources) { - addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource[0], resource[1]); - } - } - - jarOut.close(); - out.close(); - - File jar = new File(jarName); - FileOutputStream fileOut = new FileOutputStream(jar); - fileOut.write(out.toByteArray()); - fileOut.close(); - - return jar.toURI().toURL(); - } - - public static URL createBundle(String jarName, - String bundleName, - String exports, - String imports, - String[] resources, - Class<?>... classes) throws IOException { - - Class<?> activator = null; - Set<String> packages = new HashSet<String>(); - StringBuffer exportPackages = new StringBuffer(); - if (exports != null) { - exportPackages.append(exports); - } - for (Class<?> cls : classes) { - if (BundleActivator.class.isAssignableFrom(cls)) { - activator = cls; - } - if (exports == null && cls.isInterface()) { - String pkg = getPackageName(cls); - if (packages.add(pkg)) { - exportPackages.append(pkg).append(","); - } - } - } - int len = exportPackages.length(); - if (len > 0 && exportPackages.charAt(len - 1) == ',') { - exportPackages.deleteCharAt(len - 1); - } - - Manifest manifest = new Manifest(); - // This attribute Manifest-Version is required so that the MF will be added to the jar - manifest.getMainAttributes().putValue("Manifest-Version", "1.0"); - manifest.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2"); - manifest.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, bundleName); - manifest.getMainAttributes().putValue(Constants.BUNDLE_VERSION, "1.0.0"); - manifest.getMainAttributes().putValue(Constants.BUNDLE_NAME, bundleName); - manifest.getMainAttributes().putValue(Constants.EXPORT_PACKAGE, exportPackages.toString()); - StringBuffer importPackages = new StringBuffer(); - if (imports != null) { - importPackages.append(imports).append(",org.osgi.framework"); - } else { - importPackages.append("org.osgi.framework"); - } - manifest.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, importPackages.toString()); - - if (activator != null) { - manifest.getMainAttributes().putValue(Constants.BUNDLE_ACTIVATOR, activator.getName()); - } - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - JarOutputStream jarOut = new JarOutputStream(out, manifest); - - for (Class<?> cls : classes) { - addClass(jarOut, cls); - } - - if (resources != null) { - for (String resource : resources) { - addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource, null); - } - } - - jarOut.close(); - out.close(); - - File jar = new File(jarName); - FileOutputStream fileOut = new FileOutputStream(jar); - fileOut.write(out.toByteArray()); - fileOut.close(); - - return jar.toURI().toURL(); - } - - private static void addClass(JarOutputStream jarOut, Class<?> javaClass) throws IOException, FileNotFoundException { - String classFile = javaClass.getName().replace('.', '/') + ".class"; - URL url = javaClass.getResource(javaClass.getSimpleName() + ".class"); - addEntry(jarOut, url, classFile); - } - - private static void addResource(JarOutputStream jarOut, ClassLoader cl, String resourceName, String entryName) - throws IOException, FileNotFoundException { - URL url = cl.getResource(resourceName); - if (entryName == null) { - entryName = resourceName; - } - addEntry(jarOut, url, entryName); - } - - private static void addEntry(JarOutputStream jarOut, URL url, String resourceName) throws IOException, - FileNotFoundException { - String path = url.getPath(); - - ZipEntry ze = new ZipEntry(resourceName); - - jarOut.putNextEntry(ze); - FileInputStream file = new FileInputStream(path); - byte[] fileContents = new byte[file.available()]; - file.read(fileContents); - jarOut.write(fileContents); - jarOut.closeEntry(); - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java deleted file mode 100644 index f6db6edc12..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java +++ /dev/null @@ -1,50 +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.implementation.osgi.test; - -import java.util.Hashtable; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -/** - * - * Test class - Implementation of an OSGi service - * - * @version $Rev$ $Date$ - */ -public class OSGiTestImpl implements OSGiTestInterface, BundleActivator { - - public String testService() { - - return OSGiTestImpl.class.getName(); - - } - - public void start(BundleContext bc) throws Exception { - - bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>()); - - } - - public void stop(BundleContext bc) throws Exception { - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java deleted file mode 100644 index 499ec8082e..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java +++ /dev/null @@ -1,32 +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.implementation.osgi.test; - -/** - * - * Test class - Interface for an OSGi service - * - * @version $Rev$ $Date$ - */ -public interface OSGiTestInterface { - - String testService() throws Exception; - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/add-component.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/add-component.xml deleted file mode 100644 index a7d563023c..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/add-component.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<scr:component name="AddComponent" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.dosgi.operations.AddServiceImpl" /> - <service> - <provide interface="calculator.dosgi.operations.AddService" /> - </service> -</scr:component> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/calculator-component.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/calculator-component.xml deleted file mode 100644 index 3e537df732..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/calculator-component.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<scr:component name="CalculatorComponent" - xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.dosgi.CalculatorServiceDSImpl" /> - <service> - <provide interface="calculator.dosgi.CalculatorService" /> - </service> - - <reference name="addService" interface="calculator.dosgi.operations.AddService" bind="setAddService" unbind="unsetAddService" - policy="dynamic" /> - <reference name="subtractService" interface="calculator.dosgi.operations.SubtractService" bind="setSubtractService" - unbind="unsetSubtractService" policy="dynamic" /> - <reference name="multiplyService" interface="calculator.dosgi.operations.MultiplyService" bind="setMultiplyService" - unbind="unsetMultiplyService" policy="dynamic" /> - <reference name="divideService" interface="calculator.dosgi.operations.DivideService" bind="setDivideService" - unbind="unsetDivideService" policy="dynamic" /> - -</scr:component> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/divide-component.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/divide-component.xml deleted file mode 100644 index def7fce23c..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/divide-component.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<scr:component name="DivideComponent" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.dosgi.operations.DivideServiceImpl" /> - <service> - <provide interface="calculator.dosgi.operations.DivideService" /> - </service> -</scr:component> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/multiply-component.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/multiply-component.xml deleted file mode 100644 index 57f627f990..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/multiply-component.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<scr:component name="MultiplyComponent" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.dosgi.operations.MultiplyServiceImpl" /> - <service> - <provide interface="calculator.dosgi.operations.MultiplyService" /> - </service> -</scr:component> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/subtract-component.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/subtract-component.xml deleted file mode 100644 index 073ee5ea40..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/subtract-component.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<scr:component name="SubtractComponent" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.dosgi.operations.SubtractServiceImpl" /> - <service> - <provide interface="calculator.dosgi.operations.SubtractService" /> - </service> -</scr:component> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF deleted file mode 100644 index 5a4db21087..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF +++ /dev/null @@ -1,19 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: calculator.dosgi;version="1.0.0"
-Bundle-Version: 1.0.0
-Bundle-Name: calculator.dosgi
-Bundle-Activator: calculator.dosgi.CalculatorActivator
-Bundle-ManifestVersion: 2
-Import-Package: calculator.dosgi.operations;version="1.0.0",
- org.osgi.framework,
- org.osgi.service.packageadmin,
- org.osgi.util.tracker,
- org.osgi.service.component;resolution:=optional
-Bundle-SymbolicName: calculator.dosgi
-Bundle-Vendor: The Apache Software Foundation
-Bundle-ActivationPolicy: lazy
-Eclipse-LazyStart: true
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-DocURL: http://www.apache.org/
-Service-Component: OSGI-INF/calculator-component.xml
-
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType deleted file mode 100644 index 7860094626..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
- <!-- The service elment defines an SCA view of the OSGi service -->
- <service name="Calculator">
- <!-- The interface will be mapped into the OSGi service class -->
- <interface.java interface="calculator.dosgi.CalculatorService"/>
- <!-- The list of OSGi properties -->
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </service>
-
- <!-- The reference elment defines an SCA proxy to a remote OSGi service -->
- <reference name="addService">
- <interface.java interface="calculator.dosgi.operations.AddService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
- <reference name="subtractService">
- <interface.java interface="calculator.dosgi.operations.SubtractService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
- <reference name="multiplyService">
- <interface.java interface="calculator.dosgi.operations.MultiplyService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
- <reference name="divideService">
- <interface.java interface="calculator.dosgi.operations.DivideService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
-
-</componentType>
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/calculator.composite b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/calculator.composite deleted file mode 100644 index 44d53f6345..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/calculator.composite +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://calculator.dosgi"
- name="CalculatorComposite">
-
- <component name="CalculatorComponent">
- <tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi" bundleVersion="1.0.0" />
- <reference name="addService" target="OperationsComponent/AddService">
- </reference>
- <reference name="subtractService" target="OperationsComponent/SubtractService">
- </reference>
- <reference name="multiplyService" target="OperationsComponent/MultiplyService">
- </reference>
- <reference name="divideService" target="OperationsComponent/DivideService">
- </reference>
- </component>
-
-</composite>
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF deleted file mode 100644 index eb15e778b1..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF +++ /dev/null @@ -1,20 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: calculator.dosgi.operations;version="1.0.0"
-Bundle-Version: 1.0.0
-Bundle-Name: calculator.dosgi.operations
-Bundle-Activator: calculator.dosgi.operations.OperationsActivator
-Bundle-ManifestVersion: 2
-Import-Package: calculator.dosgi.operations;version="1.0.0",
- org.osgi.framework,
- org.osgi.service.component;resolution:=optional
-Bundle-SymbolicName: calculator.dosgi.operations
-Bundle-Vendor: The Apache Software Foundation
-Bundle-ActivationPolicy: lazy
-Eclipse-LazyStart: true
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-DocURL: http://www.apache.org/
-Service-Component: OSGI-INF/add-component.xml,
- OSGI-INF/subtract-component.xml,
- OSGI-INF/multiply-component.xml,
- OSGI-INF/divide-component.xml
-
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType deleted file mode 100644 index 6f6f4bdce6..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
-
-
- <!-- The service elment defines an SCA proxy to a remote OSGi service -->
- <service name="AddService">
- <interface.java interface="calculator.dosgi.operations.AddService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </service>
- <service name="SubtractService">
- <interface.java interface="calculator.dosgi.operations.SubtractService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </service>
- <service name="MultiplyService">
- <interface.java interface="calculator.dosgi.operations.MultiplyService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </service>
- <service name="DivideService">
- <interface.java interface="calculator.dosgi.operations.DivideService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </service>
-
-</componentType>
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite b/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite deleted file mode 100644 index 964be5643e..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/operations.composite +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://calculator.dosgi"
- name="OperationsComposite">
-
- <component name="OperationsComponent">
- <tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi.operations" bundleVersion="1.0.0" />
- </component>
-
-</composite>
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/LICENSE b/sandbox/ant/sca/trunk/modules/implementation-osgi/LICENSE deleted file mode 100644 index 6b0b1270ff..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/LICENSE +++ /dev/null @@ -1,203 +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/sandbox/ant/sca/trunk/modules/implementation-osgi/NOTICE b/sandbox/ant/sca/trunk/modules/implementation-osgi/NOTICE deleted file mode 100644 index 25bb89c9b2..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2009 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/pom.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi/pom.xml deleted file mode 100644 index 2ec193e443..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/pom.xml +++ /dev/null @@ -1,150 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>2.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>tuscany-implementation-osgi</artifactId> - <name>Apache Tuscany SCA OSGi Implementation Extension</name> - - <packaging>jar</packaging> - - <dependencies> - - <dependency> - <groupId>org.eclipse</groupId> - <artifactId>osgi</artifactId> - <version>3.3.0-v20070530</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.osgi</groupId> - <artifactId>services</artifactId> - <version>3.1.200-v20070605</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-api</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca-api</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface-java-xml</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-xml</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly-xml</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>2.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-launcher-equinox</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-node-impl-osgi</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.5</version> - <scope>test</scope> - </dependency> - - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-sca</artifactId> - <version>2.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - </dependencies> - -</project> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultOSGiImplementationFactory.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultOSGiImplementationFactory.java deleted file mode 100644 index 545898fe5f..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultOSGiImplementationFactory.java +++ /dev/null @@ -1,34 +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.implementation.osgi; - -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationFactoryImpl; - -/** - * - */ -public class DefaultOSGiImplementationFactory extends OSGiImplementationFactoryImpl { - - public DefaultOSGiImplementationFactory(FactoryExtensionPoint factoryExtensionPoint) { - super(factoryExtensionPoint); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java deleted file mode 100644 index d7296e24bb..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.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.implementation.osgi; - -import org.apache.tuscany.sca.implementation.osgi.impl.ServiceDescriptionsFactoryImpl; - -/** - * - */ -public class DefaultServiceDescriptionsFactory extends ServiceDescriptionsFactoryImpl { - - public DefaultServiceDescriptionsFactory() { - super(); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java deleted file mode 100644 index 4551821f5a..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java +++ /dev/null @@ -1,53 +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.implementation.osgi; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Extensible; -import org.apache.tuscany.sca.assembly.Implementation; -import org.osgi.framework.Bundle; - -/** - * - * The model representing an OSGi implementation in an SCA assembly model. - * - * @version $Rev$ $Date$ - */ -public interface OSGiImplementation extends Implementation, Extensible { - // String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903"; - String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - - String BUNDLE_SYMBOLICNAME = "bundleSymbolicName"; - String BUNDLE_VERSION = "bundleVersion"; - QName IMPLEMENTATION_OSGI = new QName(SCA11_TUSCANY_NS, "implementation.osgi"); - - String getBundleSymbolicName(); - - void setBundleSymbolicName(String name); - - String getBundleVersion(); - - void setBundleVersion(String version); - - Bundle getBundle(); - - void setBundle(Bundle bundle); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java deleted file mode 100644 index 0a83624e76..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.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.implementation.osgi; - -/** - * The factory interface to create OSGiImplementation instances - */ -public interface OSGiImplementationFactory { - /** - * Create a new instance of OSGiImplementation - * @return - */ - OSGiImplementation createOSGiImplementation(); - - /** - * - * @return - */ - OSGiProperty createOSGiProperty(); -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java deleted file mode 100644 index 8509e866ef..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.osgi; - -import javax.xml.namespace.QName; - -/** - * <tuscany:osgi.property> - */ -public interface OSGiProperty { - String NAME = "name"; - QName PROPERTY_QNAME = new QName(OSGiImplementation.SCA11_TUSCANY_NS, "osgi.property"); - - String getValue(); - - void setValue(String value); - - String getName(); - - void setName(String name); -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java deleted file mode 100644 index 832e26a48f..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.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.implementation.osgi; - -import java.util.List; -import java.util.Map; - - -/** - * The OSGi RFC 119 description of a remote OSGi service - */ -public interface ServiceDescription { - List<String> getInterfaces(); - - Map<String, Object> getProperties(); -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java deleted file mode 100644 index 36968615c0..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.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.implementation.osgi; - -import java.util.List; - -import javax.xml.namespace.QName; - - -/** - * OSGi RFC 119 service descriptions - */ -public interface ServiceDescriptions extends List<ServiceDescription> { - - String REMOTE_SERVICE_FOLDER = "OSGI-INF/remote-service"; - String OSGI_SD_NS = "http://www.osgi.org/xmlns/sd/v1.0.0"; - QName SERVICE_DESCRIPTIONS_QNAME = new QName(OSGI_SD_NS, "service-descriptions"); - QName SERVICE_DESCRIPTION_QNAME = new QName(OSGI_SD_NS, "service-description"); - String REMOTE_SERVICE_HEADER = "Remote-Service"; - String PROP_SERVICE_INTENTS = "service.intents"; - String PROP_REQUIRES_INTENTS = "osgi.remote.requires.intents"; - String PROP_CONFIGURATION_TYPE = "osgi.remote.configuration.type"; - String CONFIGURATION_TYPE_SCA = "sca"; - String PROP_CONFIGURATION_SCA_BINDINGS = "osgi.remote.configuration.sca.bindings"; -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java deleted file mode 100644 index 0e4c51b1f9..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.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.implementation.osgi; - -/** - * The factory interface to create OSGi RFC 119 service descriptions - */ -public interface ServiceDescriptionsFactory { - ServiceDescriptions createServiceDescriptions(); - - ServiceDescription createServiceDescription(); -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java deleted file mode 100644 index 80b68d1728..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.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.implementation.osgi.impl; - -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory; -import org.apache.tuscany.sca.implementation.osgi.OSGiProperty; - -/** - * - */ -public class OSGiImplementationFactoryImpl implements OSGiImplementationFactory { - private final FactoryExtensionPoint factoryExtensionPoint; - - public OSGiImplementationFactoryImpl(FactoryExtensionPoint factoryExtensionPoint) { - super(); - this.factoryExtensionPoint = factoryExtensionPoint; - } - - public OSGiImplementation createOSGiImplementation() { - return new OSGiImplementationImpl(factoryExtensionPoint); - } - - public OSGiProperty createOSGiProperty() { - return new OSGiPropertyImpl(); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java deleted file mode 100644 index d9641def69..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java +++ /dev/null @@ -1,160 +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.implementation.osgi.impl; - -import java.util.Hashtable; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.osgi.framework.Bundle; - -/** - * OSGi implementation - * All attributes from <implementation.osgi> have getters in this class - * This class implements OSGiImplementationInterface which is associated with OSGiImplementationProvider. - * - * @version $Rev$ $Date$ - */ -public class OSGiImplementationImpl extends ImplementationImpl implements OSGiImplementation { - - private String bundleSymbolicName; - private String bundleVersion; - private Bundle osgiBundle; - - private Hashtable<String, List<ComponentProperty>> referenceProperties; - private Hashtable<String, List<ComponentProperty>> serviceProperties; - - private Hashtable<String, List<ComponentProperty>> referenceCallbackProperties; - private Hashtable<String, List<ComponentProperty>> serviceCallbackProperties; - - private FactoryExtensionPoint modelFactories; - - - protected OSGiImplementationImpl(FactoryExtensionPoint modelFactories) { - this.modelFactories = modelFactories; - } - - public OSGiImplementationImpl(FactoryExtensionPoint modelFactories, - String bundleSymbolicName, - String bundleVersion, - Hashtable<String, List<ComponentProperty>> refProperties, - Hashtable<String, List<ComponentProperty>> serviceProperties) { - - super(); - this.bundleSymbolicName = bundleSymbolicName; - this.bundleVersion = bundleVersion; - this.referenceProperties = refProperties; - this.serviceProperties = serviceProperties; - this.modelFactories = modelFactories; - } - - public void setCallbackProperties(Hashtable<String, List<ComponentProperty>> refCallbackProperties, - Hashtable<String, List<ComponentProperty>> serviceCallbackProperties) { - - this.referenceCallbackProperties = refCallbackProperties; - this.serviceCallbackProperties = serviceCallbackProperties; - - } - - public String getBundleSymbolicName() { - return bundleSymbolicName; - } - - public String getBundleVersion() { - return bundleVersion; - } - - public FactoryExtensionPoint getModelFactories() { - return modelFactories; - } - - public List<ComponentProperty> getReferenceProperties(String referenceName) { - return referenceProperties.get(referenceName); - } - - public List<ComponentProperty> getServiceProperties(String serviceName) { - return serviceProperties.get(serviceName); - } - - public List<ComponentProperty> getReferenceCallbackProperties(String referenceName) { - return referenceCallbackProperties.get(referenceName); - } - - public List<ComponentProperty> getServiceCallbackProperties(String serviceName) { - return serviceCallbackProperties.get(serviceName); - } - - /** - * Since OSGi implementation annotations may not be processed until much later, leave it to - * the OSGi invoker to decide whether pass-by-reference is allowed. - * @return - */ - public boolean isAllowsPassByReference() { - return true; - } - - public Bundle getBundle() { - return osgiBundle; - } - - public void setBundle(Bundle osgiBundle) { - this.osgiBundle = osgiBundle; - } - - private boolean areEqual(Object obj1, Object obj2) { - if (obj1 == obj2) - return true; - if (obj1 == null || obj2 == null) - return false; - return obj1.equals(obj2); - } - - @Override - public boolean equals(Object obj) { - - if (!(obj instanceof OSGiImplementationImpl)) - return super.equals(obj); - OSGiImplementationImpl impl = (OSGiImplementationImpl)obj; - if (!areEqual(bundleSymbolicName, impl.bundleSymbolicName)) - return false; - if (!areEqual(bundleVersion, impl.bundleVersion)) - return false; - if (!areEqual(serviceProperties, impl.serviceProperties)) - return false; - if (!areEqual(serviceCallbackProperties, impl.serviceCallbackProperties)) - return false; - if (!areEqual(referenceProperties, impl.referenceProperties)) - return false; - if (!areEqual(referenceCallbackProperties, impl.referenceCallbackProperties)) - return false; - return super.equals(obj); - } - - public void setBundleSymbolicName(String bundleSymbolicName) { - this.bundleSymbolicName = bundleSymbolicName; - } - - public void setBundleVersion(String bundleVersion) { - this.bundleVersion = bundleVersion; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java deleted file mode 100644 index a3944c66c0..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.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.implementation.osgi.impl; - -import org.apache.tuscany.sca.implementation.osgi.OSGiProperty; - -/** - * Implementation of OSGiProperty - */ -public class OSGiPropertyImpl implements OSGiProperty { - protected OSGiPropertyImpl() { - super(); - } - - private String name; - private String value; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java deleted file mode 100644 index eeacdb9702..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.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.implementation.osgi.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.implementation.osgi.ServiceDescription; - -/** - * The OSGi RFC 119 description of a remote OSGi service - */ -public class ServiceDescriptionImpl implements ServiceDescription { - protected ServiceDescriptionImpl() { - super(); - } - - private List<String> interfaces = new ArrayList<String>(); - private Map<String, Object> properties = new HashMap<String, Object>(); - - public List<String> getInterfaces() { - return interfaces; - } - - public Map<String, Object> getProperties() { - return properties; - } - - public String toString() { - return "service-description: interfaces=" + interfaces + "properties=" + properties; - } -}
\ No newline at end of file diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java deleted file mode 100644 index 8cd3867610..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.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.implementation.osgi.impl; - -import org.apache.tuscany.sca.implementation.osgi.ServiceDescription; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory; - -/** - * The factory implementation - */ -public class ServiceDescriptionsFactoryImpl implements ServiceDescriptionsFactory { - - protected ServiceDescriptionsFactoryImpl() { - super(); - } - - public ServiceDescription createServiceDescription() { - return new ServiceDescriptionImpl(); - } - - public ServiceDescriptions createServiceDescriptions() { - return new ServiceDescriptionsImpl(); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java deleted file mode 100644 index c249c053a4..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.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.implementation.osgi.impl; - -import java.util.ArrayList; - -import org.apache.tuscany.sca.implementation.osgi.ServiceDescription; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions; - -/** - * - */ -public class ServiceDescriptionsImpl extends ArrayList<ServiceDescription> implements ServiceDescriptions { - private static final long serialVersionUID = 6205649013621747968L; - - protected ServiceDescriptionsImpl() { - super(); - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationActivator.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationActivator.java deleted file mode 100644 index ce7b1dc920..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationActivator.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.osgi.xml; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -/** - * Bundle activator to receive the BundleContext - */ -public class OSGiImplementationActivator implements BundleActivator { - private static BundleContext bundleContext; - - public void start(BundleContext context) throws Exception { - bundleContext = context; - } - - public void stop(BundleContext context) throws Exception { - bundleContext = null; - } - - static BundleContext getBundleContext() { - return bundleContext; - } - - static void setBundleContext(BundleContext bundleContext) { - OSGiImplementationActivator.bundleContext = bundleContext; - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java deleted file mode 100644 index b3ecc240cc..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java +++ /dev/null @@ -1,244 +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.implementation.osgi.xml; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import static org.apache.tuscany.sca.implementation.osgi.OSGiImplementation.BUNDLE_SYMBOLICNAME; -import static org.apache.tuscany.sca.implementation.osgi.OSGiImplementation.BUNDLE_VERSION; -import static org.apache.tuscany.sca.implementation.osgi.OSGiImplementation.IMPLEMENTATION_OSGI; - -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ComponentType; -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.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.Version; - -/** - * - * Process an <implementation.osgi/> element in a component definition. An instance of - * OSGiImplementation is created. - * Also associates the component type file with the implementation. - * - * @version $Rev$ $Date$ - */ -public class OSGiImplementationProcessor implements StAXArtifactProcessor<OSGiImplementation> { - private AssemblyFactory assemblyFactory; - // private FactoryExtensionPoint modelFactories; - private OSGiImplementationFactory osgiImplementationFactory; - private Monitor monitor; - - public OSGiImplementationProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { - this.monitor = monitor; - // this.modelFactories = modelFactories; - this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - this.osgiImplementationFactory = modelFactories.getFactory(OSGiImplementationFactory.class); - } - - /** - * Report a error. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Object... messageParameters) { - if (monitor != null) { - Problem problem = - monitor.createProblem(this.getClass().getName(), - "impl-osgi-validation-messages", - Severity.ERROR, - model, - message, - (Object[])messageParameters); - monitor.problem(problem); - } - } - - public QName getArtifactType() { - return IMPLEMENTATION_OSGI; - } - - public Class<OSGiImplementation> getModelType() { - return OSGiImplementation.class; - } - - public OSGiImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - assert IMPLEMENTATION_OSGI.equals(reader.getName()); - - String bundleSymbolicName = reader.getAttributeValue(null, BUNDLE_SYMBOLICNAME); - String bundleVersion = reader.getAttributeValue(null, BUNDLE_VERSION); - - OSGiImplementation implementation = osgiImplementationFactory.createOSGiImplementation(); - implementation.setBundleSymbolicName(bundleSymbolicName); - implementation.setBundleVersion(bundleVersion); - - implementation.setUnresolved(true); - - // Skip to the end of <implementation.osgi> - while (reader.hasNext()) { - int next = reader.next(); - switch (next) { - case START_ELEMENT: - break; - case END_ELEMENT: - if (IMPLEMENTATION_OSGI.equals(reader.getName())) { - return implementation; - } - break; - } - } - return implementation; - } - - public void resolve(OSGiImplementation impl, ModelResolver resolver) throws ContributionResolveException { - - if (impl == null || !impl.isUnresolved()) - return; - - impl.setUnresolved(false); - - BundleContext bundleContext = OSGiImplementationActivator.getBundleContext(); - Bundle bundle = null; - for (Bundle b : bundleContext.getBundles()) { - String sn = b.getSymbolicName(); - String ver = (String)b.getHeaders().get(Constants.BUNDLE_VERSION); - if (!impl.getBundleSymbolicName().equals(sn)) { - continue; - } - Version v1 = Version.parseVersion(ver); - Version v2 = Version.parseVersion(impl.getBundleVersion()); - if (v1.equals(v2)) { - bundle = b; - break; - } - } - if (bundle != null) { - impl.setBundle(bundle); - } else { - error("CouldNotLocateOSGiBundle", impl, impl.getBundleSymbolicName()); - //throw new ContributionResolveException("Could not locate OSGi bundle " + - //impl.getBundleSymbolicName()); - return; - } - - ComponentType componentType = assemblyFactory.createComponentType(); - componentType.setURI("OSGI-INF/sca/bundle.componentType"); - componentType.setUnresolved(true); - componentType = resolver.resolveModel(ComponentType.class, componentType); - if (componentType.isUnresolved()) { - error("MissingComponentTypeFile", impl, componentType.getURI()); - //throw new ContributionResolveException("missing .componentType side file " + ctURI); - return; - } - - List<Service> services = componentType.getServices(); - for (Service service : services) { - Interface interfaze = service.getInterfaceContract().getInterface(); - if (interfaze instanceof JavaInterface) { - JavaInterface javaInterface = (JavaInterface)interfaze; - if (javaInterface.getJavaClass() == null) { - javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName())); - } - if (service.getInterfaceContract().getCallbackInterface() instanceof JavaInterface) { - JavaInterface callbackInterface = - (JavaInterface)service.getInterfaceContract().getCallbackInterface(); - if (callbackInterface.getJavaClass() == null) { - callbackInterface.setJavaClass(getJavaClass(resolver, callbackInterface.getName())); - } - } - - impl.getServices().add(service); - } - } - - List<Reference> references = componentType.getReferences(); - for (Reference reference : references) { - Interface interfaze = reference.getInterfaceContract().getInterface(); - if (interfaze instanceof JavaInterface) { - JavaInterface javaInterface = (JavaInterface)interfaze; - if (javaInterface.getJavaClass() == null) { - javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName())); - } - impl.getReferences().add(reference); - } else - impl.getReferences().add(reference); - } - - List<Property> properties = componentType.getProperties(); - for (Property property : properties) { - impl.getProperties().add(property); - } - impl.setConstrainingType(componentType.getConstrainingType()); - - } - - private Class getJavaClass(ModelResolver resolver, String className) { - ClassReference ref = new ClassReference(className); - ref = resolver.resolveModel(ClassReference.class, ref); - return ref.getJavaClass(); - } - - public void write(OSGiImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException, - XMLStreamException { - - //FIXME Implement this method - } - - private QName getQNameValue(XMLStreamReader reader, String value) { - if (value != null) { - int index = value.indexOf(':'); - String prefix = index == -1 ? "" : value.substring(0, index); - String localName = index == -1 ? value : value.substring(index + 1); - String ns = reader.getNamespaceContext().getNamespaceURI(prefix); - if (ns == null) { - ns = ""; - } - return new QName(ns, localName, prefix); - } else { - return null; - } - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.java deleted file mode 100644 index 5a8f5c4694..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.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.implementation.osgi.xml; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.NAME; -import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.PROPERTY_QNAME; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory; -import org.apache.tuscany.sca.implementation.osgi.OSGiProperty; -import org.apache.tuscany.sca.monitor.Monitor; - -/** - * A processor for <tuscany:osgi.property> - */ -public class OSGiPropertyProcessor implements StAXArtifactProcessor<OSGiProperty> { - private OSGiImplementationFactory factory; - private Monitor monitor; - - public OSGiPropertyProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { - this.monitor = monitor; - this.factory = modelFactories.getFactory(OSGiImplementationFactory.class); - } - - public OSGiProperty read(XMLStreamReader reader) throws XMLStreamException { - int event = reader.getEventType(); - OSGiProperty prop = null; - while (true) { - switch (event) { - case START_ELEMENT: - QName name = reader.getName(); - if (PROPERTY_QNAME.equals(name)) { - prop = factory.createOSGiProperty(); - prop.setName(reader.getAttributeValue(null, NAME)); - // After the following call, the reader will be positioned at END_ELEMENT - String text = reader.getElementText(); - if (text != null) { - text = text.trim(); - } - prop.setValue(text); - return prop; - } - break; - case END_ELEMENT: - name = reader.getName(); - if (PROPERTY_QNAME.equals(name)) { - return prop; - } - break; - } - if (reader.hasNext()) { - event = reader.next(); - } else { - return prop; - } - } - } - - public QName getArtifactType() { - return PROPERTY_QNAME; - } - - public void write(OSGiProperty model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - writer.writeStartElement(PROPERTY_QNAME.getNamespaceURI(), PROPERTY_QNAME.getLocalPart()); - writer.writeAttribute(NAME, model.getName()); - writer.writeCharacters(model.getValue()); - writer.writeEndElement(); - } - - public Class<OSGiProperty> getModelType() { - return OSGiProperty.class; - } - - public void resolve(OSGiProperty model, ModelResolver resolver) throws ContributionResolveException { - // TODO: To be implemented - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.java deleted file mode 100644 index d2d433d6c2..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsDocumentProcessor.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.implementation.osgi.xml; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URL; -import java.net.URLConnection; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions; -import org.apache.tuscany.sca.monitor.Monitor; - -/** - * The service descriptions document processor - */ -public class ServiceDescriptionsDocumentProcessor implements URLArtifactProcessor<ServiceDescriptions> { - private XMLInputFactory inputFactory; - private StAXArtifactProcessor extensionProcessor; - - public ServiceDescriptionsDocumentProcessor(FactoryExtensionPoint modelFactories, - StAXArtifactProcessor staxProcessor, - Monitor monitor) { - super(); - this.extensionProcessor = extensionProcessor; - this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class); - } - - public String getArtifactType() { - return "/OSGI-INF/remote-service/*.xml"; - } - - public ServiceDescriptions read(URL contributionURL, URI artifactURI, URL artifactURL) - throws ContributionReadException { - InputStream is = null; - try { - URLConnection connection = artifactURL.openConnection(); - connection.setUseCaches(false); - is = connection.getInputStream(); - } catch (IOException e) { - ContributionReadException ce = new ContributionReadException(e); - throw ce; - } - try { - XMLStreamReader reader = inputFactory.createXMLStreamReader(is); - Object result = extensionProcessor.read(reader); - return (ServiceDescriptions)result; - } catch (XMLStreamException e) { - ContributionReadException ce = new ContributionReadException(e); - throw ce; - } finally { - try { - if (is != null) { - is.close(); - is = null; - } - } catch (IOException ioe) { - //ignore - } - } - - } - - public Class<ServiceDescriptions> getModelType() { - return ServiceDescriptions.class; - } - - public void resolve(ServiceDescriptions model, ModelResolver resolver) throws ContributionResolveException { - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java deleted file mode 100644 index bef07d159d..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java +++ /dev/null @@ -1,153 +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.implementation.osgi.xml; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescription; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory; -import org.apache.tuscany.sca.monitor.Monitor; - -/* -<?xml version="1.0" encoding="UTF-8"?> -<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/v1.0.0"> - <service-description> - <provide interface="com.iona.soa.pojo.hello.HelloService"/> - <property name="service.intents">SOAP HTTP</property> - <property name="osgi.remote.configuration.type">pojo</property> - <property name="osgi.remote.configuration.pojo.address"> - http://localhost:9000/hello - </property> - </service-description> - <service-description> - <provide interface="com.iona.soa.pojo.hello.GreeterService"/> - <property name="service.intents">SOAP HTTP</property> - <property name="osgi.remote.configuration.type">pojo</property> - <property name="osgi.remote.configuration.pojo.address"> - http://localhost:9005/greeter - </property> - </service-description> -</service-descriptions> -*/ -public class ServiceDescriptionsProcessor implements StAXArtifactProcessor<ServiceDescriptions> { - private ServiceDescriptionsFactory factory; - private Monitor monitor; - - public ServiceDescriptionsProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { - this.monitor = monitor; - this.factory = modelFactories.getFactory(ServiceDescriptionsFactory.class); - } - - public ServiceDescriptions read(XMLStreamReader reader) throws XMLStreamException { - int event = reader.getEventType(); - ServiceDescriptions sds = factory.createServiceDescriptions(); - ServiceDescription sd = null; - while (true) { - switch (event) { - case XMLStreamConstants.START_ELEMENT: - QName name = reader.getName(); - if (ServiceDescriptions.SERVICE_DESCRIPTION_QNAME.equals(name)) { - sd = factory.createServiceDescription(); - sds.add(sd); - } else if ("provide".equals(name.getLocalPart())) { - String interfaceName = reader.getAttributeValue(null, "interface"); - if (interfaceName != null) { - sd.getInterfaces().add(interfaceName); - } - } else if ("property".equals(name.getLocalPart())) { - String propName = reader.getAttributeValue(null, "name"); - String propValue = reader.getAttributeValue(null, "value"); - String propType = reader.getAttributeValue(null, "type"); - if (propType == null) { - propType = "String"; - } - if (propValue == null) { - propValue = reader.getElementText(); - } - if (propValue != null) { - propValue = propValue.trim(); - } - Object prop = propValue; - if ("Integer".equals(propType)) { - prop = Integer.valueOf(propValue); - } else if ("Long".equals(propType)) { - prop = Long.valueOf(propValue); - } else if ("Float".equals(propType)) { - prop = Float.valueOf(propValue); - } else if ("Double".equals(propType)) { - prop = Double.valueOf(propValue); - } else if ("Short".equals(propType)) { - prop = Short.valueOf(propValue); - } else if ("Character".equals(propType)) { - prop = propValue.charAt(0); - } else if ("Byte".equals(propType)) { - prop = Byte.valueOf(propValue); - } else if ("Boolean".equals(propType)) { - prop = Boolean.valueOf(propValue); - } - sd.getProperties().put(propName, prop); - } - break; - case XMLStreamConstants.END_ELEMENT: - name = reader.getName(); - if (ServiceDescriptions.SERVICE_DESCRIPTION_QNAME.equals(name)) { - // Reset the sd - sd = null; - } - if (ServiceDescriptions.SERVICE_DESCRIPTIONS_QNAME.equals(name)) { - return sds; - } - break; - } - if (reader.hasNext()) { - event = reader.next(); - } else { - return sds; - } - } - } - - public QName getArtifactType() { - return ServiceDescriptions.SERVICE_DESCRIPTIONS_QNAME; - } - - public void write(ServiceDescriptions model, XMLStreamWriter writer) throws ContributionWriteException, - XMLStreamException { - // TODO: To be implemented - } - - public Class<ServiceDescriptions> getModelType() { - return ServiceDescriptions.class; - } - - public void resolve(ServiceDescriptions model, ModelResolver resolver) throws ContributionResolveException { - // TODO: To be implemented - } -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/definitions.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/definitions.xml deleted file mode 100644 index f531c2c4ed..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/definitions.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<sca:definitions xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903" - targetNamespace="http://www.osgi.org/xmlns/sca/intents/v1.0.0"> - - <intent name="passByReference" constrains="sca:implementation" - intentType="implementation"> - <description> - An OSGi intent to pass data by reference - </description> - </intent> - - <intent name="passByValue" constrains="sca:implementation" - intentType="implementation"> - <description> - An OSGi intent to pass data by value - </description> - </intent> - -</sca:definitions>
\ No newline at end of file diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index c9ee094d9b..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,21 +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. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementation.osgi,model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementation -org.apache.tuscany.sca.implementation.osgi.xml.ServiceDescriptionsProcessor;qname=http://www.osgi.org/xmlns/sd/v1.0.0#service-descriptions;model=org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions -org.apache.tuscany.sca.implementation.osgi.xml.OSGiPropertyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#osgi.property,model=org.apache.tuscany.sca.implementation.osgi.OSGiProperty diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor deleted file mode 100644 index 974dd4588d..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor +++ /dev/null @@ -1,19 +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. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.implementation.osgi.xml.ServiceDescriptionsDocumentProcessor;type=/OSGI-INF/remote-service/remote-services.xml,model=org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory deleted file mode 100644 index 6ec156ae81..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory +++ /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.implementation.osgi.DefaultOSGiImplementationFactory
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory deleted file mode 100644 index 0d01b7d6a5..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory +++ /dev/null @@ -1,17 +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.implementation.osgi.DefaultServiceDescriptionsFactory
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index c2cd957351..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +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.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementation
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties deleted file mode 100644 index 2503be0b13..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties +++ /dev/null @@ -1,25 +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. -# -# -ContributionReadException = ContributionReadException occured due to: -ContributionResolveException = ContributionResolveException occured due to: -PropertyShouldSpecifySR = Properties in implementation.osgi should specify service or reference -CouldNotLocateOSGiBundle = Could not locate OSGi bundle: {0} -MissingComponentTypeFile = Missing .componentType side file: {0}
\ No newline at end of file diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/CalculatorService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/CalculatorService.java deleted file mode 100644 index 656b78b717..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/CalculatorService.java +++ /dev/null @@ -1,39 +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 calculator.dosgi; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The Calculator service interface. - */ -@Remotable -public interface CalculatorService extends Remote { - - double add(double n1, double n2) throws RemoteException; - - double subtract(double n1, double n2) throws RemoteException; - - double multiply(double n1, double n2) throws RemoteException; - - double divide(double n1, double n2) throws RemoteException; -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/AddService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/AddService.java deleted file mode 100644 index 971500782f..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/AddService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the add service - */ -@Remotable -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/DivideService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/DivideService.java deleted file mode 100644 index 49b8a1c0bf..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/DivideService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the divide service - */ -@Remotable -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/MultiplyService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/MultiplyService.java deleted file mode 100644 index f4e59d12ea..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/MultiplyService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the multiply service - */ -@Remotable -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/SubtractService.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/SubtractService.java deleted file mode 100644 index bfb9b820f7..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/calculator/dosgi/operations/SubtractService.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 calculator.dosgi.operations; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the subtract service - */ -@Remotable -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java deleted file mode 100644 index 511356c90b..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java +++ /dev/null @@ -1,135 +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.implementation.osgi.xml; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.implementation.osgi.OSGiProperty; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Test reading OSGi implementations. - * - * @version $Rev$ $Date$ - */ -public class OSGiReadImplTestCase { - - private static XMLInputFactory inputFactory; - private static StAXArtifactProcessor<Object> staxProcessor; - private static CompositeBuilder compositeBuilder; - - @BeforeClass - public static void setUp() throws Exception { - DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessorExtensionPoint staxProcessors = - new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); - - compositeBuilder = - extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class) - .getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); - - } - - @Test - public void testReadComposite() throws Exception { - InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite"); - XMLStreamReader reader = inputFactory.createXMLStreamReader(is); - Composite composite = (Composite)staxProcessor.read(reader); - assertNotNull(composite); - - compositeBuilder.build(composite, null, null); - } - - @Test - public void testReadAndResolveComposite() throws Exception { - InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite"); - XMLStreamReader reader = inputFactory.createXMLStreamReader(is); - Composite composite = (Composite)staxProcessor.read(reader); - assertNotNull(composite); - - is = getClass().getClassLoader().getResourceAsStream("OSGI-INF/sca/bundle.componentType"); - reader = inputFactory.createXMLStreamReader(is); - ComponentType componentType = (ComponentType)staxProcessor.read(reader); - - assertEquals(1, componentType.getServices().size()); - Object prop1 = componentType.getServices().get(0).getExtensions().get(0); - assertTrue(prop1 instanceof OSGiProperty); - OSGiProperty osgiProp1 = (OSGiProperty)prop1; - assertEquals("1", osgiProp1.getValue()); - assertEquals("prop1", osgiProp1.getName()); - - assertEquals(4, componentType.getReferences().size()); - Object prop2 = componentType.getReferences().get(0).getExtensions().get(1); - assertTrue(prop2 instanceof OSGiProperty); - OSGiProperty osgiProp2 = (OSGiProperty)prop2; - assertEquals("ABC", osgiProp2.getValue()); - assertEquals("prop2", osgiProp2.getName()); - - ModelResolver resolver = new TestModelResolver(getClass().getClassLoader()); - staxProcessor.resolve(componentType, resolver); - resolver.addModel(componentType); - - staxProcessor.resolve(composite, resolver); - - compositeBuilder.build(composite, null, null); - } - - @Test - public void testReadOSGiImplementation() throws Exception { - - String str = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<implementation.osgi xmlns=\"http://tuscany.apache.org/xmlns/sca/1.1\" targetNamespace=\"http://test\" " - + "bundleSymbolicName=\"osgi.test\" " - + "bundleVersion=\"1.0.0\" " - + "/>"; - ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes()); - - XMLStreamReader reader = inputFactory.createXMLStreamReader(is); - reader.nextTag(); - - OSGiImplementation osgiImpl = (OSGiImplementation)staxProcessor.read(reader); - - assertEquals(osgiImpl.getBundleSymbolicName(), "osgi.test"); - assertEquals(osgiImpl.getBundleVersion(), "1.0.0"); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java deleted file mode 100644 index 7a4ae3e6de..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.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.implementation.osgi.xml; - -import java.io.StringReader; -import java.util.List; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.DefaultFactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.osgi.ServiceDescription; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * - */ -public class ServiceDescriptionsTestCase { - private static final String xml = - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<service-descriptions xmlns=\"http://www.osgi.org/xmlns/sd/v1.0.0\">" - + "<service-description>" - + "<provide interface=\"com.iona.soa.pojo.hello.HelloService\"/>" - + "<property name=\"service.intents\">SOAP HTTP</property>" - + "<property name=\"osgi.remote.configuration.type\">pojo</property>" - + "<property name=\"osgi.remote.configuration.pojo.address\">" - + "http://localhost:9000/hello" - + "</property>" - + "</service-description>" - + "<service-description>" - + "<provide interface=\"com.iona.soa.pojo.hello.GreeterService\"/>" - + "<property name=\"service.intents\">SOAP HTTP</property>" - + "<property name=\"osgi.remote.configuration.type\">pojo</property>" - + "<property name=\"osgi.remote.configuration.pojo.address\">" - + "http://localhost:9005/greeter" - + "</property>" - + "</service-description>" - + "</service-descriptions>"; - - private static XMLStreamReader reader; - - /** - * @throws java.lang.Exception - */ - @BeforeClass - public static void setUpBeforeClass() throws Exception { - XMLInputFactory factory = XMLInputFactory.newInstance(); - reader = factory.createXMLStreamReader(new StringReader(xml)); - } - - @Test - public void testLoad() throws Exception { - ServiceDescriptionsProcessor processor = - new ServiceDescriptionsProcessor(new DefaultFactoryExtensionPoint(new DefaultExtensionPointRegistry()), - null); - List<ServiceDescription> descriptions = processor.read(reader); - Assert.assertEquals(2, descriptions.size()); - System.out.println(descriptions); - } - - /** - * @throws java.lang.Exception - */ - @AfterClass - public static void tearDownAfterClass() throws Exception { - if (reader != null) { - reader.close(); - } - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java deleted file mode 100644 index 7cae6abda2..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java +++ /dev/null @@ -1,104 +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.implementation.osgi.xml; - -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationImpl; - -/** - * A default implementation of an artifact resolver, based on a map. - * - * @version $Rev$ $Date$ - */ -public class TestModelResolver implements ModelResolver { - private static final long serialVersionUID = -7826976465762296634L; - - private Map<Object, Object> map = new HashMap<Object, Object>(); - - private WeakReference<ClassLoader> classLoader; - - public TestModelResolver(ClassLoader classLoader) { - this.classLoader = new WeakReference<ClassLoader>(classLoader); - } - - public <T> T resolveModel(Class<T> modelClass, T unresolved) { - Object resolved = map.get(unresolved); - if (resolved != null) { - - if (unresolved instanceof OSGiImplementationImpl && !(resolved instanceof OSGiImplementationImpl)) { - - OSGiImplementationImpl impl = ((OSGiImplementationImpl)unresolved); - ComponentType componentType = (ComponentType)resolved; - - List<Property> properties = componentType.getProperties(); - for (Property property : properties) { - impl.getProperties().add(property); - } - impl.setUnresolved(false); - return unresolved; - } - - // Return the resolved object - return modelClass.cast(resolved); - - } else if (unresolved instanceof ClassReference) { - - // Load a class on demand - ClassReference classReference = (ClassReference)unresolved; - Class clazz; - try { - clazz = Class.forName(classReference.getClassName(), true, classLoader.get()); - } catch (ClassNotFoundException e) { - - // Return the unresolved object - return unresolved; - } - - // Store a new ClassReference wrapping the loaded class - resolved = new ClassReference(clazz); - map.put(resolved, resolved); - - // Return the resolved ClassReference - return modelClass.cast(resolved); - - } else { - - // Return the unresolved object - return unresolved; - } - } - - public void addModel(Object resolved) { - map.put(resolved, resolved); - } - - public Object removeModel(Object resolved) { - return map.remove(resolved); - } - -} diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml deleted file mode 100644 index 3e537df732..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/OSGI-INF/calculator-component.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<scr:component name="CalculatorComponent" - xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"> - <implementation class="calculator.dosgi.CalculatorServiceDSImpl" /> - <service> - <provide interface="calculator.dosgi.CalculatorService" /> - </service> - - <reference name="addService" interface="calculator.dosgi.operations.AddService" bind="setAddService" unbind="unsetAddService" - policy="dynamic" /> - <reference name="subtractService" interface="calculator.dosgi.operations.SubtractService" bind="setSubtractService" - unbind="unsetSubtractService" policy="dynamic" /> - <reference name="multiplyService" interface="calculator.dosgi.operations.MultiplyService" bind="setMultiplyService" - unbind="unsetMultiplyService" policy="dynamic" /> - <reference name="divideService" interface="calculator.dosgi.operations.DivideService" bind="setDivideService" - unbind="unsetDivideService" policy="dynamic" /> - -</scr:component> diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType deleted file mode 100644 index 7860094626..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/OSGI-INF/sca/bundle.componentType +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
- <!-- The service elment defines an SCA view of the OSGi service -->
- <service name="Calculator">
- <!-- The interface will be mapped into the OSGi service class -->
- <interface.java interface="calculator.dosgi.CalculatorService"/>
- <!-- The list of OSGi properties -->
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </service>
-
- <!-- The reference elment defines an SCA proxy to a remote OSGi service -->
- <reference name="addService">
- <interface.java interface="calculator.dosgi.operations.AddService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
- <reference name="subtractService">
- <interface.java interface="calculator.dosgi.operations.SubtractService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
- <reference name="multiplyService">
- <interface.java interface="calculator.dosgi.operations.MultiplyService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
- <reference name="divideService">
- <interface.java interface="calculator.dosgi.operations.DivideService"/>
- <t:osgi.property name="prop1">1</t:osgi.property>
- <t:osgi.property name="prop2">ABC</t:osgi.property>
- </reference>
-
-</componentType>
diff --git a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/osgitest.composite b/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/osgitest.composite deleted file mode 100644 index 24c5716abd..0000000000 --- a/sandbox/ant/sca/trunk/modules/implementation-osgi/src/test/resources/osgitest.composite +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://test"
- name="OSGiTestComposite">
-
- <component name="OSGiTestServiceComponent">
- <tuscany:implementation.osgi bundleVersion="1.0.0"
- bundleSymbolicName="osgi.test" />
-
- <property name="currency" type="xsd:string">USD</property>
- <property name="exchangeRate" type="xsd:double">2.0</property>
-
- </component>
-
-</composite>
|