Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2004-12-30 02:16:04 +0000
committerslewis2004-12-30 02:16:04 +0000
commiteb3e68909c683017264d237a446137a2e6ae8e31 (patch)
treef3e70e4a2a8839b2f603797377318265053a4043
parent9a003a258b18f5ca9d1bf2ec108722929a0ec78f (diff)
downloadorg.eclipse.ecf-eb3e68909c683017264d237a446137a2e6ae8e31.tar.gz
org.eclipse.ecf-eb3e68909c683017264d237a446137a2e6ae8e31.tar.xz
org.eclipse.ecf-eb3e68909c683017264d237a446137a2e6ae8e31.zip
Enhanced generic container instantiator
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ContainerInstantiator.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ContainerInstantiator.java
index 6759a236e..b39ab30c6 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ContainerInstantiator.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ContainerInstantiator.java
@@ -3,6 +3,7 @@ package org.eclipse.ecf.provider.generic;
import org.eclipse.ecf.core.ISharedObjectContainer;
import org.eclipse.ecf.core.SharedObjectContainerInstantiationException;
import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.provider.ISharedObjectContainerInstantiator;
public class ContainerInstantiator implements ISharedObjectContainerInstantiator {
@@ -14,10 +15,18 @@ public class ContainerInstantiator implements ISharedObjectContainerInstantiator
public ISharedObjectContainer makeInstance(Class[] argTypes, Object[] args)
throws SharedObjectContainerInstantiationException {
try {
- Boolean isClient = null;
+ Boolean isClient = new Boolean(true);
ID id = null;
- isClient = (Boolean) args[0];
- id = (ID) args[1];
+ if (args != null) {
+ if (args.length == 2) {
+ isClient = (Boolean) args[0];
+ id = (ID) args[1];
+ } else if (args.length == 1) {
+ id = (ID) args[0];
+ }
+ } else {
+ id = IDFactory.makeGUID();
+ }
ISharedObjectContainer result = null;
if (isClient.booleanValue()) {
return new TCPClientSOContainer(new SOContainerConfig(id));
@@ -25,7 +34,7 @@ public class ContainerInstantiator implements ISharedObjectContainerInstantiator
return new TCPServerSOContainer(new SOContainerConfig(id));
}
} catch (Exception e) {
- throw new SharedObjectContainerInstantiationException("Exception creating container",e);
+ throw new SharedObjectContainerInstantiationException("Exception creating generic container",e);
}
}

Back to the top