Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2010-12-30 12:34:06 -0500
committerslewis2010-12-30 12:34:06 -0500
commit24f5527beb735f1303d2b7eaf05291f36407ba68 (patch)
tree22066f7378a4f0bde4830b393742116cfd347d37 /incubation
parent884be2c676f5042ffc6bfdf9deb5a44a378d8b64 (diff)
downloadorg.eclipse.ecf-24f5527beb735f1303d2b7eaf05291f36407ba68.tar.gz
org.eclipse.ecf-24f5527beb735f1303d2b7eaf05291f36407ba68.tar.xz
org.eclipse.ecf-24f5527beb735f1303d2b7eaf05291f36407ba68.zip
RSA additions and simplifications
Diffstat (limited to 'incubation')
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractRemoteServiceAdmin.java47
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java3
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManager.java44
3 files changed, 36 insertions, 58 deletions
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractRemoteServiceAdmin.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractRemoteServiceAdmin.java
index f5e2030cb..08c3cb4f3 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractRemoteServiceAdmin.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractRemoteServiceAdmin.java
@@ -360,8 +360,9 @@ public abstract class AbstractRemoteServiceAdmin {
// ECF properties
// ID namespace
String idNamespace = containerID.getNamespace().getName();
- endpointDescriptionProperties.put(RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE, idNamespace);
-
+ endpointDescriptionProperties.put(
+ RemoteConstants.ENDPOINT_CONTAINER_ID_NAMESPACE, idNamespace);
+
// ENDPOINT_CONNECTTARGET_ID
String connectTarget = (String) PropertiesUtil.getPropertyValue(
serviceReference, overridingProperties,
@@ -385,7 +386,7 @@ public abstract class AbstractRemoteServiceAdmin {
// ENDPOINT_REMOTESERVICE_FILTER
String rsFilter = (String) PropertiesUtil.getPropertyValue(
- serviceReference, overridingProperties,
+ serviceReference, overridingProperties,
RemoteConstants.ENDPOINT_REMOTESERVICE_FILTER);
if (rsFilter != null)
endpointDescriptionProperties.put(
@@ -964,26 +965,32 @@ public abstract class AbstractRemoteServiceAdmin {
public Collection<org.osgi.service.remoteserviceadmin.ExportRegistration> exportService(
ServiceReference serviceReference,
Map<String, Object> overridingProperties) {
+
trace("exportService", "serviceReference=" + serviceReference
+ ",properties=" + overridingProperties);
- String[] exportedInterfaces = (String[]) PropertiesUtil
- .getPropertyValue(
-
- serviceReference,
- overridingProperties,
- org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_INTERFACES);
- String[] exportedConfigs = (String[]) PropertiesUtil
- .getPropertyValue(
- serviceReference,
- overridingProperties,
- org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_CONFIGS);
- String[] serviceIntents = (String[]) PropertiesUtil
- .getPropertyValue(
-
- serviceReference,
- overridingProperties,
- org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS);
+ // First get exported interfaces...try overriding properties first...or from serviceReference second
+ String[] exportedInterfaces = null;
+ if (overridingProperties != null)
+ exportedInterfaces = (String[]) overridingProperties
+ .get(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_INTERFACES);
+ if (exportedInterfaces == null)
+ exportedInterfaces = PropertiesUtil
+ .getExportedInterfaces(serviceReference);
+ // If null, we don't have anything to export (log warning and return empty Collection)
+ if (exportedInterfaces == null) {
+ logWarning("exportService", "serviceReference=" + serviceReference
+ + " does not expose any exported interfaces");
+ return Collections.EMPTY_LIST;
+ }
+ // Get optional service property for exported configs
+ String[] exportedConfigs = PropertiesUtil
+ .getStringArrayFromPropertyValue(serviceReference
+ .getProperty(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_CONFIGS));
+ // Get all intents (service.intents, service.exported.intents,
+ // service.exported.intents.extra)
+ String[] serviceIntents = PropertiesUtil
+ .getServiceIntents(serviceReference);
// Get a host container selector
IHostContainerSelector hostContainerSelector = getHostContainerSelector();
if (hostContainerSelector == null) {
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java
index b0f2b340f..13ff8095d 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java
@@ -106,8 +106,7 @@ public abstract class AbstractTopologyManager {
}
protected org.osgi.service.remoteserviceadmin.RemoteServiceAdmin selectExportRemoteServiceAdmin(
- ServiceReference serviceReference, String[] exportedInterfaces,
- String[] exportedConfigs, String[] serviceIntents) {
+ ServiceReference serviceReference, String[] exportedInterfaces) {
synchronized (remoteServiceAdminLock) {
if (remoteServiceAdmin == null)
remoteServiceAdmin = new RemoteServiceAdmin(getContext());
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManager.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManager.java
index 2d5dd679a..29b6e362a 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManager.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/TopologyManager.java
@@ -129,25 +129,6 @@ public class TopologyManager extends AbstractTopologyManager implements
+ endpointDescription);
}
- private Map<String, Object> prepareExportProperties(
- ServiceReference serviceReference, String[] exportedInterfaces,
- String[] exportedConfigs, String[] serviceIntents,
- org.osgi.service.remoteserviceadmin.RemoteServiceAdmin rsa) {
- Map<String, Object> result = new HashMap<String, Object>();
- result.put(
- org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_INTERFACES,
- exportedInterfaces);
- if (exportedConfigs != null)
- result.put(
- org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_CONFIGS,
- exportedConfigs);
- if (serviceIntents != null)
- result.put(
- org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS,
- serviceIntents);
- return result;
- }
-
public void event(ServiceEvent event, Collection contexts) {
switch (event.getType()) {
case ServiceEvent.MODIFIED:
@@ -176,25 +157,9 @@ public class TopologyManager extends AbstractTopologyManager implements
if (exportedInterfaces == null)
return;
- // Get optional service property for exported configs
- String[] exportedConfigs = PropertiesUtil
- .getStringArrayFromPropertyValue(serviceReference
- .getProperty(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_CONFIGS));
-
- // Get all intents (service.intents, service.exported.intents,
- // service.exported.intents.extra)
- String[] serviceIntents = PropertiesUtil
- .getServiceIntents(serviceReference);
-
// Select remote service admin
org.osgi.service.remoteserviceadmin.RemoteServiceAdmin rsa = selectExportRemoteServiceAdmin(
- serviceReference, exportedInterfaces, exportedConfigs,
- serviceIntents);
-
- // prepare export properties
- Map<String, Object> exportProperties = prepareExportProperties(
- serviceReference, exportedInterfaces, exportedConfigs,
- serviceIntents, rsa);
+ serviceReference, exportedInterfaces);
// if no remote service admin available, then log error and return
if (rsa == null) {
@@ -204,6 +169,13 @@ public class TopologyManager extends AbstractTopologyManager implements
+ ". Remote service NOT EXPORTED");
return;
}
+
+ // prepare export properties
+ Map<String, Object> exportProperties = new HashMap<String, Object>();
+ exportProperties.put(
+ org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_INTERFACES,
+ exportedInterfaces);
+
// Export the remote service using the selected remote service admin
Collection<org.osgi.service.remoteserviceadmin.ExportRegistration> registrations = rsa
.exportService(serviceReference, exportProperties);

Back to the top