Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2009-03-02 18:57:19 +0000
committerslewis2009-03-02 18:57:19 +0000
commitf0c8db186e94386fe845dadc54eaa1f18eed6e56 (patch)
treeac75e3d25ca46c60c3f361fb329b438b4f39a532
parent081a7bcd3e7f917a6333bbc30f0ceeee858bccee (diff)
downloadorg.eclipse.ecf-f0c8db186e94386fe845dadc54eaa1f18eed6e56.tar.gz
org.eclipse.ecf-f0c8db186e94386fe845dadc54eaa1f18eed6e56.tar.xz
org.eclipse.ecf-f0c8db186e94386fe845dadc54eaa1f18eed6e56.zip
Changes to accomodate compositediscoverycontainer
-rw-r--r--compendium/bundles/org.eclipse.ecf.osgi.services.discovery/META-INF/MANIFEST.MF1
-rw-r--r--compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/DiscoveredServiceNotificationImpl.java9
-rw-r--r--compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java46
-rw-r--r--compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ServiceEndpointDescriptionImpl.java15
4 files changed, 53 insertions, 18 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/META-INF/MANIFEST.MF b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/META-INF/MANIFEST.MF
index 2f51ecca0..75e8d2149 100644
--- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/META-INF/MANIFEST.MF
+++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Import-Package: org.eclipse.ecf.core,
org.eclipse.ecf.discovery,
org.eclipse.ecf.discovery.identity,
org.eclipse.ecf.discovery.service,
+ org.eclipse.ecf.provider.discovery,
org.eclipse.ecf.remoteservice,
org.osgi.framework;version="1.3.0",
org.osgi.service.discovery;version="1.0.0",
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/DiscoveredServiceNotificationImpl.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/DiscoveredServiceNotificationImpl.java
index 014db1552..e7f7e2886 100644
--- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/DiscoveredServiceNotificationImpl.java
+++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/DiscoveredServiceNotificationImpl.java
@@ -9,10 +9,9 @@
******************************************************************************/
package org.eclipse.ecf.internal.osgi.services.discovery;
-import org.eclipse.ecf.osgi.services.discovery.ServiceEndpointDescriptionImpl;
-
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.discovery.IServiceInfo;
+import org.eclipse.ecf.osgi.services.discovery.ServiceEndpointDescriptionImpl;
import org.osgi.service.discovery.DiscoveredServiceNotification;
import org.osgi.service.discovery.ServiceEndpointDescription;
@@ -22,11 +21,11 @@ public class DiscoveredServiceNotificationImpl implements
private final int type;
private ServiceEndpointDescription serviceEndpointDescription;
- public DiscoveredServiceNotificationImpl(ID localContainerID, int type,
- IServiceInfo serviceInfo) {
+ public DiscoveredServiceNotificationImpl(ID localContainerID,
+ ID originalLocalContainerID, int type, IServiceInfo serviceInfo) {
this.type = type;
this.serviceEndpointDescription = new ServiceEndpointDescriptionImpl(
- localContainerID, serviceInfo);
+ localContainerID, originalLocalContainerID, serviceInfo);
}
public ServiceEndpointDescription getServiceEndpointDescription() {
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java
index 4399fe3ba..6ce3272e6 100644
--- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java
+++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java
@@ -19,6 +19,7 @@ import org.eclipse.ecf.core.util.Trace;
import org.eclipse.ecf.discovery.*;
import org.eclipse.ecf.discovery.identity.*;
import org.eclipse.ecf.osgi.services.discovery.ECFServicePublication;
+import org.eclipse.ecf.provider.discovery.CompositeServiceContainerEvent;
import org.eclipse.ecf.remoteservice.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.discovery.*;
@@ -30,26 +31,39 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer {
private final IServiceListener serviceListener = new IServiceListener() {
public void serviceDiscovered(IServiceEvent anEvent) {
- handleServiceDiscovered(anEvent.getLocalContainerID(), anEvent
- .getServiceInfo());
+ handleServiceDiscovered(anEvent);
}
public void serviceUndiscovered(IServiceEvent anEvent) {
- handleServiceUndiscovered(anEvent.getLocalContainerID(), anEvent
- .getServiceInfo());
+ handleServiceUndiscovered(anEvent);
}
};
- void handleServiceDiscovered(ID localContainerID, IServiceInfo serviceInfo) {
+ void handleServiceDiscovered(IServiceEvent event) {
+ IServiceInfo serviceInfo = event.getServiceInfo();
IServiceID serviceID = serviceInfo.getServiceID();
+ ID localContainerID = event.getLocalContainerID();
+ // Set the original container ID to the re
+ ID originalLocalContainerID = localContainerID;
+ // If it's a composite container, then there is also the original
+ // container ID
+ if (event instanceof CompositeServiceContainerEvent) {
+ originalLocalContainerID = ((CompositeServiceContainerEvent) event)
+ .getOriginalLocalContainerID();
+ }
+ trace("handleOSGIServiceDiscovered", "localContainerID="
+ + localContainerID + ",originalLocalContainerID="
+ + originalLocalContainerID + " serviceInfo=" + serviceInfo);
if (matchServiceID(serviceID)) {
- trace("handleOSGIServiceDiscovered", "serviceInfo=" + serviceInfo);
+ trace("handleOSGIServiceDiscovered matched", "localContainerID="
+ + localContainerID + ",originalLocalContainerID="
+ + originalLocalContainerID + " serviceInfo=" + serviceInfo);
DiscoveredServiceTracker[] discoveredTrackers = findMatchingDiscoveredServiceTrackers(serviceInfo);
if (discoveredTrackers != null) {
for (int i = 0; i < discoveredTrackers.length; i++) {
discoveredTrackers[i]
.serviceChanged(new DiscoveredServiceNotificationImpl(
- localContainerID,
+ localContainerID, originalLocalContainerID,
DiscoveredServiceNotification.AVAILABLE,
serviceInfo));
}
@@ -57,16 +71,28 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer {
}
}
- void handleServiceUndiscovered(ID localContainerID, IServiceInfo serviceInfo) {
+ void handleServiceUndiscovered(IServiceEvent event) {
+ IServiceInfo serviceInfo = event.getServiceInfo();
IServiceID serviceID = serviceInfo.getServiceID();
+ ID localContainerID = event.getLocalContainerID();
+ // Set the original container ID to the re
+ ID originalLocalContainerID = localContainerID;
+ // If it's a composite container, then there is also the original
+ // container ID
+ if (event instanceof CompositeServiceContainerEvent) {
+ originalLocalContainerID = ((CompositeServiceContainerEvent) event)
+ .getOriginalLocalContainerID();
+ }
if (matchServiceID(serviceID)) {
- trace("handleOSGIServiceUndiscovered", "serviceInfo=" + serviceInfo);
+ trace("handleOSGIServiceUndiscovered", "localContainerID="
+ + localContainerID + ",originalLocalContainerID="
+ + originalLocalContainerID + " serviceInfo=" + serviceInfo);
DiscoveredServiceTracker[] discoveredTrackers = findMatchingDiscoveredServiceTrackers(serviceInfo);
if (discoveredTrackers != null) {
for (int i = 0; i < discoveredTrackers.length; i++) {
discoveredTrackers[i]
.serviceChanged(new DiscoveredServiceNotificationImpl(
- localContainerID,
+ localContainerID, originalLocalContainerID,
DiscoveredServiceNotification.UNAVAILABLE,
serviceInfo));
}
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ServiceEndpointDescriptionImpl.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ServiceEndpointDescriptionImpl.java
index 7c0d1e967..7eafa4a11 100644
--- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ServiceEndpointDescriptionImpl.java
+++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ServiceEndpointDescriptionImpl.java
@@ -24,18 +24,24 @@ public class ServiceEndpointDescriptionImpl implements
ServiceEndpointDescription {
private final ID discoveryContainerID;
+ private final ID originalDiscoveryContainerID;
private final IServiceInfo serviceInfo;
public ServiceEndpointDescriptionImpl(ID localContainerID,
- IServiceInfo serviceInfo) {
+ ID originalLocalContainerID, IServiceInfo serviceInfo) {
this.discoveryContainerID = localContainerID;
+ this.originalDiscoveryContainerID = originalLocalContainerID;
this.serviceInfo = serviceInfo;
}
- public ID getDiscoveryContainerID() {
+ public ID getLocalDiscoveryContainerID() {
return discoveryContainerID;
}
+ public ID getOriginalLocalDiscoveryContainerID() {
+ return originalDiscoveryContainerID;
+ }
+
public IServiceID getServiceID() {
return this.serviceInfo.getServiceID();
}
@@ -166,7 +172,10 @@ public class ServiceEndpointDescriptionImpl implements
public String toString() {
StringBuffer sb = new StringBuffer("ServiceEndpointDescriptionImpl[");
- sb.append("providedinterfaces=").append(getProvidedInterfaces());
+ sb.append("localContainerID=" + getLocalDiscoveryContainerID());
+ sb.append(";originalLocalContainerID="
+ + getOriginalLocalDiscoveryContainerID());
+ sb.append(";providedinterfaces=").append(getProvidedInterfaces());
sb.append(";location=").append(getLocation());
sb.append(";props=").append(getProperties()).append("]");
return sb.toString();

Back to the top