Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Alexander Kuppe2013-12-16 10:09:53 +0000
committerMarkus Alexander Kuppe2013-12-16 15:07:39 +0000
commit695a5cee6021806d7d8a05b106ee7baec3073bf8 (patch)
tree3cdda25a05d41351caee7304e86e234600efbdec /providers/bundles/org.eclipse.ecf.provider.zookeeper
parentba5c12013c3d0a1295df57661646ce4b095c15b8 (diff)
downloadorg.eclipse.ecf-695a5cee6021806d7d8a05b106ee7baec3073bf8.tar.gz
org.eclipse.ecf-695a5cee6021806d7d8a05b106ee7baec3073bf8.tar.xz
org.eclipse.ecf-695a5cee6021806d7d8a05b106ee7baec3073bf8.zip
Bug 424060: Support advertising/de-advertisting IServiceInfos via OSGi
service registry https://bugs.eclipse.org/bugs/show_bug.cgi?id=424060 Change-Id: I83f959a4b1a493beef7d71d989d8d3adccc3569f Signed-off-by: Markus Alexander Kuppe <bugs.eclipse.org@lemmster.de>
Diffstat (limited to 'providers/bundles/org.eclipse.ecf.provider.zookeeper')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java1
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryContainer.java11
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java9
3 files changed, 11 insertions, 10 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java
index d17e89a8f..0bac43bda 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java
@@ -26,7 +26,6 @@ import org.eclipse.ecf.provider.zookeeper.util.PrettyPrinter;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryContainer.java b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryContainer.java
index 670e04156..a23e0f8c7 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryContainer.java
@@ -63,7 +63,6 @@ public class ZooDiscoveryContainer extends AbstractDiscoveryContainerAdapter {
private static ZooKeeperServer zooKeeperServer;
private ID targetId;
protected boolean isQuorumPeerReady;
- private ZooDiscoveryNamespace namespace;
private boolean isConnected;
private boolean isDisposed;
private WatchManager watchManager;
@@ -85,13 +84,9 @@ public class ZooDiscoveryContainer extends AbstractDiscoveryContainerAdapter {
}
private ZooDiscoveryContainer() {
-
super(ZooDiscoveryNamespace.NAME, Configurator.INSTANCE);
-
- CACHED_THREAD_POOL=Executors.newCachedThreadPool();
DiscoveryProperties = new Properties();
- this.namespace = new ZooDiscoveryNamespace();
-
+
if (autoStart()) {
try {
this.targetId = this.getConnectNamespace().createInstance(new String[] { DefaultDiscoveryConfig.getDefaultTarget() });
@@ -323,7 +318,7 @@ public class ZooDiscoveryContainer extends AbstractDiscoveryContainerAdapter {
}
public Namespace getConnectNamespace() {
- return this.namespace;
+ return super.getConnectNamespace();
}
public ID getConnectedID() {
@@ -367,7 +362,7 @@ public class ZooDiscoveryContainer extends AbstractDiscoveryContainerAdapter {
}
public Namespace getServicesNamespace() {
- return this.namespace;
+ return super.getServicesNamespace();
}
public synchronized void registerService(IServiceInfo serviceInfo) {
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java
index be319dac5..a6e5339a5 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java
@@ -18,6 +18,7 @@ import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+import org.eclipse.ecf.discovery.identity.ServiceTypeID;
public class ZooDiscoveryNamespace extends Namespace {
@@ -31,7 +32,7 @@ public class ZooDiscoveryNamespace extends Namespace {
public ID createInstance(Object[] parameters) throws IDCreateException {
Assert.isTrue(parameters != null && parameters.length > 0);
try {
- if (parameters[0] instanceof String) {
+ if (parameters[0] instanceof String && parameters instanceof String[]) {
return new ZooDiscoveryTargetID(this, (String[]) parameters);
} else if (parameters.length == 1
&& parameters[0] instanceof IServiceTypeID) {
@@ -42,6 +43,12 @@ public class ZooDiscoveryNamespace extends Namespace {
&& parameters[1] instanceof URI) {
return new ZooDiscoveryServiceID(this,
((IServiceTypeID) parameters[0]), ((URI) parameters[1]));
+ } else if (parameters.length == 2
+ && parameters[0] instanceof String
+ && parameters[1] instanceof URI) {
+ final String type = (String) parameters[0];
+ return new ZooDiscoveryServiceID(this,
+ new ServiceTypeID(this, type), ((URI) parameters[1]));
}
} catch (Exception e) {

Back to the top