summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-impl-osgi/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-21 07:03:47 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-21 07:03:47 +0000
commitab6904bc2f622129bc548391745b08eb0c219e57 (patch)
tree5c7599119182bfa8e65c0d6605e933396aedffd2 /java/sca/modules/node-impl-osgi/src
parent8d70ef6d556ad29b93d5d40e91c4c9304638c9e9 (diff)
Fix svn:eol-style and svn:keywords properties for java/xml files
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@796166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-impl-osgi/src')
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java688
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveredServiceNotificationImpl.java134
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveryActivator.java116
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java244
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointDescription.java138
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java126
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/LocalDiscoveryService.java244
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/ServiceEndpointDescriptionImpl.java270
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeUtil.java2
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiServiceExporter.java276
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java214
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java162
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/Discovery.java132
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java256
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServicePublication.java294
-rw-r--r--java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/bundle.componentType108
-rw-r--r--java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/calculator.composite106
-rw-r--r--java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/bundle.componentType94
-rw-r--r--java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/operations.composite86
-rw-r--r--java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/sca-contribution.xml48
-rw-r--r--java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite140
21 files changed, 1939 insertions, 1939 deletions
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java
index 780fd73c95..fa60ed0ed2 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java
@@ -1,344 +1,344 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
-
-import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
-import static org.osgi.service.discovery.DiscoveredServiceTracker.FILTER_MATCH_CRITERIA;
-import static org.osgi.service.discovery.DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.discovery.DiscoveredServiceNotification;
-import org.osgi.service.discovery.DiscoveredServiceTracker;
-import org.osgi.service.discovery.Discovery;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-import org.osgi.service.discovery.ServicePublication;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- *
- */
-public abstract class AbstractDiscoveryService implements Discovery {
- private final static Logger logger = Logger.getLogger(AbstractDiscoveryService.class.getName());
-
- protected BundleContext context;
- protected ExtensionPointRegistry registry;
-
- private Map<String, List<DiscoveredServiceTracker>> filtersToTrackers =
- new HashMap<String, List<DiscoveredServiceTracker>>();
- private Map<String, List<DiscoveredServiceTracker>> interfacesToTrackers =
- new HashMap<String, List<DiscoveredServiceTracker>>();
- // this is effectively a set which allows for multiple service descriptions with the
- // same interface name but different properties and takes care of itself with respect to concurrency
- protected Map<ServiceEndpointDescription, Bundle> servicesInfo =
- new ConcurrentHashMap<ServiceEndpointDescription, Bundle>();
- private Map<DiscoveredServiceTracker, Collection<String>> trackersToFilters =
- new HashMap<DiscoveredServiceTracker, Collection<String>>();
- private Map<DiscoveredServiceTracker, Collection<String>> trackersToInterfaces =
- new HashMap<DiscoveredServiceTracker, Collection<String>>();
- private ServiceTracker trackerTracker;
-
- public AbstractDiscoveryService(BundleContext context) {
- super();
- this.context = context;
-
- // track the registration of DiscoveredServiceTrackers
- trackerTracker = new ServiceTracker(context, DiscoveredServiceTracker.class.getName(), null) {
- public Object addingService(ServiceReference reference) {
- Object result = super.addingService(reference);
- cacheTracker(reference, result);
- return result;
- }
-
- public void modifiedService(ServiceReference reference, Object service) {
- super.modifiedService(reference, service);
- updateTracker(reference, service);
- }
-
- public void removedService(ServiceReference reference, Object service) {
- super.removedService(reference, service);
- clearTracker(service);
- }
- };
-
- trackerTracker.open();
-
- }
-
- public void stop() {
- trackerTracker.close();
- }
-
- protected ExtensionPointRegistry getExtensionPointRegistry() {
- NodeFactoryImpl factory = (NodeFactoryImpl) NodeFactory.newInstance();
- factory.init();
- ServiceTracker tracker = new ServiceTracker(context, ExtensionPointRegistry.class.getName(), null);
- tracker.open();
- // tracker.waitForService(1000);
- registry = (ExtensionPointRegistry)tracker.getService();
- tracker.close();
- return registry;
- }
-
- private synchronized void cacheTracker(ServiceReference reference, Object service) {
- if (service instanceof DiscoveredServiceTracker) {
- DiscoveredServiceTracker tracker = (DiscoveredServiceTracker)service;
- Collection<String> interfaces =
- addTracker(reference, tracker, INTERFACE_MATCH_CRITERIA, interfacesToTrackers, trackersToInterfaces);
- Collection<String> filters =
- addTracker(reference, tracker, FILTER_MATCH_CRITERIA, filtersToTrackers, trackersToFilters);
-
- triggerCallbacks(null, interfaces, tracker, false);
- triggerCallbacks(null, filters, tracker, true);
- }
- }
-
- private synchronized void clearTracker(Object service) {
- if (service instanceof DiscoveredServiceTracker) {
- removeTracker((DiscoveredServiceTracker)service, interfacesToTrackers, trackersToInterfaces);
- removeTracker((DiscoveredServiceTracker)service, filtersToTrackers, trackersToFilters);
- }
- }
-
- private synchronized void updateTracker(ServiceReference reference, Object service) {
- if (service instanceof DiscoveredServiceTracker) {
- DiscoveredServiceTracker tracker = (DiscoveredServiceTracker)service;
- logger.info("updating tracker: " + tracker);
- Collection<String> oldInterfaces = removeTracker(tracker, interfacesToTrackers, trackersToInterfaces);
- Collection<String> oldFilters = removeTracker(tracker, filtersToTrackers, trackersToFilters);
-
- Collection<String> newInterfaces =
- addTracker(reference, tracker, INTERFACE_MATCH_CRITERIA, interfacesToTrackers, trackersToInterfaces);
- Collection<String> newFilters =
- addTracker(reference, tracker, FILTER_MATCH_CRITERIA, filtersToTrackers, trackersToFilters);
-
- triggerCallbacks(oldInterfaces, newInterfaces, tracker, false);
- triggerCallbacks(oldFilters, newFilters, tracker, true);
- }
- }
-
- private void triggerCallbacks(Collection<String> oldInterest,
- Collection<String> newInterest,
- DiscoveredServiceTracker tracker,
- boolean isFilter) {
- // compute delta between old & new interfaces/filters and
- // trigger callbacks for any entries in servicesInfo that
- // match any *additional* interface/filters
- Collection<String> deltaInterest = new ArrayList<String>();
- if (!isEmpty(newInterest)) {
- if (isEmpty(oldInterest)) {
- deltaInterest.addAll(newInterest);
- } else {
- Iterator<String> i = newInterest.iterator();
- while (i.hasNext()) {
- String next = (String)i.next();
- if (!oldInterest.contains(next)) {
- deltaInterest.add(next);
- }
- }
- }
- }
-
- if (servicesInfo.size() > 0) {
- logger.info("search for matches to trigger callbacks with delta: " + deltaInterest);
- } else {
- logger.info("nothing to search for matches to trigger callbacks with delta: " + deltaInterest);
- }
- Iterator<String> i = deltaInterest.iterator();
- while (i.hasNext()) {
- String next = i.next();
- for (ServiceEndpointDescription sd : servicesInfo.keySet()) {
- triggerCallbacks(tracker, next, isFilter, sd, AVAILABLE);
- }
- }
- }
-
- private void triggerCallbacks(DiscoveredServiceTracker tracker,
- String toMatch,
- boolean isFilter,
- ServiceEndpointDescription sd,
- int type) {
- logger.fine("check if string: " + toMatch
- + (isFilter ? " matches " : " contained by ")
- + sd.getProvidedInterfaces());
-
- DiscoveredServiceNotification notification =
- isFilter ? (filterMatches(toMatch, sd) ? new DiscoveredServiceNotificationImpl(sd, true, toMatch, type)
- : null) : (sd.getProvidedInterfaces().contains(toMatch)
- ? new DiscoveredServiceNotificationImpl(sd, false, toMatch, type) : null);
-
- if (notification != null) {
- tracker.serviceChanged(notification);
- }
- }
-
- private boolean filterMatches(String filterValue, ServiceEndpointDescription sd) {
- Filter filter = createFilter(filterValue);
- return filter != null ? filter.match(getServiceProperties(null, sd)) : false;
- }
-
- private Filter createFilter(String filterValue) {
-
- if (filterValue == null) {
- return null;
- }
-
- try {
- return context.createFilter(filterValue);
- } catch (InvalidSyntaxException ex) {
- System.out.println("Invalid filter expression " + filterValue);
- } catch (Exception ex) {
- System.out.println("Problem creating a Filter from " + filterValue);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private Dictionary<String, Object> getServiceProperties(String interfaceName, ServiceEndpointDescription sd) {
- Dictionary<String, Object> d = new Hashtable<String, Object>(sd.getProperties());
-
- String[] interfaceNames = getProvidedInterfaces(sd, interfaceName);
- if (interfaceNames != null) {
- d.put(INTERFACE_MATCH_CRITERIA, interfaceNames);
- }
- return d;
- }
-
- @SuppressWarnings("unchecked")
- private static String[] getProvidedInterfaces(ServiceEndpointDescription sd, String interfaceName) {
-
- Collection<String> interfaceNames = sd.getProvidedInterfaces();
- if (interfaceName == null) {
- return null;
- }
-
- Iterator<String> iNames = interfaceNames.iterator();
- while (iNames.hasNext()) {
- if (iNames.next().equals(interfaceName)) {
- return new String[] {interfaceName};
- }
- }
- return null;
- }
-
- static Collection<String> removeTracker(DiscoveredServiceTracker tracker,
- Map<String, List<DiscoveredServiceTracker>> forwardMap,
- Map<DiscoveredServiceTracker, Collection<String>> reverseMap) {
- Collection<String> collection = reverseMap.get(tracker);
- if (!isEmpty(collection)) {
- reverseMap.remove(tracker);
- Iterator<String> i = collection.iterator();
- while (i.hasNext()) {
- String element = i.next();
- if (forwardMap.containsKey(element)) {
- forwardMap.get(element).remove(tracker);
- } else {
- // if the element wasn't on the forwardmap, its a new element and
- // shouldn't be returned as part of the collection of old ones
- i.remove();
- }
- }
- }
- return collection;
- }
-
- private static boolean isEmpty(Collection<?> c) {
- return c == null || c.isEmpty();
- }
-
- @SuppressWarnings("unchecked")
- static Collection<String> addTracker(ServiceReference reference,
- DiscoveredServiceTracker tracker,
- String property,
- Map<String, List<DiscoveredServiceTracker>> forwardMap,
- Map<DiscoveredServiceTracker, Collection<String>> reverseMap) {
- Collection<String> collection = (Collection<String>)reference.getProperty(property);
- logger.info("adding tracker: " + tracker
- + " collection: "
- + collection
- + " registered against prop: "
- + property);
- if (!isEmpty(collection)) {
- reverseMap.put(tracker, new ArrayList<String>(collection));
- Iterator<String> i = collection.iterator();
- while (i.hasNext()) {
- String element = i.next();
- if (forwardMap.containsKey(element)) {
- forwardMap.get(element).add(tracker);
- } else {
- List<DiscoveredServiceTracker> trackerList = new ArrayList<DiscoveredServiceTracker>();
- trackerList.add(tracker);
- forwardMap.put(element, trackerList);
- }
- }
- }
- return collection;
- }
-
- protected void discoveredServiceChanged(ServiceEndpointDescription sd, int type) {
- for (Map.Entry<DiscoveredServiceTracker, Collection<String>> entry : trackersToInterfaces.entrySet()) {
- for (String match : entry.getValue()) {
- triggerCallbacks(entry.getKey(), match, false, sd, type);
- }
- }
- for (Map.Entry<DiscoveredServiceTracker, Collection<String>> entry : trackersToFilters.entrySet()) {
- for (String match : entry.getValue()) {
- triggerCallbacks(entry.getKey(), match, true, sd, type);
- }
- }
- }
-
- /**
- * Publish the OSGi services that are exposed to SCA. For SCA, the replicated endpoint registry
- * serves are the discovery protocol. The OSGi services are added to endpoint registry first before
- * the ServicePublication services are registered so that othe Discovery services can see them.
- * @param ref
- * @param endpoint
- * @return
- */
- protected ServiceRegistration localServicePublished(ServiceReference ref, Endpoint endpoint) {
- EndpointPublication publication = new EndpointPublication(ref, endpoint);
- ServiceRegistration registration =
- ref.getBundle().getBundleContext().registerService(ServicePublication.class.getName(),
- publication,
- publication.getProperties());
- return registration;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
+import static org.osgi.service.discovery.DiscoveredServiceTracker.FILTER_MATCH_CRITERIA;
+import static org.osgi.service.discovery.DiscoveredServiceTracker.INTERFACE_MATCH_CRITERIA;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.discovery.DiscoveredServiceNotification;
+import org.osgi.service.discovery.DiscoveredServiceTracker;
+import org.osgi.service.discovery.Discovery;
+import org.osgi.service.discovery.ServiceEndpointDescription;
+import org.osgi.service.discovery.ServicePublication;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ *
+ */
+public abstract class AbstractDiscoveryService implements Discovery {
+ private final static Logger logger = Logger.getLogger(AbstractDiscoveryService.class.getName());
+
+ protected BundleContext context;
+ protected ExtensionPointRegistry registry;
+
+ private Map<String, List<DiscoveredServiceTracker>> filtersToTrackers =
+ new HashMap<String, List<DiscoveredServiceTracker>>();
+ private Map<String, List<DiscoveredServiceTracker>> interfacesToTrackers =
+ new HashMap<String, List<DiscoveredServiceTracker>>();
+ // this is effectively a set which allows for multiple service descriptions with the
+ // same interface name but different properties and takes care of itself with respect to concurrency
+ protected Map<ServiceEndpointDescription, Bundle> servicesInfo =
+ new ConcurrentHashMap<ServiceEndpointDescription, Bundle>();
+ private Map<DiscoveredServiceTracker, Collection<String>> trackersToFilters =
+ new HashMap<DiscoveredServiceTracker, Collection<String>>();
+ private Map<DiscoveredServiceTracker, Collection<String>> trackersToInterfaces =
+ new HashMap<DiscoveredServiceTracker, Collection<String>>();
+ private ServiceTracker trackerTracker;
+
+ public AbstractDiscoveryService(BundleContext context) {
+ super();
+ this.context = context;
+
+ // track the registration of DiscoveredServiceTrackers
+ trackerTracker = new ServiceTracker(context, DiscoveredServiceTracker.class.getName(), null) {
+ public Object addingService(ServiceReference reference) {
+ Object result = super.addingService(reference);
+ cacheTracker(reference, result);
+ return result;
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ super.modifiedService(reference, service);
+ updateTracker(reference, service);
+ }
+
+ public void removedService(ServiceReference reference, Object service) {
+ super.removedService(reference, service);
+ clearTracker(service);
+ }
+ };
+
+ trackerTracker.open();
+
+ }
+
+ public void stop() {
+ trackerTracker.close();
+ }
+
+ protected ExtensionPointRegistry getExtensionPointRegistry() {
+ NodeFactoryImpl factory = (NodeFactoryImpl) NodeFactory.newInstance();
+ factory.init();
+ ServiceTracker tracker = new ServiceTracker(context, ExtensionPointRegistry.class.getName(), null);
+ tracker.open();
+ // tracker.waitForService(1000);
+ registry = (ExtensionPointRegistry)tracker.getService();
+ tracker.close();
+ return registry;
+ }
+
+ private synchronized void cacheTracker(ServiceReference reference, Object service) {
+ if (service instanceof DiscoveredServiceTracker) {
+ DiscoveredServiceTracker tracker = (DiscoveredServiceTracker)service;
+ Collection<String> interfaces =
+ addTracker(reference, tracker, INTERFACE_MATCH_CRITERIA, interfacesToTrackers, trackersToInterfaces);
+ Collection<String> filters =
+ addTracker(reference, tracker, FILTER_MATCH_CRITERIA, filtersToTrackers, trackersToFilters);
+
+ triggerCallbacks(null, interfaces, tracker, false);
+ triggerCallbacks(null, filters, tracker, true);
+ }
+ }
+
+ private synchronized void clearTracker(Object service) {
+ if (service instanceof DiscoveredServiceTracker) {
+ removeTracker((DiscoveredServiceTracker)service, interfacesToTrackers, trackersToInterfaces);
+ removeTracker((DiscoveredServiceTracker)service, filtersToTrackers, trackersToFilters);
+ }
+ }
+
+ private synchronized void updateTracker(ServiceReference reference, Object service) {
+ if (service instanceof DiscoveredServiceTracker) {
+ DiscoveredServiceTracker tracker = (DiscoveredServiceTracker)service;
+ logger.info("updating tracker: " + tracker);
+ Collection<String> oldInterfaces = removeTracker(tracker, interfacesToTrackers, trackersToInterfaces);
+ Collection<String> oldFilters = removeTracker(tracker, filtersToTrackers, trackersToFilters);
+
+ Collection<String> newInterfaces =
+ addTracker(reference, tracker, INTERFACE_MATCH_CRITERIA, interfacesToTrackers, trackersToInterfaces);
+ Collection<String> newFilters =
+ addTracker(reference, tracker, FILTER_MATCH_CRITERIA, filtersToTrackers, trackersToFilters);
+
+ triggerCallbacks(oldInterfaces, newInterfaces, tracker, false);
+ triggerCallbacks(oldFilters, newFilters, tracker, true);
+ }
+ }
+
+ private void triggerCallbacks(Collection<String> oldInterest,
+ Collection<String> newInterest,
+ DiscoveredServiceTracker tracker,
+ boolean isFilter) {
+ // compute delta between old & new interfaces/filters and
+ // trigger callbacks for any entries in servicesInfo that
+ // match any *additional* interface/filters
+ Collection<String> deltaInterest = new ArrayList<String>();
+ if (!isEmpty(newInterest)) {
+ if (isEmpty(oldInterest)) {
+ deltaInterest.addAll(newInterest);
+ } else {
+ Iterator<String> i = newInterest.iterator();
+ while (i.hasNext()) {
+ String next = (String)i.next();
+ if (!oldInterest.contains(next)) {
+ deltaInterest.add(next);
+ }
+ }
+ }
+ }
+
+ if (servicesInfo.size() > 0) {
+ logger.info("search for matches to trigger callbacks with delta: " + deltaInterest);
+ } else {
+ logger.info("nothing to search for matches to trigger callbacks with delta: " + deltaInterest);
+ }
+ Iterator<String> i = deltaInterest.iterator();
+ while (i.hasNext()) {
+ String next = i.next();
+ for (ServiceEndpointDescription sd : servicesInfo.keySet()) {
+ triggerCallbacks(tracker, next, isFilter, sd, AVAILABLE);
+ }
+ }
+ }
+
+ private void triggerCallbacks(DiscoveredServiceTracker tracker,
+ String toMatch,
+ boolean isFilter,
+ ServiceEndpointDescription sd,
+ int type) {
+ logger.fine("check if string: " + toMatch
+ + (isFilter ? " matches " : " contained by ")
+ + sd.getProvidedInterfaces());
+
+ DiscoveredServiceNotification notification =
+ isFilter ? (filterMatches(toMatch, sd) ? new DiscoveredServiceNotificationImpl(sd, true, toMatch, type)
+ : null) : (sd.getProvidedInterfaces().contains(toMatch)
+ ? new DiscoveredServiceNotificationImpl(sd, false, toMatch, type) : null);
+
+ if (notification != null) {
+ tracker.serviceChanged(notification);
+ }
+ }
+
+ private boolean filterMatches(String filterValue, ServiceEndpointDescription sd) {
+ Filter filter = createFilter(filterValue);
+ return filter != null ? filter.match(getServiceProperties(null, sd)) : false;
+ }
+
+ private Filter createFilter(String filterValue) {
+
+ if (filterValue == null) {
+ return null;
+ }
+
+ try {
+ return context.createFilter(filterValue);
+ } catch (InvalidSyntaxException ex) {
+ System.out.println("Invalid filter expression " + filterValue);
+ } catch (Exception ex) {
+ System.out.println("Problem creating a Filter from " + filterValue);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Dictionary<String, Object> getServiceProperties(String interfaceName, ServiceEndpointDescription sd) {
+ Dictionary<String, Object> d = new Hashtable<String, Object>(sd.getProperties());
+
+ String[] interfaceNames = getProvidedInterfaces(sd, interfaceName);
+ if (interfaceNames != null) {
+ d.put(INTERFACE_MATCH_CRITERIA, interfaceNames);
+ }
+ return d;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static String[] getProvidedInterfaces(ServiceEndpointDescription sd, String interfaceName) {
+
+ Collection<String> interfaceNames = sd.getProvidedInterfaces();
+ if (interfaceName == null) {
+ return null;
+ }
+
+ Iterator<String> iNames = interfaceNames.iterator();
+ while (iNames.hasNext()) {
+ if (iNames.next().equals(interfaceName)) {
+ return new String[] {interfaceName};
+ }
+ }
+ return null;
+ }
+
+ static Collection<String> removeTracker(DiscoveredServiceTracker tracker,
+ Map<String, List<DiscoveredServiceTracker>> forwardMap,
+ Map<DiscoveredServiceTracker, Collection<String>> reverseMap) {
+ Collection<String> collection = reverseMap.get(tracker);
+ if (!isEmpty(collection)) {
+ reverseMap.remove(tracker);
+ Iterator<String> i = collection.iterator();
+ while (i.hasNext()) {
+ String element = i.next();
+ if (forwardMap.containsKey(element)) {
+ forwardMap.get(element).remove(tracker);
+ } else {
+ // if the element wasn't on the forwardmap, its a new element and
+ // shouldn't be returned as part of the collection of old ones
+ i.remove();
+ }
+ }
+ }
+ return collection;
+ }
+
+ private static boolean isEmpty(Collection<?> c) {
+ return c == null || c.isEmpty();
+ }
+
+ @SuppressWarnings("unchecked")
+ static Collection<String> addTracker(ServiceReference reference,
+ DiscoveredServiceTracker tracker,
+ String property,
+ Map<String, List<DiscoveredServiceTracker>> forwardMap,
+ Map<DiscoveredServiceTracker, Collection<String>> reverseMap) {
+ Collection<String> collection = (Collection<String>)reference.getProperty(property);
+ logger.info("adding tracker: " + tracker
+ + " collection: "
+ + collection
+ + " registered against prop: "
+ + property);
+ if (!isEmpty(collection)) {
+ reverseMap.put(tracker, new ArrayList<String>(collection));
+ Iterator<String> i = collection.iterator();
+ while (i.hasNext()) {
+ String element = i.next();
+ if (forwardMap.containsKey(element)) {
+ forwardMap.get(element).add(tracker);
+ } else {
+ List<DiscoveredServiceTracker> trackerList = new ArrayList<DiscoveredServiceTracker>();
+ trackerList.add(tracker);
+ forwardMap.put(element, trackerList);
+ }
+ }
+ }
+ return collection;
+ }
+
+ protected void discoveredServiceChanged(ServiceEndpointDescription sd, int type) {
+ for (Map.Entry<DiscoveredServiceTracker, Collection<String>> entry : trackersToInterfaces.entrySet()) {
+ for (String match : entry.getValue()) {
+ triggerCallbacks(entry.getKey(), match, false, sd, type);
+ }
+ }
+ for (Map.Entry<DiscoveredServiceTracker, Collection<String>> entry : trackersToFilters.entrySet()) {
+ for (String match : entry.getValue()) {
+ triggerCallbacks(entry.getKey(), match, true, sd, type);
+ }
+ }
+ }
+
+ /**
+ * Publish the OSGi services that are exposed to SCA. For SCA, the replicated endpoint registry
+ * serves are the discovery protocol. The OSGi services are added to endpoint registry first before
+ * the ServicePublication services are registered so that othe Discovery services can see them.
+ * @param ref
+ * @param endpoint
+ * @return
+ */
+ protected ServiceRegistration localServicePublished(ServiceReference ref, Endpoint endpoint) {
+ EndpointPublication publication = new EndpointPublication(ref, endpoint);
+ ServiceRegistration registration =
+ ref.getBundle().getBundleContext().registerService(ServicePublication.class.getName(),
+ publication,
+ publication.getProperties());
+ return registration;
+ }
+
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveredServiceNotificationImpl.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveredServiceNotificationImpl.java
index a110fa9528..a50721fbfc 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveredServiceNotificationImpl.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveredServiceNotificationImpl.java
@@ -1,67 +1,67 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.dosgi.discovery;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-
-import org.osgi.service.discovery.DiscoveredServiceNotification;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-
-public class DiscoveredServiceNotificationImpl implements DiscoveredServiceNotification {
-
- private ServiceEndpointDescription discription;
- private Collection<String> interfaces;
- private Collection<String> filters;
- private int type;
-
- public DiscoveredServiceNotificationImpl(ServiceEndpointDescription sd, boolean isFilter, String match, int type) {
- this.discription = sd;
- if (isFilter) {
- filters = new ArrayList<String>();
- filters.add(match);
- interfaces = Collections.emptySet();
- } else {
- interfaces = new HashSet<String>();
- interfaces.add(match);
- filters = Collections.emptyList();
- }
-
- this.type = type;
- }
-
- public ServiceEndpointDescription getServiceEndpointDescription() {
- return discription;
- }
-
- public int getType() {
- return type;
- }
-
- public Collection<String> getInterfaces() {
- return interfaces;
- }
-
- public Collection<String> getFilters() {
- return filters;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+import org.osgi.service.discovery.DiscoveredServiceNotification;
+import org.osgi.service.discovery.ServiceEndpointDescription;
+
+public class DiscoveredServiceNotificationImpl implements DiscoveredServiceNotification {
+
+ private ServiceEndpointDescription discription;
+ private Collection<String> interfaces;
+ private Collection<String> filters;
+ private int type;
+
+ public DiscoveredServiceNotificationImpl(ServiceEndpointDescription sd, boolean isFilter, String match, int type) {
+ this.discription = sd;
+ if (isFilter) {
+ filters = new ArrayList<String>();
+ filters.add(match);
+ interfaces = Collections.emptySet();
+ } else {
+ interfaces = new HashSet<String>();
+ interfaces.add(match);
+ filters = Collections.emptyList();
+ }
+
+ this.type = type;
+ }
+
+ public ServiceEndpointDescription getServiceEndpointDescription() {
+ return discription;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public Collection<String> getInterfaces() {
+ return interfaces;
+ }
+
+ public Collection<String> getFilters() {
+ return filters;
+ }
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveryActivator.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveryActivator.java
index 9497619b5b..92951321d0 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveryActivator.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DiscoveryActivator.java
@@ -1,58 +1,58 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.dosgi.discovery;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.discovery.Discovery;
-
-public class DiscoveryActivator implements BundleActivator {
- private List<AbstractDiscoveryService> discoveryServices = new ArrayList<AbstractDiscoveryService>();
- private List<ServiceRegistration> discoveryServiceRegistrations = new ArrayList<ServiceRegistration>();
-
- public void start(BundleContext context) {
- discoveryServices.add(new LocalDiscoveryService(context));
-
- discoveryServices.add(new DomainDiscoveryService(context));
-
- for (AbstractDiscoveryService service : discoveryServices) {
- Hashtable<String, Object> props = new Hashtable<String, Object>();
- props.put(Discovery.PRODUCT_NAME, "Apache Tuscany SCA");
- props.put(Discovery.PRODUCT_VERSION, "2.0.0");
- props.put(Discovery.VENDOR_NAME, "Apache Software Foundation");
- ServiceRegistration registration =
- context.registerService(Discovery.class.getName(), service, props);
- discoveryServiceRegistrations.add(registration);
- }
- }
-
- public void stop(BundleContext context) {
- for (ServiceRegistration registration : discoveryServiceRegistrations) {
- registration.unregister();
- }
- for (AbstractDiscoveryService service : discoveryServices) {
- service.stop();
- }
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.discovery.Discovery;
+
+public class DiscoveryActivator implements BundleActivator {
+ private List<AbstractDiscoveryService> discoveryServices = new ArrayList<AbstractDiscoveryService>();
+ private List<ServiceRegistration> discoveryServiceRegistrations = new ArrayList<ServiceRegistration>();
+
+ public void start(BundleContext context) {
+ discoveryServices.add(new LocalDiscoveryService(context));
+
+ discoveryServices.add(new DomainDiscoveryService(context));
+
+ for (AbstractDiscoveryService service : discoveryServices) {
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ props.put(Discovery.PRODUCT_NAME, "Apache Tuscany SCA");
+ props.put(Discovery.PRODUCT_VERSION, "2.0.0");
+ props.put(Discovery.VENDOR_NAME, "Apache Software Foundation");
+ ServiceRegistration registration =
+ context.registerService(Discovery.class.getName(), service, props);
+ discoveryServiceRegistrations.add(registration);
+ }
+ }
+
+ public void stop(BundleContext context) {
+ for (ServiceRegistration registration : discoveryServiceRegistrations) {
+ registration.unregister();
+ }
+ for (AbstractDiscoveryService service : discoveryServices) {
+ service.stop();
+ }
+ }
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java
index 3136c4cbc9..5f63e3c92d 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java
@@ -1,122 +1,122 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
-
-import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
-import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.runtime.EndpointListener;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-
-/**
- * Discovery service based on the distributed SCA domain
- */
-public class DomainDiscoveryService extends AbstractDiscoveryService implements EndpointListener {
- private EndpointRegistry endpointRegistry;
-
- private Map<String, ServiceRegistration> endpointRegistrations =
- new ConcurrentHashMap<String, ServiceRegistration>();
-
- public DomainDiscoveryService(BundleContext context) {
- super(context);
- init();
- }
-
- private void init() {
- getExtensionPointRegistry();
- this.endpointRegistry =
- registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(EndpointRegistry.class);
- this.endpointRegistry.addListener(this);
- }
-
- public void endpointAdded(Endpoint endpoint) {
- Implementation impl = endpoint.getComponent().getImplementation();
- if (!(impl instanceof OSGiImplementation)) {
- return;
- }
-
- OSGiImplementation osgiImpl = (OSGiImplementation)impl;
- BundleContext bundleContext = osgiImpl.getBundle().getBundleContext();
-
- if (!endpoint.isRemote()) {
-
- Interface intf = endpoint.getService().getInterfaceContract().getInterface();
- JavaInterface javaInterface = (JavaInterface)intf;
- // String filter = getOSGiFilter(provider.getOSGiProperties(service));
- // FIXME: What is the filter?
- String filter = "(!(sca.reference=*))";
- // "(sca.service=" + component.getURI() + "#service-name\\(" + service.getName() + "\\))";
- ServiceReference ref = null;
- try {
- ref = bundleContext.getServiceReferences(javaInterface.getName(), filter)[0];
- } catch (InvalidSyntaxException e) {
- // Ignore
- }
- if (ref != null) {
- ServiceRegistration registration = localServicePublished(ref, endpoint);
- endpointRegistrations.put(endpoint.getURI(), registration);
- }
- } else {
- // Remote endpoints
- ServiceEndpointDescription description = new EndpointDescription(endpoint);
- discoveredServiceChanged(description, AVAILABLE);
- }
- }
-
- public void endpointRemoved(Endpoint endpoint) {
- if (!endpoint.isRemote()) {
- // unregister the ServicePublication here
- ServiceRegistration registration = endpointRegistrations.get(endpoint.getURI());
- if (registration != null) {
- registration.unregister();
- }
- } else {
- // Remote endpoints
- ServiceEndpointDescription description = new EndpointDescription(endpoint);
- discoveredServiceChanged(description, UNAVAILABLE);
- }
- }
-
- public void endpointUpdated(Endpoint oldEndpoint, Endpoint newEndpoint) {
- // FIXME: This is a quick and dirty way for the update
- endpointRemoved(oldEndpoint);
- endpointAdded(newEndpoint);
- }
-
- public void stop() {
- endpointRegistry.removeListener(this);
- super.stop();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
+import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.runtime.EndpointListener;
+import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.discovery.ServiceEndpointDescription;
+
+/**
+ * Discovery service based on the distributed SCA domain
+ */
+public class DomainDiscoveryService extends AbstractDiscoveryService implements EndpointListener {
+ private EndpointRegistry endpointRegistry;
+
+ private Map<String, ServiceRegistration> endpointRegistrations =
+ new ConcurrentHashMap<String, ServiceRegistration>();
+
+ public DomainDiscoveryService(BundleContext context) {
+ super(context);
+ init();
+ }
+
+ private void init() {
+ getExtensionPointRegistry();
+ this.endpointRegistry =
+ registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(EndpointRegistry.class);
+ this.endpointRegistry.addListener(this);
+ }
+
+ public void endpointAdded(Endpoint endpoint) {
+ Implementation impl = endpoint.getComponent().getImplementation();
+ if (!(impl instanceof OSGiImplementation)) {
+ return;
+ }
+
+ OSGiImplementation osgiImpl = (OSGiImplementation)impl;
+ BundleContext bundleContext = osgiImpl.getBundle().getBundleContext();
+
+ if (!endpoint.isRemote()) {
+
+ Interface intf = endpoint.getService().getInterfaceContract().getInterface();
+ JavaInterface javaInterface = (JavaInterface)intf;
+ // String filter = getOSGiFilter(provider.getOSGiProperties(service));
+ // FIXME: What is the filter?
+ String filter = "(!(sca.reference=*))";
+ // "(sca.service=" + component.getURI() + "#service-name\\(" + service.getName() + "\\))";
+ ServiceReference ref = null;
+ try {
+ ref = bundleContext.getServiceReferences(javaInterface.getName(), filter)[0];
+ } catch (InvalidSyntaxException e) {
+ // Ignore
+ }
+ if (ref != null) {
+ ServiceRegistration registration = localServicePublished(ref, endpoint);
+ endpointRegistrations.put(endpoint.getURI(), registration);
+ }
+ } else {
+ // Remote endpoints
+ ServiceEndpointDescription description = new EndpointDescription(endpoint);
+ discoveredServiceChanged(description, AVAILABLE);
+ }
+ }
+
+ public void endpointRemoved(Endpoint endpoint) {
+ if (!endpoint.isRemote()) {
+ // unregister the ServicePublication here
+ ServiceRegistration registration = endpointRegistrations.get(endpoint.getURI());
+ if (registration != null) {
+ registration.unregister();
+ }
+ } else {
+ // Remote endpoints
+ ServiceEndpointDescription description = new EndpointDescription(endpoint);
+ discoveredServiceChanged(description, UNAVAILABLE);
+ }
+ }
+
+ public void endpointUpdated(Endpoint oldEndpoint, Endpoint newEndpoint) {
+ // FIXME: This is a quick and dirty way for the update
+ endpointRemoved(oldEndpoint);
+ endpointAdded(newEndpoint);
+ }
+
+ public void stop() {
+ endpointRegistry.removeListener(this);
+ super.stop();
+ }
+
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointDescription.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointDescription.java
index 3f47183a56..5cdb0a4a8a 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointDescription.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointDescription.java
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.dosgi.discovery;
-
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_ID;
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
-
-import java.net.URI;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-
-/**
- *
- */
-public class EndpointDescription extends ServiceEndpointDescriptionImpl {
- public EndpointDescription(Endpoint endpoint) {
- super(Collections.singleton(getInterfaceName(endpoint)), getServiceProperties(endpoint));
- }
-
- static String getInterfaceName(Endpoint endpoint) {
- ComponentService service = endpoint.getService();
- if (service == null) {
- return null;
- }
- InterfaceContract contract = service.getInterfaceContract();
- if (contract == null) {
- return null;
- }
- Interface intf = contract.getInterface();
- if (intf instanceof JavaInterface) {
- JavaInterface javaInterface = (JavaInterface)intf;
- return javaInterface.getName();
- }
-
- return null;
- }
-
- static Map<String, Object> getServiceProperties(Endpoint endpoint) {
- Map<String, Object> serviceProps = new HashMap<String, Object>();
- serviceProps.put(ENDPOINT_ID, endpoint.getURI());
- serviceProps.put(ENDPOINT_LOCATION, URI.create(endpoint.getBinding().getURI()));
- // TODO: Populate the properties from the Endpoint object
- return serviceProps;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_ID;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ *
+ */
+public class EndpointDescription extends ServiceEndpointDescriptionImpl {
+ public EndpointDescription(Endpoint endpoint) {
+ super(Collections.singleton(getInterfaceName(endpoint)), getServiceProperties(endpoint));
+ }
+
+ static String getInterfaceName(Endpoint endpoint) {
+ ComponentService service = endpoint.getService();
+ if (service == null) {
+ return null;
+ }
+ InterfaceContract contract = service.getInterfaceContract();
+ if (contract == null) {
+ return null;
+ }
+ Interface intf = contract.getInterface();
+ if (intf instanceof JavaInterface) {
+ JavaInterface javaInterface = (JavaInterface)intf;
+ return javaInterface.getName();
+ }
+
+ return null;
+ }
+
+ static Map<String, Object> getServiceProperties(Endpoint endpoint) {
+ Map<String, Object> serviceProps = new HashMap<String, Object>();
+ serviceProps.put(ENDPOINT_ID, endpoint.getURI());
+ serviceProps.put(ENDPOINT_LOCATION, URI.create(endpoint.getBinding().getURI()));
+ // TODO: Populate the properties from the Endpoint object
+ return serviceProps;
+ }
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
index 184d3a12bf..4c7cbee649 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.dosgi.discovery;
-
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.discovery.ServicePublication;
-
-/**
- * Publication of an SCA endpoint
- */
-public class EndpointPublication implements ServicePublication {
- private Endpoint endpoint;
- private ServiceReference reference;
-
- /**
- * Create a publication for the endpoint
- * @param reference The OSGi service reference for the given endpoint. The SCA endpoint
- * is pointing to a local service in the OSGi service registry
- */
- public EndpointPublication(ServiceReference reference, Endpoint endpoint) {
- super();
- this.reference = reference;
- this.endpoint = endpoint;
- }
-
- public ServiceReference getReference() {
- return reference;
- }
-
- public Dictionary<String, Object> getProperties() {
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- Map<String, Object> serviceProps = EndpointDescription.getServiceProperties(endpoint);
- props.put(SERVICE_PROPERTIES, serviceProps);
- // TODO: Populate the properties from the Endpoint object
- String name = EndpointDescription.getInterfaceName(endpoint);
- props.put(ENDPOINT_INTERFACE_NAME, Collections.singleton(name));
- return props;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.discovery.ServicePublication;
+
+/**
+ * Publication of an SCA endpoint
+ */
+public class EndpointPublication implements ServicePublication {
+ private Endpoint endpoint;
+ private ServiceReference reference;
+
+ /**
+ * Create a publication for the endpoint
+ * @param reference The OSGi service reference for the given endpoint. The SCA endpoint
+ * is pointing to a local service in the OSGi service registry
+ */
+ public EndpointPublication(ServiceReference reference, Endpoint endpoint) {
+ super();
+ this.reference = reference;
+ this.endpoint = endpoint;
+ }
+
+ public ServiceReference getReference() {
+ return reference;
+ }
+
+ public Dictionary<String, Object> getProperties() {
+ Dictionary<String, Object> props = new Hashtable<String, Object>();
+ Map<String, Object> serviceProps = EndpointDescription.getServiceProperties(endpoint);
+ props.put(SERVICE_PROPERTIES, serviceProps);
+ // TODO: Populate the properties from the Endpoint object
+ String name = EndpointDescription.getInterfaceName(endpoint);
+ props.put(ENDPOINT_INTERFACE_NAME, Collections.singleton(name));
+ return props;
+ }
+
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/LocalDiscoveryService.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/LocalDiscoveryService.java
index 43a19f98cc..543298600d 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/LocalDiscoveryService.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/LocalDiscoveryService.java
@@ -1,122 +1,122 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
-
-import static org.osgi.framework.Bundle.ACTIVE;
-import static org.osgi.framework.BundleEvent.STARTED;
-import static org.osgi.framework.BundleEvent.STOPPING;
-import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
-import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
-
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.service.discovery.ServiceEndpointDescription;
-
-public class LocalDiscoveryService extends AbstractDiscoveryService implements BundleListener {
-
- public LocalDiscoveryService(BundleContext context) {
- super(context);
- init();
- }
-
- private void init() {
- context.addBundleListener(this);
- getExtensionPointRegistry();
- processExistingBundles();
- }
-
- public void bundleChanged(BundleEvent event) {
- switch (event.getType()) {
- case STARTED:
- discover(event.getBundle());
- break;
- case STOPPING:
- removeServicesDeclaredInBundle(event.getBundle());
- break;
- }
- }
-
- private void processExistingBundles() {
- Bundle[] bundles = context.getBundles();
- if (bundles == null) {
- return;
- }
-
- for (Bundle b : bundles) {
- if (b.getState() == ACTIVE) {
- discover(b);
- }
- }
- }
-
- private void discover(Bundle b) {
- String path = (String)b.getHeaders().get(ServiceDescriptions.REMOTE_SERVICE_HEADER);
- if (path == null) {
- Enumeration files = b.findEntries(ServiceDescriptions.REMOTE_SERVICE_FOLDER, "*.xml", false);
- if (files == null || !files.hasMoreElements()) {
- return;
- }
- }
-
- ServiceDescriptions descriptions = null;
-
- // TODO: Use SCA contribution to load the service discription files
- List<ServiceEndpointDescription> refs = Collections.emptyList();
- for (ServiceEndpointDescription sed : refs) {
- servicesInfo.put(sed, b);
- serviceDescriptionAdded(sed);
- }
- // throw new RuntimeException("To be implemented");
- }
-
- private void removeServicesDeclaredInBundle(Bundle bundle) {
- for (Iterator<Map.Entry<ServiceEndpointDescription, Bundle>> i = servicesInfo.entrySet().iterator(); i
- .hasNext();) {
- Entry<ServiceEndpointDescription, Bundle> entry = i.next();
- if (entry.getValue().equals(bundle)) {
- serviceDescriptionRemoved(entry.getKey());
- i.remove();
- }
- }
- }
-
- private void serviceDescriptionAdded(ServiceEndpointDescription sd) {
- discoveredServiceChanged(sd, AVAILABLE);
- }
-
- private void serviceDescriptionRemoved(ServiceEndpointDescription sd) {
- discoveredServiceChanged(sd, UNAVAILABLE);
- }
-
- public void stop() {
- context.removeBundleListener(this);
- super.stop();
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import static org.osgi.framework.Bundle.ACTIVE;
+import static org.osgi.framework.BundleEvent.STARTED;
+import static org.osgi.framework.BundleEvent.STOPPING;
+import static org.osgi.service.discovery.DiscoveredServiceNotification.AVAILABLE;
+import static org.osgi.service.discovery.DiscoveredServiceNotification.UNAVAILABLE;
+
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.service.discovery.ServiceEndpointDescription;
+
+public class LocalDiscoveryService extends AbstractDiscoveryService implements BundleListener {
+
+ public LocalDiscoveryService(BundleContext context) {
+ super(context);
+ init();
+ }
+
+ private void init() {
+ context.addBundleListener(this);
+ getExtensionPointRegistry();
+ processExistingBundles();
+ }
+
+ public void bundleChanged(BundleEvent event) {
+ switch (event.getType()) {
+ case STARTED:
+ discover(event.getBundle());
+ break;
+ case STOPPING:
+ removeServicesDeclaredInBundle(event.getBundle());
+ break;
+ }
+ }
+
+ private void processExistingBundles() {
+ Bundle[] bundles = context.getBundles();
+ if (bundles == null) {
+ return;
+ }
+
+ for (Bundle b : bundles) {
+ if (b.getState() == ACTIVE) {
+ discover(b);
+ }
+ }
+ }
+
+ private void discover(Bundle b) {
+ String path = (String)b.getHeaders().get(ServiceDescriptions.REMOTE_SERVICE_HEADER);
+ if (path == null) {
+ Enumeration files = b.findEntries(ServiceDescriptions.REMOTE_SERVICE_FOLDER, "*.xml", false);
+ if (files == null || !files.hasMoreElements()) {
+ return;
+ }
+ }
+
+ ServiceDescriptions descriptions = null;
+
+ // TODO: Use SCA contribution to load the service discription files
+ List<ServiceEndpointDescription> refs = Collections.emptyList();
+ for (ServiceEndpointDescription sed : refs) {
+ servicesInfo.put(sed, b);
+ serviceDescriptionAdded(sed);
+ }
+ // throw new RuntimeException("To be implemented");
+ }
+
+ private void removeServicesDeclaredInBundle(Bundle bundle) {
+ for (Iterator<Map.Entry<ServiceEndpointDescription, Bundle>> i = servicesInfo.entrySet().iterator(); i
+ .hasNext();) {
+ Entry<ServiceEndpointDescription, Bundle> entry = i.next();
+ if (entry.getValue().equals(bundle)) {
+ serviceDescriptionRemoved(entry.getKey());
+ i.remove();
+ }
+ }
+ }
+
+ private void serviceDescriptionAdded(ServiceEndpointDescription sd) {
+ discoveredServiceChanged(sd, AVAILABLE);
+ }
+
+ private void serviceDescriptionRemoved(ServiceEndpointDescription sd) {
+ discoveredServiceChanged(sd, UNAVAILABLE);
+ }
+
+ public void stop() {
+ context.removeBundleListener(this);
+ super.stop();
+ }
+
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/ServiceEndpointDescriptionImpl.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/ServiceEndpointDescriptionImpl.java
index 949405472f..cd3b8e7543 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/ServiceEndpointDescriptionImpl.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/dosgi/discovery/ServiceEndpointDescriptionImpl.java
@@ -1,135 +1,135 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
-
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_ID;
-import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
-import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.osgi.service.discovery.ServiceEndpointDescription;
-
-public class ServiceEndpointDescriptionImpl implements ServiceEndpointDescription {
-
- private static final Logger logger = Logger.getLogger(ServiceEndpointDescriptionImpl.class.getName());
-
- private Set<String> interfaces;
- private Map<String, Object> properties;
-
- public ServiceEndpointDescriptionImpl(Collection<String> interfaceNames) {
- this(interfaceNames, Collections.<String, Object> singletonMap(SERVICE_INTERFACE_NAME,
- interfaceNames));
- }
-
- public ServiceEndpointDescriptionImpl(Collection<String> interfaceNames, Map<String, Object> remoteProperties) {
- this.interfaces = new HashSet<String>(interfaceNames);
- this.properties = remoteProperties;
- }
-
- public ServiceEndpointDescriptionImpl(String interfaceName) {
- this(Collections.singleton(interfaceName));
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ServiceEndpointDescriptionImpl other = (ServiceEndpointDescriptionImpl)obj;
- if (interfaces == null) {
- if (other.interfaces != null)
- return false;
- } else if (!interfaces.equals(other.interfaces))
- return false;
- if (properties == null) {
- if (other.properties != null)
- return false;
- } else if (!properties.equals(other.properties))
- return false;
- return true;
- }
-
- public String getEndpointID() {
- Object val = properties.get(ENDPOINT_ID);
- if (val == null) {
- return null;
- } else {
- return val.toString();
- }
- }
-
- public String getEndpointInterfaceName(String interfaceName) {
- return interfaceName;
- }
-
- public URI getLocation() {
- Object value = properties.get(ENDPOINT_LOCATION);
- if (value == null) {
- return null;
- }
-
- try {
- return new URI(value.toString());
- } catch (URISyntaxException ex) {
- logger.warning("Service document URL is malformed : " + value.toString());
- }
-
- return null;
- }
-
- public Map<String, Object> getProperties() {
- return Collections.unmodifiableMap(properties);
- }
-
- public Object getProperty(String key) {
- return properties.get(key);
- }
-
- public Collection<String> getPropertyKeys() {
- return getProperties().keySet();
- }
-
- public Collection<String> getProvidedInterfaces() {
- return interfaces;
- }
-
- public String getVersion(String interfaceName) {
- return "0.0";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((interfaces == null) ? 0 : interfaces.hashCode());
- result = prime * result + ((properties == null) ? 0 : properties.hashCode());
- return result;
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.dosgi.discovery;
+
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_ID;
+import static org.osgi.service.discovery.ServicePublication.ENDPOINT_LOCATION;
+import static org.osgi.service.discovery.ServicePublication.SERVICE_INTERFACE_NAME;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.osgi.service.discovery.ServiceEndpointDescription;
+
+public class ServiceEndpointDescriptionImpl implements ServiceEndpointDescription {
+
+ private static final Logger logger = Logger.getLogger(ServiceEndpointDescriptionImpl.class.getName());
+
+ private Set<String> interfaces;
+ private Map<String, Object> properties;
+
+ public ServiceEndpointDescriptionImpl(Collection<String> interfaceNames) {
+ this(interfaceNames, Collections.<String, Object> singletonMap(SERVICE_INTERFACE_NAME,
+ interfaceNames));
+ }
+
+ public ServiceEndpointDescriptionImpl(Collection<String> interfaceNames, Map<String, Object> remoteProperties) {
+ this.interfaces = new HashSet<String>(interfaceNames);
+ this.properties = remoteProperties;
+ }
+
+ public ServiceEndpointDescriptionImpl(String interfaceName) {
+ this(Collections.singleton(interfaceName));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServiceEndpointDescriptionImpl other = (ServiceEndpointDescriptionImpl)obj;
+ if (interfaces == null) {
+ if (other.interfaces != null)
+ return false;
+ } else if (!interfaces.equals(other.interfaces))
+ return false;
+ if (properties == null) {
+ if (other.properties != null)
+ return false;
+ } else if (!properties.equals(other.properties))
+ return false;
+ return true;
+ }
+
+ public String getEndpointID() {
+ Object val = properties.get(ENDPOINT_ID);
+ if (val == null) {
+ return null;
+ } else {
+ return val.toString();
+ }
+ }
+
+ public String getEndpointInterfaceName(String interfaceName) {
+ return interfaceName;
+ }
+
+ public URI getLocation() {
+ Object value = properties.get(ENDPOINT_LOCATION);
+ if (value == null) {
+ return null;
+ }
+
+ try {
+ return new URI(value.toString());
+ } catch (URISyntaxException ex) {
+ logger.warning("Service document URL is malformed : " + value.toString());
+ }
+
+ return null;
+ }
+
+ public Map<String, Object> getProperties() {
+ return Collections.unmodifiableMap(properties);
+ }
+
+ public Object getProperty(String key) {
+ return properties.get(key);
+ }
+
+ public Collection<String> getPropertyKeys() {
+ return getProperties().keySet();
+ }
+
+ public Collection<String> getProvidedInterfaces() {
+ return interfaces;
+ }
+
+ public String getVersion(String interfaceName) {
+ return "0.0";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((interfaces == null) ? 0 : interfaces.hashCode());
+ result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ return result;
+ }
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeUtil.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeUtil.java
index fccd30d8ff..3df50597b6 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeUtil.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeUtil.java
@@ -32,7 +32,7 @@ import org.apache.tuscany.sca.contribution.ContributionFactory;
/**
* NodeUtil
*
- * @version $Rev: $ $Date: $
+ * @version $Rev$ $Date$
*/
public class NodeUtil {
private NodeUtil() {
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiServiceExporter.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiServiceExporter.java
index 67fa384b4a..d4a6580842 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiServiceExporter.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiServiceExporter.java
@@ -1,138 +1,138 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.node.osgi.impl;
-
-import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_CONFIGS;
-import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_INTERFACES;
-import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_IMPORTED;
-
-import java.util.Collections;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.osgi.introspection.ExportedServiceIntrospector;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-/**
- * Watching and exporting OSGi services
- */
-public class OSGiServiceExporter implements ServiceTrackerCustomizer {
- private ExtensionPointRegistry registry;
- private BundleContext context;
- private ServiceTracker serviceTracker;
- private NodeFactoryImpl nodeFactory;
- private ExportedServiceIntrospector introspector;
-
- /**
- * @param context
- * @param clazz
- * @param customizer
- */
- public OSGiServiceExporter(BundleContext context) {
- this.context = context;
- }
-
- private synchronized void init() {
- if (nodeFactory == null) {
- this.nodeFactory = (NodeFactoryImpl)NodeFactory.newInstance();
- this.nodeFactory.init();
- this.introspector = new ExportedServiceIntrospector(getExtensionPointRegistry());
- }
- }
-
- public void start() {
- String filterStr =
- "(& (" + SERVICE_EXPORTED_CONFIGS
- + "=sca) ("
- + SERVICE_EXPORTED_INTERFACES
- + "=*) (!("
- + SERVICE_IMPORTED
- + "=*)) )";
- try {
- Filter filter = context.createFilter(filterStr);
- serviceTracker = new ServiceTracker(context, filter, this);
- serviceTracker.open(true);
- } catch (InvalidSyntaxException e) {
- // Ignore
- }
- }
-
- public void stop() {
- if (serviceTracker != null) {
- serviceTracker.close();
- serviceTracker = null;
- }
- }
-
- public Object addingService(ServiceReference reference) {
- init();
- try {
- Contribution contribution = introspector.introspect(reference);
- if (contribution != null) {
-
- NodeConfiguration configuration = nodeFactory.createNodeConfiguration();
- configuration.setURI("osgi.service." + String.valueOf(reference.getProperty(Constants.SERVICE_ID)));
- configuration.getExtensions().add(reference.getBundle());
- // FIXME: Configure the domain and node URI
- NodeImpl node = new NodeImpl(nodeFactory, configuration, Collections.singletonList(contribution));
- return node.start();
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public void modifiedService(ServiceReference reference, Object service) {
- Node node = (Node)service;
- node.stop();
- node.start();
- }
-
- public void removedService(ServiceReference reference, Object service) {
- Node node = (Node)service;
- node.stop();
- }
-
- protected ExtensionPointRegistry getExtensionPointRegistry() {
- if (registry == null) {
- ServiceTracker tracker = new ServiceTracker(context, ExtensionPointRegistry.class.getName(), null);
- tracker.open();
- // tracker.waitForService(1000);
- registry = (ExtensionPointRegistry)tracker.getService();
- tracker.close();
- }
- return registry;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.node.osgi.impl;
+
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_CONFIGS;
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_INTERFACES;
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_IMPORTED;
+
+import java.util.Collections;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.osgi.introspection.ExportedServiceIntrospector;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
+import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+/**
+ * Watching and exporting OSGi services
+ */
+public class OSGiServiceExporter implements ServiceTrackerCustomizer {
+ private ExtensionPointRegistry registry;
+ private BundleContext context;
+ private ServiceTracker serviceTracker;
+ private NodeFactoryImpl nodeFactory;
+ private ExportedServiceIntrospector introspector;
+
+ /**
+ * @param context
+ * @param clazz
+ * @param customizer
+ */
+ public OSGiServiceExporter(BundleContext context) {
+ this.context = context;
+ }
+
+ private synchronized void init() {
+ if (nodeFactory == null) {
+ this.nodeFactory = (NodeFactoryImpl)NodeFactory.newInstance();
+ this.nodeFactory.init();
+ this.introspector = new ExportedServiceIntrospector(getExtensionPointRegistry());
+ }
+ }
+
+ public void start() {
+ String filterStr =
+ "(& (" + SERVICE_EXPORTED_CONFIGS
+ + "=sca) ("
+ + SERVICE_EXPORTED_INTERFACES
+ + "=*) (!("
+ + SERVICE_IMPORTED
+ + "=*)) )";
+ try {
+ Filter filter = context.createFilter(filterStr);
+ serviceTracker = new ServiceTracker(context, filter, this);
+ serviceTracker.open(true);
+ } catch (InvalidSyntaxException e) {
+ // Ignore
+ }
+ }
+
+ public void stop() {
+ if (serviceTracker != null) {
+ serviceTracker.close();
+ serviceTracker = null;
+ }
+ }
+
+ public Object addingService(ServiceReference reference) {
+ init();
+ try {
+ Contribution contribution = introspector.introspect(reference);
+ if (contribution != null) {
+
+ NodeConfiguration configuration = nodeFactory.createNodeConfiguration();
+ configuration.setURI("osgi.service." + String.valueOf(reference.getProperty(Constants.SERVICE_ID)));
+ configuration.getExtensions().add(reference.getBundle());
+ // FIXME: Configure the domain and node URI
+ NodeImpl node = new NodeImpl(nodeFactory, configuration, Collections.singletonList(contribution));
+ return node.start();
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ Node node = (Node)service;
+ node.stop();
+ node.start();
+ }
+
+ public void removedService(ServiceReference reference, Object service) {
+ Node node = (Node)service;
+ node.stop();
+ }
+
+ protected ExtensionPointRegistry getExtensionPointRegistry() {
+ if (registry == null) {
+ ServiceTracker tracker = new ServiceTracker(context, ExtensionPointRegistry.class.getName(), null);
+ tracker.open();
+ // tracker.waitForService(1000);
+ registry = (ExtensionPointRegistry)tracker.getService();
+ tracker.close();
+ }
+ return registry;
+ }
+
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java
index 57de9c7c9d..d4431954b8 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceNotification.java
@@ -1,107 +1,107 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * 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.
- */
-
-package org.osgi.service.discovery;
-
-import java.util.Collection;
-
-/**
- * Interface for notification on discovered services.
- * <p>
- * <code>DiscoveredServiceNotification</code> objects are immutable.
- *
- * @Immutable
- */
-public interface DiscoveredServiceNotification {
-
- /**
- * Notification indicating that a service matching the listening criteria
- * has been discovered.
- * <p>
- * The value of <code>AVAILABLE</code> is 0x00000001.
- */
- public final static int AVAILABLE = 0x00000001;
-
- /**
- * Notification indicating that the properties of a previously discovered
- * service have changed.
- * <p>
- * The value of <code>MODIFIED</code> is 0x00000002.
- */
- public final static int MODIFIED = 0x00000002;
-
- /**
- * Notification indicating that a previously discovered service is no longer
- * known to <code>Discovery</code>.
- * <p>
- * The value of <code>UNAVAILABLE</code> is 0x00000004.
- */
- public final static int UNAVAILABLE = 0x00000004;
-
- /**
- * Notification indicating that the properties of a previously discovered
- * service have changed and the new properties no longer match the
- * listener's filter.
- * <p>
- * The value of <code>MODIFIED_ENDMATCH</code> is 0x00000008.
- */
- public final static int MODIFIED_ENDMATCH = 0x00000008;
-
- /**
- * Returns information currently known to <code>Discovery</code> regarding
- * the service endpoint.
- *
- * @return metadata of the service <code>Discovery</code> notifies about. Is
- * never <code>null</code>.
- */
- ServiceEndpointDescription getServiceEndpointDescription();
-
- /**
- * Returns the type of notification. The type values are:
- * <ul>
- * <li>{@link #AVAILABLE}</li>
- * <li>{@link #MODIFIED}</li>
- * <li>{@link #MODIFIED_ENDMATCH}</li>
- * <li>{@link #UNAVAILABLE}</li>
- * </ul>
- *
- * @return Type of notification regarding known service metadata.
- */
- int getType();
-
- /**
- * Returns interface name criteria of the {@link DiscoveredServiceTracker}
- * object matching with the interfaces of the
- * <code>ServiceEndpointDescription</code> and thus caused the notification.
- *
- * @return <code>Collection (&lt;? extends String&gt;)</code> of matching interface name criteria of the
- * <code>DiscoveredServiceTracker</code> object being notified, or
- * an empty collection if notification hasn't been caused by a
- * matching interface name criteria.
- */
- Collection/* <? extends String> */getInterfaces();
-
- /**
- * Returns filters of the <code>DiscoveredServiceTracker</code> object
- * matching with the properties of the
- * <code>ServiceEndpointDescription</code> and thus caused the notification.
- *
- * @return <code>Collection (&lt;? extends String&gt;)</code> of matching filters of the <code>DiscoveredServiceTracker</code>
- * object being notified, or an empty collection if notification
- * hasn't been caused by a matching filter criteria.
- */
- Collection/* <? extends String> */getFilters();
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.osgi.service.discovery;
+
+import java.util.Collection;
+
+/**
+ * Interface for notification on discovered services.
+ * <p>
+ * <code>DiscoveredServiceNotification</code> objects are immutable.
+ *
+ * @Immutable
+ */
+public interface DiscoveredServiceNotification {
+
+ /**
+ * Notification indicating that a service matching the listening criteria
+ * has been discovered.
+ * <p>
+ * The value of <code>AVAILABLE</code> is 0x00000001.
+ */
+ public final static int AVAILABLE = 0x00000001;
+
+ /**
+ * Notification indicating that the properties of a previously discovered
+ * service have changed.
+ * <p>
+ * The value of <code>MODIFIED</code> is 0x00000002.
+ */
+ public final static int MODIFIED = 0x00000002;
+
+ /**
+ * Notification indicating that a previously discovered service is no longer
+ * known to <code>Discovery</code>.
+ * <p>
+ * The value of <code>UNAVAILABLE</code> is 0x00000004.
+ */
+ public final static int UNAVAILABLE = 0x00000004;
+
+ /**
+ * Notification indicating that the properties of a previously discovered
+ * service have changed and the new properties no longer match the
+ * listener's filter.
+ * <p>
+ * The value of <code>MODIFIED_ENDMATCH</code> is 0x00000008.
+ */
+ public final static int MODIFIED_ENDMATCH = 0x00000008;
+
+ /**
+ * Returns information currently known to <code>Discovery</code> regarding
+ * the service endpoint.
+ *
+ * @return metadata of the service <code>Discovery</code> notifies about. Is
+ * never <code>null</code>.
+ */
+ ServiceEndpointDescription getServiceEndpointDescription();
+
+ /**
+ * Returns the type of notification. The type values are:
+ * <ul>
+ * <li>{@link #AVAILABLE}</li>
+ * <li>{@link #MODIFIED}</li>
+ * <li>{@link #MODIFIED_ENDMATCH}</li>
+ * <li>{@link #UNAVAILABLE}</li>
+ * </ul>
+ *
+ * @return Type of notification regarding known service metadata.
+ */
+ int getType();
+
+ /**
+ * Returns interface name criteria of the {@link DiscoveredServiceTracker}
+ * object matching with the interfaces of the
+ * <code>ServiceEndpointDescription</code> and thus caused the notification.
+ *
+ * @return <code>Collection (&lt;? extends String&gt;)</code> of matching interface name criteria of the
+ * <code>DiscoveredServiceTracker</code> object being notified, or
+ * an empty collection if notification hasn't been caused by a
+ * matching interface name criteria.
+ */
+ Collection/* <? extends String> */getInterfaces();
+
+ /**
+ * Returns filters of the <code>DiscoveredServiceTracker</code> object
+ * matching with the properties of the
+ * <code>ServiceEndpointDescription</code> and thus caused the notification.
+ *
+ * @return <code>Collection (&lt;? extends String&gt;)</code> of matching filters of the <code>DiscoveredServiceTracker</code>
+ * object being notified, or an empty collection if notification
+ * hasn't been caused by a matching filter criteria.
+ */
+ Collection/* <? extends String> */getFilters();
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java
index efd158a2f5..0cfa023d95 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/DiscoveredServiceTracker.java
@@ -1,81 +1,81 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * 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.
- */
-
-package org.osgi.service.discovery;
-
-/**
- * Interface of trackers for discovered remote services.
- * <p>
- * When a service implementing this interface is registered with the framework,
- * then <code>Discovery</code> will notify it about remote services matching one
- * of the provided criteria and will keep notifying it on changes of information
- * known to Discovery regarding this services.
- *
- * <code>Discovery</code> may deliver notifications on discovered services to a
- * <code>DiscoveredServiceTracker</code> out of order and may concurrently call
- * and/or reenter a <code>DiscoveredServiceTracker</code>.
- *
- * @ThreadSafe
- */
-public interface DiscoveredServiceTracker {
-
- /**
- * Optional ServiceRegistration property which contains service interfaces
- * this tracker is interested in.
- * <p>
- * Value of this property is of type
- * <code>Collection (&lt;? extends String&gt;)</code>. May be
- * <code>null</code> or empty.
- */
- public static final String INTERFACE_MATCH_CRITERIA = "osgi.remote.discovery.interest.interfaces";
-
- /**
- * Optional ServiceRegistration property which contains filters for services
- * this tracker is interested in.
- * <p>
- * Note that these filters need to take into account service publication
- * properties which are not necessarily the same as properties under which a
- * service is registered. See {@link ServicePublication} for some standard
- * properties used to publish service metadata.
- * <p>
- * The following sample filter will make <code>Discovery</code> notify the
- * <code>DiscoveredServiceTracker</code> about services providing interface
- * 'my.company.foo' of version '1.0.1.3':
- * <code>"(&amp;(service.interface=my.company.foo)(service.interface.version=my.company.foo|1.0.1.3))"</code>.
- * <p>
- * Value of this property is of type
- * <code>Collection (&lt;? extends String&gt;)</code>. May be
- * <code>null</code>. or empty
- */
- public static final String FILTER_MATCH_CRITERIA = "osgi.remote.discovery.interest.filters";
-
- /**
- * Receives notification that information known to <code>Discovery</code>
- * regarding a remote service has changed.
- * <p>
- * The tracker is only notified about remote services which fulfill the
- * matching criteria, either one of the interfaces or one of the filters,
- * provided as properties of this service.
- * <p>
- * If multiple criteria match, then the tracker is notified about each of
- * them. This can be done either by a single notification callback or by
- * multiple subsequent ones.
- *
- * @param notification the <code>DiscoveredServiceNotification</code> object
- * describing the change. Is never <code>null</code>.
- */
- void serviceChanged(DiscoveredServiceNotification notification);
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.osgi.service.discovery;
+
+/**
+ * Interface of trackers for discovered remote services.
+ * <p>
+ * When a service implementing this interface is registered with the framework,
+ * then <code>Discovery</code> will notify it about remote services matching one
+ * of the provided criteria and will keep notifying it on changes of information
+ * known to Discovery regarding this services.
+ *
+ * <code>Discovery</code> may deliver notifications on discovered services to a
+ * <code>DiscoveredServiceTracker</code> out of order and may concurrently call
+ * and/or reenter a <code>DiscoveredServiceTracker</code>.
+ *
+ * @ThreadSafe
+ */
+public interface DiscoveredServiceTracker {
+
+ /**
+ * Optional ServiceRegistration property which contains service interfaces
+ * this tracker is interested in.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (&lt;? extends String&gt;)</code>. May be
+ * <code>null</code> or empty.
+ */
+ public static final String INTERFACE_MATCH_CRITERIA = "osgi.remote.discovery.interest.interfaces";
+
+ /**
+ * Optional ServiceRegistration property which contains filters for services
+ * this tracker is interested in.
+ * <p>
+ * Note that these filters need to take into account service publication
+ * properties which are not necessarily the same as properties under which a
+ * service is registered. See {@link ServicePublication} for some standard
+ * properties used to publish service metadata.
+ * <p>
+ * The following sample filter will make <code>Discovery</code> notify the
+ * <code>DiscoveredServiceTracker</code> about services providing interface
+ * 'my.company.foo' of version '1.0.1.3':
+ * <code>"(&amp;(service.interface=my.company.foo)(service.interface.version=my.company.foo|1.0.1.3))"</code>.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (&lt;? extends String&gt;)</code>. May be
+ * <code>null</code>. or empty
+ */
+ public static final String FILTER_MATCH_CRITERIA = "osgi.remote.discovery.interest.filters";
+
+ /**
+ * Receives notification that information known to <code>Discovery</code>
+ * regarding a remote service has changed.
+ * <p>
+ * The tracker is only notified about remote services which fulfill the
+ * matching criteria, either one of the interfaces or one of the filters,
+ * provided as properties of this service.
+ * <p>
+ * If multiple criteria match, then the tracker is notified about each of
+ * them. This can be done either by a single notification callback or by
+ * multiple subsequent ones.
+ *
+ * @param notification the <code>DiscoveredServiceNotification</code> object
+ * describing the change. Is never <code>null</code>.
+ */
+ void serviceChanged(DiscoveredServiceNotification notification);
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/Discovery.java b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/Discovery.java
index cca766a032..fd99b0282c 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/Discovery.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/Discovery.java
@@ -1,66 +1,66 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * 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.
- */
-
-package org.osgi.service.discovery;
-
-/**
- * Every Discovery Provider registers a service implementing this interface.
- * This service is registered with extra properties identified at the beginning
- * of this interface to denote the name of the product providing Discovery
- * functionality, its version, vendor, used protocols etc..
- * <p>
- * Discovery allows to publish services exposed for remote access as well as to
- * search for remote services. Register a {@link ServicePublication} service in
- * order to publish service metadata and or a {@link DiscoveredServiceTracker}
- * service in order to search for remote services.
- * <p>
- * Discovery service implementations usually rely on some discovery protocols or
- * other information distribution means.
- *
- * @ThreadSafe
- */
-public interface Discovery {
-
- /**
- * ServiceRegistration property for the name of the Discovery product.
- * <p>
- * Value of this property is of type <code>String</code>.
- */
- static final String PRODUCT_NAME = "osgi.remote.discovery.product";
-
- /**
- * ServiceRegistration property for the version of the Discovery product.
- * <p>
- * Value of this property is of type <code>String</code>.
- */
- static final String PRODUCT_VERSION = "osgi.remote.discovery.product.version";
-
- /**
- * ServiceRegistration property for the Discovery product vendor name.
- * <p>
- * Value of this property is of type <code>String</code>.
- */
- static final String VENDOR_NAME = "osgi.remote.discovery.vendor";
-
- /**
- * ServiceRegistration property that lists the discovery protocols used by
- * this Discovery service.
- * <p>
- * Value of this property is of type
- * <code>Collection (&lt;? extends String&gt;)</code>.
- */
- static final String SUPPORTED_PROTOCOLS = "osgi.remote.discovery.supported_protocols";
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.osgi.service.discovery;
+
+/**
+ * Every Discovery Provider registers a service implementing this interface.
+ * This service is registered with extra properties identified at the beginning
+ * of this interface to denote the name of the product providing Discovery
+ * functionality, its version, vendor, used protocols etc..
+ * <p>
+ * Discovery allows to publish services exposed for remote access as well as to
+ * search for remote services. Register a {@link ServicePublication} service in
+ * order to publish service metadata and or a {@link DiscoveredServiceTracker}
+ * service in order to search for remote services.
+ * <p>
+ * Discovery service implementations usually rely on some discovery protocols or
+ * other information distribution means.
+ *
+ * @ThreadSafe
+ */
+public interface Discovery {
+
+ /**
+ * ServiceRegistration property for the name of the Discovery product.
+ * <p>
+ * Value of this property is of type <code>String</code>.
+ */
+ static final String PRODUCT_NAME = "osgi.remote.discovery.product";
+
+ /**
+ * ServiceRegistration property for the version of the Discovery product.
+ * <p>
+ * Value of this property is of type <code>String</code>.
+ */
+ static final String PRODUCT_VERSION = "osgi.remote.discovery.product.version";
+
+ /**
+ * ServiceRegistration property for the Discovery product vendor name.
+ * <p>
+ * Value of this property is of type <code>String</code>.
+ */
+ static final String VENDOR_NAME = "osgi.remote.discovery.vendor";
+
+ /**
+ * ServiceRegistration property that lists the discovery protocols used by
+ * this Discovery service.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (&lt;? extends String&gt;)</code>.
+ */
+ static final String SUPPORTED_PROTOCOLS = "osgi.remote.discovery.supported_protocols";
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
index e1f389ea78..8f8b5d9f16 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServiceEndpointDescription.java
@@ -1,128 +1,128 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * 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.
- */
-
-package org.osgi.service.discovery;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * This interface describes an endpoint of a service. This class can be
- * considered as a wrapper around the property map of a published service and
- * its endpoint. It provides an API to conveniently access the most important
- * properties of the service.
- * <p>
- * <code>ServiceEndpointDescription</code> objects are immutable.
- *
- * @Immutable
- */
-public interface ServiceEndpointDescription {
-
- /**
- * Returns the value of the property with key
- * {@link ServicePublication#SERVICE_INTERFACE_NAME}.
- *
- * @return <code>Collection (&lt;? extends String&gt;)</code> of service
- * interface names provided by the advertised service endpoint. The
- * collection is never <code>null</code> or empty but contains at
- * least one service interface.
- */
- Collection /* <? extends String> */getProvidedInterfaces();
-
- /**
- * Returns non-Java endpoint interface name associated with the given
- * interface.
- * <p>
- * Value of the property with key
- * {@link ServicePublication#ENDPOINT_INTERFACE_NAME} is used by this
- * operation.
- *
- * @param interfaceName for which its non-Java endpoint interface name
- * should be returned.
- * @return non-Java endpoint interface name, or <code>null</code> if it
- * hasn't been provided or if given interface name is
- * <code>null</code>.
- */
- String getEndpointInterfaceName(String interfaceName);
-
- /**
- * Returns version of the given interface.
- * <p>
- * Value of the property with key
- * {@link ServicePublication#SERVICE_INTERFACE_VERSION} is used by this
- * operation.
- *
- * @param interfaceName for which its version should be returned.
- * @return Version of given service interface, or <code>null</code> if it
- * hasn't been provided or if given interface name is
- * <code>null</code>.
- */
- String getVersion(String interfaceName);
-
- /**
- * Returns the value of the property with key
- * {@link ServicePublication#ENDPOINT_LOCATION}.
- *
- * @return The url of the service location, or <code>null</code> if it
- * hasn't been provided.
- */
- URI getLocation();
-
- /**
- * Returns the value of the property with key
- * {@link ServicePublication#ENDPOINT_ID}.
- *
- * @return Unique id of service endpoint, or <code>null</code> if it hasn't
- * been provided.
- */
- String getEndpointID();
-
- /**
- * Getter method for the property value of a given key.
- *
- * @param key Name of the property
- * @return The property value, or <code>null</code> if none is found for the
- * given key or if provided key is <code>null</code>.
- */
- Object getProperty(String key);
-
- /**
- * Returns all names of service endpoint properties.
- *
- * @return a <code>Collection (&lt;? extends String&gt;)</code> of property
- * names available in the ServiceEndpointDescription. The collection
- * is never <code>null</code> or empty but contains at least names
- * of mandatory <code>ServicePublication</code> properties. Since
- * <code>ServiceEndpointDescription</code> objects are immutable,
- * the returned collection is also not going to be updated at a
- * later point of time.
- */
- Collection/* <? extends String> */getPropertyKeys();
-
- /**
- * Returns all service endpoint properties.
- *
- * @return all properties of the service as a
- * <code>Map (&lt;String, Object&gt;)</code>. The map is never
- * <code>null</code> or empty but contains at least mandatory
- * <code>ServicePublication</code> properties. Since
- * <code>ServiceEndpointDescription</code> objects are immutable,
- * the returned map is also not going to be updated at a later point
- * of time.
- */
- Map/* <String, Object> */getProperties();
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.osgi.service.discovery;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * This interface describes an endpoint of a service. This class can be
+ * considered as a wrapper around the property map of a published service and
+ * its endpoint. It provides an API to conveniently access the most important
+ * properties of the service.
+ * <p>
+ * <code>ServiceEndpointDescription</code> objects are immutable.
+ *
+ * @Immutable
+ */
+public interface ServiceEndpointDescription {
+
+ /**
+ * Returns the value of the property with key
+ * {@link ServicePublication#SERVICE_INTERFACE_NAME}.
+ *
+ * @return <code>Collection (&lt;? extends String&gt;)</code> of service
+ * interface names provided by the advertised service endpoint. The
+ * collection is never <code>null</code> or empty but contains at
+ * least one service interface.
+ */
+ Collection /* <? extends String> */getProvidedInterfaces();
+
+ /**
+ * Returns non-Java endpoint interface name associated with the given
+ * interface.
+ * <p>
+ * Value of the property with key
+ * {@link ServicePublication#ENDPOINT_INTERFACE_NAME} is used by this
+ * operation.
+ *
+ * @param interfaceName for which its non-Java endpoint interface name
+ * should be returned.
+ * @return non-Java endpoint interface name, or <code>null</code> if it
+ * hasn't been provided or if given interface name is
+ * <code>null</code>.
+ */
+ String getEndpointInterfaceName(String interfaceName);
+
+ /**
+ * Returns version of the given interface.
+ * <p>
+ * Value of the property with key
+ * {@link ServicePublication#SERVICE_INTERFACE_VERSION} is used by this
+ * operation.
+ *
+ * @param interfaceName for which its version should be returned.
+ * @return Version of given service interface, or <code>null</code> if it
+ * hasn't been provided or if given interface name is
+ * <code>null</code>.
+ */
+ String getVersion(String interfaceName);
+
+ /**
+ * Returns the value of the property with key
+ * {@link ServicePublication#ENDPOINT_LOCATION}.
+ *
+ * @return The url of the service location, or <code>null</code> if it
+ * hasn't been provided.
+ */
+ URI getLocation();
+
+ /**
+ * Returns the value of the property with key
+ * {@link ServicePublication#ENDPOINT_ID}.
+ *
+ * @return Unique id of service endpoint, or <code>null</code> if it hasn't
+ * been provided.
+ */
+ String getEndpointID();
+
+ /**
+ * Getter method for the property value of a given key.
+ *
+ * @param key Name of the property
+ * @return The property value, or <code>null</code> if none is found for the
+ * given key or if provided key is <code>null</code>.
+ */
+ Object getProperty(String key);
+
+ /**
+ * Returns all names of service endpoint properties.
+ *
+ * @return a <code>Collection (&lt;? extends String&gt;)</code> of property
+ * names available in the ServiceEndpointDescription. The collection
+ * is never <code>null</code> or empty but contains at least names
+ * of mandatory <code>ServicePublication</code> properties. Since
+ * <code>ServiceEndpointDescription</code> objects are immutable,
+ * the returned collection is also not going to be updated at a
+ * later point of time.
+ */
+ Collection/* <? extends String> */getPropertyKeys();
+
+ /**
+ * Returns all service endpoint properties.
+ *
+ * @return all properties of the service as a
+ * <code>Map (&lt;String, Object&gt;)</code>. The map is never
+ * <code>null</code> or empty but contains at least mandatory
+ * <code>ServicePublication</code> properties. Since
+ * <code>ServiceEndpointDescription</code> objects are immutable,
+ * the returned map is also not going to be updated at a later point
+ * of time.
+ */
+ Map/* <String, Object> */getProperties();
+}
diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServicePublication.java b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServicePublication.java
index 9b4cb4c905..d490394bc3 100644
--- a/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServicePublication.java
+++ b/java/sca/modules/node-impl-osgi/src/main/java/org/osgi/service/discovery/ServicePublication.java
@@ -1,147 +1,147 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * 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.
- */
-
-package org.osgi.service.discovery;
-
-import org.osgi.framework.ServiceReference;
-
-/**
- * Register a service implementing the <code>ServicePublication</code> interface
- * in order to publish metadata of a particular service (endpoint) via
- * Discovery. Metadata which has to be published is given in form of properties
- * at registration.
- * <p>
- * In order to update published service metadata, update the properties
- * registered with the <code>ServicePublication</code> service. Depending on
- * Discovery's implementation and underlying protocol it may result in an update
- * or new re-publication of the service.
- * <p>
- * In order to unpublish the previously published service metadata, unregister
- * the <code>ServicePublication</code> service.
- * <p>
- * Please note that providing the {@link #SERVICE_INTERFACE_NAME} property is
- * mandatory when a <code>ServicePublication</code> service is registered. Note
- * also that a Discovery implementation may require provision of additional
- * properties, e.g. some of the standard properties defined below, or may make
- * special use of them in case they are provided. For example an SLP-based
- * Discovery might use the value provided with the {@link #ENDPOINT_LOCATION}
- * property for construction of a SLP-URL used to publish the service.
- * <p>
- * Also important is that it's not guaranteed that after registering a
- * <code>ServicePublication</code> object its service metadata is actually
- * published. Beside the fact that at least one Discovery service has to be
- * present, the provided properties have to be valid, e.g. shouldn't contain
- * case variants of the same key name, and the actual publication via Discovery
- * mechanisms has to succeed.
- *
- * @ThreadSafe
- */
-public interface ServicePublication {
-
- /**
- * Mandatory ServiceRegistration property which contains a collection of
- * full qualified interface names offered by the advertised service
- * endpoint.
- * <p>
- * Value of this property is of type
- * <code>Collection (&lt;? extends String&gt;)</code>.
- */
- public static final String SERVICE_INTERFACE_NAME = "osgi.remote.service.interfaces";
-
- /**
- * Optional ServiceRegistration property which contains a collection of
- * interface names with their associated version attributes separated by
- * {@link #SEPARATOR} e.g. ["my.company.foo|1.3.5", "my.company.zoo|2.3.5"].
- * In case no version has been provided for an interface, Discovery may use
- * the String-value of <code>org.osgi.framework.Version.emptyVersion</code>
- * constant.
- * <p>
- * Value of this property is of type
- * <code>Collection (&lt;? extends String&gt;)</code>, may be
- * <code>null</code> or empty.
- */
- public static final String SERVICE_INTERFACE_VERSION = "osgi.remote.service.interfaces.version";
-
- /**
- * Optional ServiceRegistration property which contains a collection of
- * interface names with their associated (non-Java) endpoint interface names
- * separated by {@link #SEPARATOR} e.g.:<br>
- * ["my.company.foo|MyWebService", "my.company.zoo|MyWebService"].
- * <p>
- * This (non-Java) endpoint interface name is usually a communication
- * protocol specific interface, for instance a web service interface name.
- * Though this information is usually contained in accompanying properties
- * e.g. a wsdl file, Discovery usually doesn't read and interprets such
- * service meta-data. Providing this information explicitly, might allow
- * external non-Java applications find services based on this endpoint
- * interface.
- * <p>
- * Value of this property is of type
- * <code>Collection (&lt;? extends String&gt;)</code>, may be
- * <code>null</code> or empty.
- */
- public static final String ENDPOINT_INTERFACE_NAME = "osgi.remote.endpoint.interfaces";
-
- /**
- * Optional ServiceRegistration property which contains a map of properties
- * of the published service.
- * <p>
- * Property keys are handled in a case insensitive manner (as OSGi Framework
- * does).
- * <p>
- * Value of this property is of type <code>Map (String, Object)</code>, may
- * be <code>null</code> or empty.
- */
- public static final String SERVICE_PROPERTIES = "osgi.remote.discovery.publication.service.properties";
-
- /**
- * Optional property of the published service identifying its location. This
- * property is provided as part of the service property map referenced by
- * the {@link #SERVICE_PROPERTIES} ServiceRegistration property.
- * <p>
- * Value of this property is of type <code>java.net.URI</code>, may be
- * <code>null</code>.
- */
- public static final String ENDPOINT_LOCATION = "osgi.remote.endpoint.location";
-
- /**
- * Optional property of the published service uniquely identifying its
- * endpoint. This property is provided as part of the service property map
- * referenced by the {@link #SERVICE_PROPERTIES} ServiceRegistration
- * property.
- * <p>
- * Value of this property is of type <code>String</code>, may be
- * <code>null</code>.
- */
- public static final String ENDPOINT_ID = "osgi.remote.endpoint.id";
-
- /**
- * Separator constant for association of interface-specific values with the
- * particular interface name. See also {@link #SERVICE_INTERFACE_VERSION}
- * and {@link #ENDPOINT_INTERFACE_NAME} properties which describe such
- * interface-specific values.
- */
- public static final String SEPARATOR = "|";
-
- /**
- * Returns the <code>ServiceReference</code> this publication metadata is
- * associated with.
- *
- * @return the <code>ServiceReference</code> being published. Is never
- * <code>null</code>.
- */
- ServiceReference getReference();
-}
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.osgi.service.discovery;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Register a service implementing the <code>ServicePublication</code> interface
+ * in order to publish metadata of a particular service (endpoint) via
+ * Discovery. Metadata which has to be published is given in form of properties
+ * at registration.
+ * <p>
+ * In order to update published service metadata, update the properties
+ * registered with the <code>ServicePublication</code> service. Depending on
+ * Discovery's implementation and underlying protocol it may result in an update
+ * or new re-publication of the service.
+ * <p>
+ * In order to unpublish the previously published service metadata, unregister
+ * the <code>ServicePublication</code> service.
+ * <p>
+ * Please note that providing the {@link #SERVICE_INTERFACE_NAME} property is
+ * mandatory when a <code>ServicePublication</code> service is registered. Note
+ * also that a Discovery implementation may require provision of additional
+ * properties, e.g. some of the standard properties defined below, or may make
+ * special use of them in case they are provided. For example an SLP-based
+ * Discovery might use the value provided with the {@link #ENDPOINT_LOCATION}
+ * property for construction of a SLP-URL used to publish the service.
+ * <p>
+ * Also important is that it's not guaranteed that after registering a
+ * <code>ServicePublication</code> object its service metadata is actually
+ * published. Beside the fact that at least one Discovery service has to be
+ * present, the provided properties have to be valid, e.g. shouldn't contain
+ * case variants of the same key name, and the actual publication via Discovery
+ * mechanisms has to succeed.
+ *
+ * @ThreadSafe
+ */
+public interface ServicePublication {
+
+ /**
+ * Mandatory ServiceRegistration property which contains a collection of
+ * full qualified interface names offered by the advertised service
+ * endpoint.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (&lt;? extends String&gt;)</code>.
+ */
+ public static final String SERVICE_INTERFACE_NAME = "osgi.remote.service.interfaces";
+
+ /**
+ * Optional ServiceRegistration property which contains a collection of
+ * interface names with their associated version attributes separated by
+ * {@link #SEPARATOR} e.g. ["my.company.foo|1.3.5", "my.company.zoo|2.3.5"].
+ * In case no version has been provided for an interface, Discovery may use
+ * the String-value of <code>org.osgi.framework.Version.emptyVersion</code>
+ * constant.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (&lt;? extends String&gt;)</code>, may be
+ * <code>null</code> or empty.
+ */
+ public static final String SERVICE_INTERFACE_VERSION = "osgi.remote.service.interfaces.version";
+
+ /**
+ * Optional ServiceRegistration property which contains a collection of
+ * interface names with their associated (non-Java) endpoint interface names
+ * separated by {@link #SEPARATOR} e.g.:<br>
+ * ["my.company.foo|MyWebService", "my.company.zoo|MyWebService"].
+ * <p>
+ * This (non-Java) endpoint interface name is usually a communication
+ * protocol specific interface, for instance a web service interface name.
+ * Though this information is usually contained in accompanying properties
+ * e.g. a wsdl file, Discovery usually doesn't read and interprets such
+ * service meta-data. Providing this information explicitly, might allow
+ * external non-Java applications find services based on this endpoint
+ * interface.
+ * <p>
+ * Value of this property is of type
+ * <code>Collection (&lt;? extends String&gt;)</code>, may be
+ * <code>null</code> or empty.
+ */
+ public static final String ENDPOINT_INTERFACE_NAME = "osgi.remote.endpoint.interfaces";
+
+ /**
+ * Optional ServiceRegistration property which contains a map of properties
+ * of the published service.
+ * <p>
+ * Property keys are handled in a case insensitive manner (as OSGi Framework
+ * does).
+ * <p>
+ * Value of this property is of type <code>Map (String, Object)</code>, may
+ * be <code>null</code> or empty.
+ */
+ public static final String SERVICE_PROPERTIES = "osgi.remote.discovery.publication.service.properties";
+
+ /**
+ * Optional property of the published service identifying its location. This
+ * property is provided as part of the service property map referenced by
+ * the {@link #SERVICE_PROPERTIES} ServiceRegistration property.
+ * <p>
+ * Value of this property is of type <code>java.net.URI</code>, may be
+ * <code>null</code>.
+ */
+ public static final String ENDPOINT_LOCATION = "osgi.remote.endpoint.location";
+
+ /**
+ * Optional property of the published service uniquely identifying its
+ * endpoint. This property is provided as part of the service property map
+ * referenced by the {@link #SERVICE_PROPERTIES} ServiceRegistration
+ * property.
+ * <p>
+ * Value of this property is of type <code>String</code>, may be
+ * <code>null</code>.
+ */
+ public static final String ENDPOINT_ID = "osgi.remote.endpoint.id";
+
+ /**
+ * Separator constant for association of interface-specific values with the
+ * particular interface name. See also {@link #SERVICE_INTERFACE_VERSION}
+ * and {@link #ENDPOINT_INTERFACE_NAME} properties which describe such
+ * interface-specific values.
+ */
+ public static final String SEPARATOR = "|";
+
+ /**
+ * Returns the <code>ServiceReference</code> this publication metadata is
+ * associated with.
+ *
+ * @return the <code>ServiceReference</code> being published. Is never
+ * <code>null</code>.
+ */
+ ServiceReference getReference();
+}
diff --git a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/bundle.componentType b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/bundle.componentType
index 7860094626..bc9e4f6aaf 100644
--- a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/bundle.componentType
+++ b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/bundle.componentType
@@ -1,54 +1,54 @@
-<?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>
+<?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/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/calculator.composite b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/calculator.composite
index 3c77086c45..1ae44d0a0b 100644
--- a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/calculator.composite
+++ b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/calculator.composite
@@ -1,53 +1,53 @@
-<?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">
- <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
- </reference>
- <reference name="subtractService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
- </reference>
- <reference name="multiplyService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
- </reference>
- <reference name="divideService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
- </reference>
-
- <!--
- <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>
+<?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">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
+ </reference>
+ <reference name="subtractService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
+ </reference>
+ <reference name="multiplyService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
+ </reference>
+ <reference name="divideService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
+ </reference>
+
+ <!--
+ <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/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/bundle.componentType b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/bundle.componentType
index 6f6f4bdce6..72e2c339f1 100644
--- a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/bundle.componentType
+++ b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/bundle.componentType
@@ -1,47 +1,47 @@
-<?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>
+<?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/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/operations.composite b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/operations.composite
index c9fb3818b8..253f7d0df1 100644
--- a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/operations.composite
+++ b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/operations/operations.composite
@@ -1,43 +1,43 @@
-<?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" />
- <service name="AddService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
- </service>
- <service name="SubtractService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
- </service>
- <service name="MultiplyService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
- </service>
- <service name="DivideService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
- </service>
-
- </component>
-
-</composite>
+<?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" />
+ <service name="AddService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
+ </service>
+ <service name="SubtractService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
+ </service>
+ <service name="MultiplyService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
+ </service>
+ <service name="DivideService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
+ </service>
+
+ </component>
+
+</composite>
diff --git a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/sca-contribution.xml b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/sca-contribution.xml
index 8ba4b85247..b14b3516f6 100644
--- a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/sca-contribution.xml
+++ b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/sca-contribution.xml
@@ -1,24 +1,24 @@
-<?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.
--->
-
-<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
- xmlns:c="http://calculator.dosgi">
- <deployable composite="c:CalculatorComposite" />
-</contribution>
+<?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.
+-->
+
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns:c="http://calculator.dosgi">
+ <deployable composite="c:CalculatorComposite" />
+</contribution>
diff --git a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite
index ac7f0f470c..f48262bdb4 100644
--- a/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite
+++ b/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite
@@ -1,70 +1,70 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<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">
- <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
- </reference>
- <reference name="subtractService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
- </reference>
- <reference name="multiplyService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
- </reference>
- <reference name="divideService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
- </reference>
-
- <!--
- <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 name="OperationsComponent">
- <tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi.operations" bundleVersion="1.0.0" />
- <service name="AddService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
- </service>
- <service name="SubtractService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
- </service>
- <service name="MultiplyService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
- </service>
- <service name="DivideService">
- <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
- </service>
-
- </component>
- </component>
-
-</composite>
+<?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">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
+ </reference>
+ <reference name="subtractService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
+ </reference>
+ <reference name="multiplyService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
+ </reference>
+ <reference name="divideService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
+ </reference>
+
+ <!--
+ <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 name="OperationsComponent">
+ <tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi.operations" bundleVersion="1.0.0" />
+ <service name="AddService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/AddService"/>
+ </service>
+ <service name="SubtractService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/SubtractService"/>
+ </service>
+ <service name="MultiplyService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/MultiplyService"/>
+ </service>
+ <service name="DivideService">
+ <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
+ </service>
+
+ </component>
+ </component>
+
+</composite>