summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java')
-rw-r--r--branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java b/branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java
index 8ac949ccc5..d50d1ef9f9 100644
--- a/branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java
+++ b/branches/sca-java-2.0-M4/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java
@@ -23,9 +23,9 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.implementation.osgi.OSGiProperty;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
@@ -37,7 +37,6 @@ import org.osgi.framework.Constants;
* Implementation of {@link EndpointDescription}
*/
public class EndpointHelper {
- private final static String FRAMEWORK_UUID = "org.osgi.framework.uuid";
private EndpointHelper() {
}
@@ -54,11 +53,21 @@ public class EndpointHelper {
private static Map<String, Object> getProperties(BundleContext bundleContext, Endpoint endpoint) {
Map<String, Object> props = new HashMap<String, Object>();
- String uuid = getFrameworkUUID(bundleContext);
+ if (!endpoint.isRemote()) {
+ String uuid = OSGiHelper.getFrameworkUUID(bundleContext);
+ props.put(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID, uuid);
+ }
+
+ for (Object ext : endpoint.getService().getExtensions()) {
+ if (ext instanceof OSGiProperty) {
+ OSGiProperty prop = (OSGiProperty)ext;
+ props.put(prop.getName(), prop.getStringValue());
+ }
+ }
- props.put(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID, uuid);
+ props.put(RemoteConstants.SERVICE_REMOTE_ID, props.get(Constants.SERVICE_ID));
props.put(RemoteConstants.SERVICE_REMOTE_URI, endpoint.getURI());
- props.put(RemoteConstants.SERVICE_REMOTE_ID, String.valueOf(System.currentTimeMillis()));
+ // FIXME: [rfeng] How to pass in the remote service id from the endpoint XML
props.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, new String[] {"org.osgi.sca"});
props.put(Endpoint.class.getName(), endpoint);
List<String> interfaces = getInterfaces(endpoint);
@@ -66,15 +75,6 @@ public class EndpointHelper {
return props;
}
- public synchronized static String getFrameworkUUID(BundleContext bundleContext) {
- String uuid = System.getProperty(FRAMEWORK_UUID);
- if (uuid == null) {
- uuid = UUID.randomUUID().toString();
- }
- System.setProperty(FRAMEWORK_UUID, uuid);
- return uuid;
- }
-
public static Endpoint getEndpoint(EndpointDescription endpointDescription) {
return (Endpoint)endpointDescription.getProperties().get(Endpoint.class.getName());
}