Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2005-06-25 07:35:24 +0000
committerslewis2005-06-25 07:35:24 +0000
commit960c9c70dd8114481a58abfa18a35c7c74c3529e (patch)
tree152b764a0c6ad76591332a50b1a7d481e57de3ef
parente1a14e12d8407c8649d23c503f63776bcce63884 (diff)
downloadorg.eclipse.ecf-960c9c70dd8114481a58abfa18a35c7c74c3529e.tar.gz
org.eclipse.ecf-960c9c70dd8114481a58abfa18a35c7c74c3529e.tar.xz
org.eclipse.ecf-960c9c70dd8114481a58abfa18a35c7c74c3529e.zip
Changes/additions to behavior for service registration, handling of service connect actions, containerDispose, and setupDiscoveryContainer action.
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/launchconfigs/ECF Example Collab Client 1.launch2
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/Client.java6
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/DiscoveryStartup.java39
3 files changed, 31 insertions, 16 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/launchconfigs/ECF Example Collab Client 1.launch b/examples/bundles/org.eclipse.ecf.example.collab/launchconfigs/ECF Example Collab Client 1.launch
index 93c9c302e..cbeb0a61e 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/launchconfigs/ECF Example Collab Client 1.launch
+++ b/examples/bundles/org.eclipse.ecf.example.collab/launchconfigs/ECF Example Collab Client 1.launch
@@ -221,7 +221,7 @@
<mapEntry key="org.eclipse.core.runtime/loader/debug/prefixes/failure" value="false"/>
</mapAttribute>
<booleanAttribute key="automaticAdd" value="false"/>
-<stringAttribute key="checked" value="org.eclipse.ecf.provider.xmpp"/>
+<stringAttribute key="checked" value="org.eclipse.ecf.provider.jmdns"/>
<booleanAttribute key="includeFragments" value="false"/>
<stringAttribute key="configLocation" value=""/>
<booleanAttribute key="clearws" value="false"/>
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/Client.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/Client.java
index a71e106c8..165e80eaf 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/Client.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/Client.java
@@ -331,7 +331,7 @@ public class Client {
if (pc != null) setupPresenceContainer(client,pc,groupID,username);
// Check for discoverycontainer...if it is, setup
IDiscoveryContainer dc = (IDiscoveryContainer) client.getAdapter(IDiscoveryContainer.class);
- if (dc != null) setupDiscoveryContainer(dc);
+ if (dc != null) setupDiscoveryContainer(dc,client);
try {
client.joinGroup(groupID, getJoinContext(username,data));
@@ -546,7 +546,7 @@ public class Client {
protected DiscoveryView discoveryView = null;
- protected void setupDiscoveryContainer(final IDiscoveryContainer dc) {
+ protected void setupDiscoveryContainer(final IDiscoveryContainer dc, final ISharedObjectContainer socontainer) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
@@ -555,7 +555,7 @@ public class Client {
IWorkbenchPage wp = ww.getActivePage();
IViewPart view = wp.showView("org.eclipse.ecf.ui.view.discoveryview");
discoveryView = (DiscoveryView) view;
- discoveryView.setDiscoveryContainer(dc);
+ discoveryView.setDiscoveryContainer(dc,socontainer);
} catch (Exception e) {
IStatus status = new Status(IStatus.ERROR,ClientPlugin.PLUGIN_ID,IStatus.OK,"Exception showing presence view",e);
ClientPlugin.getDefault().getLog().log(status);
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/DiscoveryStartup.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/DiscoveryStartup.java
index c675a654f..ee305227c 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/DiscoveryStartup.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/DiscoveryStartup.java
@@ -2,6 +2,7 @@ package org.eclipse.ecf.example.collab;
import java.net.InetAddress;
import java.net.URI;
+import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
@@ -21,7 +22,7 @@ import org.eclipse.ecf.discovery.IServiceTypeListener;
import org.eclipse.ecf.discovery.ServiceInfo;
import org.eclipse.ecf.example.collab.actions.ClientConnectAction;
import org.eclipse.ecf.ui.views.DiscoveryView;
-import org.eclipse.ecf.ui.views.IServiceConnectListener;
+import org.eclipse.ecf.ui.views.IDiscoveryControlListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -44,11 +45,14 @@ public class DiscoveryStartup {
public static final int SVC_DEF_PRIORITY = 0;
static IDiscoveryContainer discovery = null;
+ static ISharedObjectContainer socontainer = null;
+
protected DiscoveryView discoveryView = null;
static String serviceTypes[] = new String[] {
- TCPSERVER_DISCOVERY_TYPE,
- "_http._tcp.local."
+ TCPSERVER_DISCOVERY_TYPE
+ //,
+ //"_http._tcp.local."
};
public static IDiscoveryContainer getDefault() {
@@ -70,13 +74,13 @@ public class DiscoveryStartup {
}
protected void setupDiscovery() {
try {
- ISharedObjectContainer container = SharedObjectContainerFactory
+ socontainer = SharedObjectContainerFactory
.makeSharedObjectContainer(DISCOVERY_CONTAINER);
- discovery = (IDiscoveryContainer) container
+ discovery = (IDiscoveryContainer) socontainer
.getAdapter(IDiscoveryContainer.class);
if (discovery != null) {
setupDiscoveryContainer(discovery);
- container.joinGroup(null,null);
+ socontainer.joinGroup(null,null);
registerServiceTypes();
}
else {
@@ -122,12 +126,20 @@ public class DiscoveryStartup {
IWorkbenchPage wp = ww.getActivePage();
IViewPart view = wp.showView("org.eclipse.ecf.ui.view.discoveryview");
discoveryView = (DiscoveryView) view;
- discoveryView.setDiscoveryContainer(dc);
+ discoveryView.setDiscoveryContainer(dc,socontainer);
discoveryView.setShowTypeDetails(false);
- discoveryView.setServiceConnectListener(new IServiceConnectListener() {
+ discoveryView.setServiceConnectListener(new IDiscoveryControlListener() {
public void connectToService(IServiceInfo service) {
connectToServiceFromInfo(service);
}
+
+ public void setupDiscoveryContainer(DiscoveryView view) {
+ System.out.println("setupDiscoveryContainer");
+ }
+
+ public void disposeDiscoveryContainer(DiscoveryView view) {
+ System.out.println("disposeDiscoveryContainer");
+ }
});
} catch (Exception e) {
IStatus status = new Status(IStatus.ERROR,ClientPlugin.PLUGIN_ID,IStatus.OK,"Exception showing presence view",e);
@@ -160,9 +172,11 @@ public class DiscoveryStartup {
discovery.unregisterAllServices();
}
}
+
+ static Hashtable registeredServices = new Hashtable();
+
public static void registerServer(ID id) {
if (discovery != null) {
- String name = id.getName();
try {
URI uri = id.toURI();
String path = uri.getPath();
@@ -176,10 +190,11 @@ public class DiscoveryStartup {
InetAddress host = InetAddress.getByName(uri.getHost());
int port = uri.getPort();
String svcName = System.getProperty("user.name")+"."+protocol;
- discovery.registerService(new ServiceInfo(host, new ServiceID(TCPSERVER_DISCOVERY_TYPE,svcName), port, SVC_DEF_PRIORITY,
- SVC_DEF_WEIGHT, props));
+ ServiceInfo svcInfo = new ServiceInfo(host, new ServiceID(TCPSERVER_DISCOVERY_TYPE,svcName), port, SVC_DEF_PRIORITY,
+ SVC_DEF_WEIGHT, props);
+ discovery.registerService(svcInfo);
} catch (Exception e) {
- ClientPlugin.log("Exception registering server " + name, e);
+ ClientPlugin.log("Exception getting URI for ID"+id);
}
}
}

Back to the top