summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-06-24 23:45:28 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-06-24 23:45:28 +0000
commitcb4967e57dd8a327bffd21249db190bc2a12e70c (patch)
tree7399c12e837598a3175cb1bc34360aca83ee1739 /java/sca/modules
parentc5ed6e070ae8f3dd7a48c3e0d74cdefe6895b926 (diff)
Add service properties from SCA Endpoint
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@788211 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java8
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java2
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java19
3 files changed, 23 insertions, 6 deletions
diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java
index 612e10e770..48a2777579 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/AbstractDiscoveryService.java
@@ -34,6 +34,7 @@ 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.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -314,10 +315,9 @@ public abstract class AbstractDiscoveryService implements Discovery {
}
}
- protected void localServicePublished(ServiceReference ref) {
- EndpointPublication publication = new EndpointPublication(ref);
- Hashtable props = new Hashtable();
- ref.getBundle().getBundleContext().registerService(ServicePublication.class.getName(), publication, props);
+ protected void localServicePublished(ServiceReference ref, Endpoint endpoint) {
+ EndpointPublication publication = new EndpointPublication(ref, endpoint);
+ ref.getBundle().getBundleContext().registerService(ServicePublication.class.getName(), publication, publication.getProperties());
}
}
diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java
index 40094974ba..90305a9ae1 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/DomainDiscoveryService.java
@@ -76,7 +76,7 @@ public class DomainDiscoveryService extends AbstractDiscoveryService implements
// Ignore
}
if (ref != null) {
- localServicePublished(ref);
+ localServicePublished(ref, endpoint);
}
} else {
// Remote endpoints
diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
index 1a038ba41a..82080a2dc1 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/discovery/EndpointPublication.java
@@ -19,6 +19,12 @@
package org.apache.tuscany.sca.dosgi.discovery;
+import java.util.Dictionary;
+import java.util.HashMap;
+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;
@@ -26,6 +32,7 @@ import org.osgi.service.discovery.ServicePublication;
* Publication of an SCA endpoint
*/
public class EndpointPublication implements ServicePublication {
+ private Endpoint endpoint;
private ServiceReference reference;
/**
@@ -33,13 +40,23 @@ public class EndpointPublication implements ServicePublication {
* @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) {
+ 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 = new HashMap<String, Object>();
+ serviceProps.put(ENDPOINT_LOCATION, endpoint.getURI());
+ props.put(SERVICE_PROPERTIES, serviceProps);
+ // TODO: Populate the properties from the Endpoint object
+ return props;
+ }
+
}