Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2009-03-21 22:57:47 +0000
committermkuppe2009-03-21 22:57:47 +0000
commit447d1fa8c8b2dcc5cf2391af767149f3c1be6d4a (patch)
tree5a6e81a4769391dd280314a96808f69de6a3f7f5 /providers
parent90c17922a670161181afc76ad95e48600a8e9d0b (diff)
downloadorg.eclipse.ecf-447d1fa8c8b2dcc5cf2391af767149f3c1be6d4a.tar.gz
org.eclipse.ecf-447d1fa8c8b2dcc5cf2391af767149f3c1be6d4a.tar.xz
org.eclipse.ecf-447d1fa8c8b2dcc5cf2391af767149f3c1be6d4a.zip
NEW - bug 267390: RFC 119 compliant file based discovery
https://bugs.eclipse.org/bugs/show_bug.cgi?id=267390 Create a default container if non set up
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
index cae521b4f..e69942507 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
@@ -11,11 +11,15 @@
package org.eclipse.ecf.internal.provider.r_osgi;
+import ch.ethz.iks.r_osgi.RemoteOSGiService;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Arrays;
import org.eclipse.ecf.core.*;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDCreateException;
import org.eclipse.ecf.core.provider.IContainerInstantiator;
+import org.eclipse.ecf.provider.r_osgi.identity.R_OSGiID;
import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
/**
@@ -42,13 +46,24 @@ public final class R_OSGiContainerInstantiator implements IContainerInstantiator
*/
public IContainer createInstance(final ContainerTypeDescription description, final Object[] parameters) throws ContainerCreateException {
try {
- if (parameters.length == 1 && parameters[0] instanceof ID) {
- return new R_OSGiRemoteServiceContainer(Activator.getDefault().getRemoteOSGiService(), (ID) parameters[0]);
+ final RemoteOSGiService remoteOsGiService = Activator.getDefault().getRemoteOSGiService();
+ if (parameters == null) {
+ //TODO factor localHost and protocol out?
+ final String localHost = InetAddress.getLocalHost().getHostName();
+ final String protocol = "r-osgi"; //$NON-NLS-1$
+
+ final int port = remoteOsGiService.getListeningPort(protocol);
+ final ID containerID = new R_OSGiID(protocol + "://" + localHost + ":" + port); //$NON-NLS-1$ //$NON-NLS-2$
+ return new R_OSGiRemoteServiceContainer(remoteOsGiService, containerID);
+ } else if (parameters.length == 1 && parameters[0] instanceof ID) {
+ return new R_OSGiRemoteServiceContainer(remoteOsGiService, (ID) parameters[0]);
}
throw new ContainerCreateException("Unsupported arguments " //$NON-NLS-1$
+ Arrays.asList(parameters));
} catch (IDCreateException e) {
throw new ContainerCreateException(e);
+ } catch (UnknownHostException e) {
+ throw new ContainerCreateException(e);
}
}

Back to the top