Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2005-08-02 22:50:02 +0000
committerslewis2005-08-02 22:50:02 +0000
commitaae077b936fdd219414aca3ed992bcf23731b3d8 (patch)
treee0e69f17d4a8e000ff56efe7c2099f16fb536da5
parent5aff7438f52d53d0984243bc3214c72553e08d6d (diff)
downloadorg.eclipse.ecf-aae077b936fdd219414aca3ed992bcf23731b3d8.tar.gz
org.eclipse.ecf-aae077b936fdd219414aca3ed992bcf23731b3d8.tar.xz
org.eclipse.ecf-aae077b936fdd219414aca3ed992bcf23731b3d8.zip
Changes for support of new ContainerFactory
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/Client.java4
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java9
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatHandler.java4
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java6
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java4
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java5
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java6
-rw-r--r--framework/bundles/org.eclipse.ecf/plugin.xml1
-rw-r--r--framework/bundles/org.eclipse.ecf/schema/simpleContainerFactory.exsd225
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerDescription.java183
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java206
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerInstantiationException.java35
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerJoinException.java (renamed from framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerJoinException.java)12
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainer.java12
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainerFactory.java162
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IReliableContainer.java21
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContainer.java26
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContext.java2
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerInstantiationException.java4
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/provider/IContainerInstantiator.java20
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java70
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPClientSOContainer.java8
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPGroupChatSOContainer.java9
23 files changed, 971 insertions, 63 deletions
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 e66c35b91..9e2c1cbca 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
@@ -33,10 +33,10 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.ISharedObjectContainer;
import org.eclipse.ecf.core.ISharedObjectContainerListener;
import org.eclipse.ecf.core.SharedObjectContainerFactory;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.events.IContainerEvent;
import org.eclipse.ecf.core.events.ISharedObjectContainerDepartedEvent;
import org.eclipse.ecf.core.identity.ID;
@@ -325,7 +325,7 @@ public class Client {
try {
client.joinGroup(groupID, getJoinContext(username,data));
- } catch (SharedObjectContainerJoinException e) {
+ } catch (ContainerJoinException e) {
try {
EclipseCollabSharedObject so = newClient.getObject();
if (so != null) {
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
index 07eceb981..f599e192d 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
@@ -16,11 +16,12 @@ import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Date;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.ISharedObjectContext;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.SharedObjectDescription;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.security.IJoinContext;
@@ -439,10 +440,10 @@ public class EclipseCollabSharedObject extends GenericSharedObject implements
}
public void joinGroup(ID remote, IJoinContext data)
- throws SharedObjectContainerJoinException {
+ throws ContainerJoinException {
ISharedObjectContext crs = getContext();
if (crs == null) {
- throw new SharedObjectContainerJoinException(
+ throw new ContainerJoinException(
"Cannot join remote space " + remote
+ ". Have no local space access capability.");
} else {
@@ -461,7 +462,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject implements
}
// Success
} else {
- throw new SharedObjectContainerJoinException(
+ throw new ContainerJoinException(
"Invalid remote space ID " + remote);
}
}
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatHandler.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatHandler.java
index 729e124a7..145448a2e 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatHandler.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/ui/LineChatHandler.java
@@ -13,7 +13,7 @@ package org.eclipse.ecf.example.collab.ui;
import java.util.Map;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.security.IJoinContext;
import org.eclipse.ecf.example.collab.share.User;
@@ -38,7 +38,7 @@ public interface LineChatHandler {
public Object getObject(ID target);
public void joinGroup(ID remote, IJoinContext joinContext)
- throws SharedObjectContainerJoinException;
+ throws ContainerJoinException;
public void leaveGroup();
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java
index 33ab6b2d8..2d0984cce 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java
@@ -17,8 +17,8 @@ import java.net.ConnectException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.ISharedObjectContainerConfig;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.SharedObjectDescription;
import org.eclipse.ecf.core.comm.AsynchConnectionEvent;
import org.eclipse.ecf.core.comm.ConnectionInstantiationException;
@@ -102,7 +102,7 @@ public abstract class ClientSOContainer extends SOContainer {
}
public void joinGroup(ID remote, IJoinContext joinContext)
- throws SharedObjectContainerJoinException {
+ throws ContainerJoinException {
// first notify synchonously
fireContainerEvent(new SharedObjectContainerJoinGroupEvent(
this.getID(), remote, joinContext));
@@ -192,7 +192,7 @@ public abstract class ClientSOContainer extends SOContainer {
}
} catch (Exception e) {
dumpStack("Exception in joinGroup", e);
- SharedObjectContainerJoinException except = new SharedObjectContainerJoinException(
+ ContainerJoinException except = new ContainerJoinException(
"joinGroup exception in container " + getID() + " joining "
+ remote + ": " + e.getClass().getName() + ": "
+ e.getMessage());
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java
index 3e32ab180..ccf089dd7 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.IOSGIService;
import org.eclipse.ecf.core.ISharedObject;
import org.eclipse.ecf.core.ISharedObjectConfig;
@@ -31,7 +32,6 @@ import org.eclipse.ecf.core.ISharedObjectContainerListener;
import org.eclipse.ecf.core.ISharedObjectContainerTransaction;
import org.eclipse.ecf.core.ISharedObjectManager;
import org.eclipse.ecf.core.SharedObjectAddException;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.SharedObjectDescription;
import org.eclipse.ecf.core.SharedObjectInitException;
import org.eclipse.ecf.core.comm.AsynchConnectionEvent;
@@ -810,7 +810,7 @@ public abstract class SOContainer implements ISharedObjectContainer {
* org.eclipse.ecf.core.security.IJoinContext)
*/
public abstract void joinGroup(ID groupID, IJoinContext joinContext)
- throws SharedObjectContainerJoinException;
+ throws ContainerJoinException;
protected void killConnection(IConnection conn) {
debug("killconnection");
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java
index 4aaa92c5c..9ae5f3a3f 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java
@@ -17,10 +17,11 @@ package org.eclipse.ecf.provider.generic;
import java.io.IOException;
import java.util.Map;
+
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.IOSGIService;
import org.eclipse.ecf.core.ISharedObjectContext;
import org.eclipse.ecf.core.ISharedObjectManager;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.SharedObjectDescription;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.security.IJoinContext;
@@ -112,7 +113,7 @@ public class SOContext implements ISharedObjectContext {
* org.eclipse.ecf.core.security.IJoinContext)
*/
public synchronized void joinGroup(ID groupID, IJoinContext joinContext)
- throws SharedObjectContainerJoinException {
+ throws ContainerJoinException {
if (isInactive()) {
trace("joinGroup("+groupID+") CONTEXT INACTIVE");
return;
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java
index 031329a7a..c6c82b43a 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java
@@ -18,9 +18,9 @@ import java.net.ConnectException;
import java.net.Socket;
import java.net.SocketAddress;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.ISharedObjectContainerConfig;
import org.eclipse.ecf.core.ISharedObjectContainerGroupManager;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.comm.IAsynchConnection;
import org.eclipse.ecf.core.comm.ISynchAsynchConnection;
import org.eclipse.ecf.core.comm.ISynchConnection;
@@ -264,8 +264,8 @@ public class ServerSOContainer extends SOContainer implements ISharedObjectConta
super.dispose(timeout);
}
- public void joinGroup(ID groupID, IJoinContext joinContext) throws SharedObjectContainerJoinException {
- SharedObjectContainerJoinException e = new SharedObjectContainerJoinException(
+ public void joinGroup(ID groupID, IJoinContext joinContext) throws ContainerJoinException {
+ ContainerJoinException e = new ContainerJoinException(
"ServerApplication cannot join group " + groupID.getName());
throw e;
}
diff --git a/framework/bundles/org.eclipse.ecf/plugin.xml b/framework/bundles/org.eclipse.ecf/plugin.xml
index 68c62c982..8689f48dd 100644
--- a/framework/bundles/org.eclipse.ecf/plugin.xml
+++ b/framework/bundles/org.eclipse.ecf/plugin.xml
@@ -4,4 +4,5 @@
<extension-point id="containerFactory" name="ECF Container Factory" schema="schema/containerFactory.exsd"/>
<extension-point id="namespace" name="ECF Namespace" schema="schema/namespace.exsd"/>
<extension-point id="connectionFactory" name="connectionFactory" schema="schema/connectionFactory.exsd"/>
+ <extension-point id="simpleContainer" name="ECF Simple Container Factory" schema="schema/simpleContainerFactory.exsd"/>
</plugin>
diff --git a/framework/bundles/org.eclipse.ecf/schema/simpleContainerFactory.exsd b/framework/bundles/org.eclipse.ecf/schema/simpleContainerFactory.exsd
new file mode 100644
index 000000000..1e8b34a3c
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/schema/simpleContainerFactory.exsd
@@ -0,0 +1,225 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.ecf">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.ecf" id="simpleContainerFactory" name="ECF Simple Container Factory"/>
+ </appInfo>
+ <documentation>
+ This extension allows plugins to register themselves as &apos;providers&apos; of ECF shared object containers. Once registered via this extension point, plugins can then provide there own implementations of ISharedObjectContainer in response to client request of the ECF container factory (&lt;b&gt;org.eclipse.ecf.core.SharedObjectContainerFactory&lt;/b&gt;).
+&lt;p&gt;Plugins using this extension point can define a new implementation of any desired communications protocol, and expose that protocol as an instance of an &lt;b&gt;ISharedObjectContainer&lt;/b&gt;. When client requests are made to ECF SharedObjectContainerFactory to create &lt;b&gt;ISharedObjectContainer&lt;/b&gt; instances, those requests will be re-directed to the given ISharedObjectContainer implementer.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="simpleContainerFactory" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="simpleContainerFactory">
+ <annotation>
+ <documentation>
+ The container factory extension point. Can optionally contain a list of &apos;defaultargument&apos; elements that describe the arguments (and provide default values) to be passed to provider implementation
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="defaultargument" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="property" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing the containerFactory extension point. The given class must implement the &lt;b&gt;org.eclipse.ecf.core.provider.IContainerInstantiator&lt;/b&gt; interface
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ An optional name for the extension. If no name is explicitly provided by the extension, the containerFactory class name is used as the name. Note that this name must &lt;b&gt;not&lt;/b&gt; conflict with any other name in the ECF SharedFactory in order to be successfully registered. Care should therefore be taken in selection of a name such that it does not conflict with other pre-existing names for this factory implementations
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ An optional description of the implementation of this extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="defaultargument">
+ <annotation>
+ <documentation>
+ Default argument to be passed to &lt;b&gt;org.eclipse.ecf.core.provider.makeInstance()&lt;/b&gt; method. Value of this element (if any) is used to indicate a default value for the given argument
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>
+ The fully qualified type of the default argument
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string">
+ <annotation>
+ <documentation>
+ The value for the default argument
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ An optional name for the defaultargument element
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="property">
+ <annotation>
+ <documentation>
+ Property (name,value) associated with SharedDescription
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name of the property
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ The value of the property
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.0.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ Here&apos;s an extension that associates a class org.eclipse.ecf.test.FooContainerFactory with name &apos;foo&apos; in the ECF &lt;b&gt;SharedObjectContainerFactory&lt;/b&gt;:
+
+&lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.ecf.simpleContainerFactory&quot;&gt;
+ &lt;simpleContainerFactory name=&quot;foo&quot; class=&quot;org.eclipse.ecf.test.FooContainerFactory&quot; description=&quot;My container factory&quot;/&gt;
+ &lt;defaultargument type=&quot;java.lang.String&quot; value=&quot;defaultvalue&quot; name=&quot;variablename&quot;/&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+
+Here is some example code to implement this class:
+
+&lt;pre&gt;
+package org.eclipse.ecf.test;
+
+import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.ContainerInstantiationException;
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
+
+public class FooContainerFactory implements IContainerInstantiator {
+
+ public FooContainerFactory() {
+ super();
+ }
+ public IContainer makeInstance(ContainterDescription description, Class[] argTypes, Object[] args)
+ throws ContainerInstantiationException {
+ // Create/return instance of FooContainer
+ // Note that FooContainer class must
+ // implement IContainer
+ return new FooContainer();
+ }
+}
+&lt;/pre&gt;
+
+In this example, the given class implements the &lt;b&gt;IContainerInstantiator&lt;/b&gt;.makeInstance method by creating and returning a new instance of FooSharedObjectContainer, a class also defined in the extension plugin. As noted in the code, this class must implement &lt;b&gt;ISharedObjectContainer&lt;/b&gt;, so that it can successfully be returned from makeInstance.
+
+&lt;h3&gt;Example Usage of Container by Clients&lt;/h3&gt;
+
+Clients that wish to use the &apos;foo&apos; container implementation can do so simply by making the following call to create an &lt;b&gt;IContainer&lt;/b&gt;:
+
+&lt;pre&gt;
+IContainer newContainer = ContainerFactory.makeContainer(&apos;foo&apos;);
+// Further use of newContainer instance here
+
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ The API for this extension point is provided by the &lt;b&gt;org.eclipse.ecf.core.ContainerFactory&lt;/b&gt; static methods. Specifically, the &apos;makeSharedObjectContainer&apos; static methods are to be used by clients. The functionality provided by the extension point mechanism can be used at runtime via the &lt;b&gt;SharedObjectContainerFactory.addDescription(SharedObjectContainerDescription)&lt;/b&gt; method.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ The supplied implementations of this extension point are:
+
+org.eclipse.ecf.provider.generic.ContainerInstantiator
+&lt;b&gt;TEST&lt;/b&gt;: org.eclipse.ecf.test.TestContainer
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2004 Composent, Inc. and others.
+All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: Composent, Inc. - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerDescription.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerDescription.java
new file mode 100644
index 000000000..723bc0d9e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerDescription.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.core;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
+
+/**
+ * Description of an ISharedObjectContainer factory implementation.
+ *
+ * @see SharedObjectContainerFactory#addDescription(ContainerDescription)
+ *
+ */
+public class ContainerDescription {
+ protected String name;
+ protected String instantiatorClass;
+ protected ClassLoader classLoader;
+ protected IContainerInstantiator instantiator;
+ protected String description;
+ protected String[] argTypes;
+ protected String[] argDefaults;
+ protected String[] argNames;
+ protected int hashCode = 0;
+ protected static final String[] EMPTY = new String[0];
+ protected Map properties;
+
+ public ContainerDescription(ClassLoader loader, String name,
+ String instantiatorClass, String desc) {
+ this(loader, name, instantiatorClass, desc, EMPTY,
+ EMPTY, EMPTY);
+ }
+
+ public ContainerDescription(String name,
+ String instantiatorClass, String desc) {
+ this(null, name, instantiatorClass, desc);
+ }
+
+ public ContainerDescription(ClassLoader loader, String name,
+ String instantiatorClass, String desc, String[] argTypes,
+ String[] argDefaults, String[] argNames) {
+ this(loader,name,instantiatorClass,desc,argTypes,argDefaults,argNames,new Properties());
+ }
+
+ public ContainerDescription(ClassLoader loader, String name,
+ String instantiatorClass, String desc, String[] argTypes,
+ String[] argDefaults, String[] argNames, Map props) {
+ this.classLoader = loader;
+ if (name == null)
+ throw new RuntimeException(
+ new InstantiationException(
+ "SharedObjectContainerDescription<init> name cannot be null"));
+ this.name = name;
+ if (instantiatorClass == null)
+ throw new RuntimeException(
+ new InstantiationException(
+ "SharedObjectContainerDescription<init> instantiatorClass cannot be null"));
+ this.instantiatorClass = instantiatorClass;
+ this.hashCode = name.hashCode();
+ this.description = desc;
+ this.argTypes = argTypes;
+ this.argDefaults = argDefaults;
+ this.argNames = argNames;
+ this.properties = props;
+ }
+
+ public ContainerDescription(String name,
+ IContainerInstantiator inst, String desc,
+ String[] argTypes, String[] argDefaults, String[] argNames) {
+ this(name,inst,desc,argTypes,argDefaults,argNames,new Properties());
+ }
+
+ public ContainerDescription(String name,
+ IContainerInstantiator inst, String desc,
+ String[] argTypes, String[] argDefaults, String[] argNames, Map props) {
+ if (name == null)
+ throw new RuntimeException(
+ new InstantiationException(
+ "SharedObjectContainerDescription<init> name cannot be null"));
+ if (inst == null)
+ throw new RuntimeException(
+ new InstantiationException(
+ "SharedObjectContainerDescription<init> instantiator instance cannot be null"));
+ this.instantiator = inst;
+ this.name = name;
+ this.classLoader = this.instantiator.getClass().getClassLoader();
+ this.description = desc;
+ this.argTypes = argTypes;
+ this.argDefaults = argDefaults;
+ this.argNames = argNames;
+ this.properties = props;
+ }
+
+ public ContainerDescription(String name,
+ IContainerInstantiator inst, String desc) {
+ this(name, inst, desc, EMPTY, EMPTY, EMPTY);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public boolean equals(Object other) {
+ if (!(other instanceof ContainerDescription))
+ return false;
+ ContainerDescription scd = (ContainerDescription) other;
+ return scd.name.equals(name);
+ }
+
+ public int hashCode() {
+ return hashCode;
+ }
+
+ public String toString() {
+ StringBuffer b = new StringBuffer("SharedObjectContainerDescription[");
+ b.append("name:").append(name).append(";");
+ if (instantiator == null)
+ b.append("class:").append(instantiatorClass).append(";");
+ else
+ b.append("instantiator:").append(instantiator).append(";");
+ b.append("desc:").append(description).append(";");
+ b.append("argtypes:").append(Arrays.asList(argTypes)).append(";");
+ b.append("argdefaults:").append(Arrays.asList(argDefaults)).append(";");
+ b.append("argnames:").append(Arrays.asList(argNames)).append("]");
+ return b.toString();
+ }
+
+ protected IContainerInstantiator getInstantiator()
+ throws ClassNotFoundException, InstantiationException,
+ IllegalAccessException {
+ synchronized (this) {
+ if (instantiator == null)
+ initializeInstantiator(classLoader);
+ return instantiator;
+ }
+ }
+
+ private void initializeInstantiator(ClassLoader cl)
+ throws ClassNotFoundException, InstantiationException,
+ IllegalAccessException {
+ if (cl == null)
+ cl = this.getClass().getClassLoader();
+ // Load instantiator class
+ Class clazz = Class.forName(instantiatorClass, true, cl);
+ // Make new instance
+ instantiator = (IContainerInstantiator) clazz.newInstance();
+ }
+
+ /**
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ public String[] getArgDefaults() {
+ return argDefaults;
+ }
+
+ public String[] getArgTypes() {
+ return argTypes;
+ }
+
+ public String[] getArgNames() {
+ return argNames;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java
new file mode 100644
index 000000000..9607757b9
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ecf.core;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
+import org.eclipse.ecf.core.util.AbstractFactory;
+import org.eclipse.ecf.internal.core.Trace;
+
+/**
+ * Factory for creating {@link IContainer} instances. This
+ * class provides ECF clients an entry point to constructing {@link IContainer}
+ * instances.
+ * <br>
+ * <br>
+ * Here is an example use of the ContainerFactory to construct an instance
+ * of the 'standalone' container (has no connection to other containers):
+ * <br><br>
+ * <code>
+ * IContainer container = <br>
+ * ContainerFactory.getDefault().makeContainer('standalone');
+ * <br><br>
+ * ...further use of container variable here...
+ * </code>
+ *
+ */
+public class ContainerFactory implements IContainerFactory {
+
+ private static Trace debug = Trace.create("simplecontainerfactory");
+
+ private static Hashtable containerdescriptions = new Hashtable();
+ protected static IContainerFactory instance = null;
+
+ static {
+ instance = new ContainerFactory();
+ }
+ protected ContainerFactory() {
+ }
+ public static IContainerFactory getDefault() {
+ return instance;
+ }
+ private static void trace(String msg) {
+ if (Trace.ON && debug != null) {
+ debug.msg(msg);
+ }
+ }
+
+ private static void dumpStack(String msg, Throwable e) {
+ if (Trace.ON && debug != null) {
+ debug.dumpStack(e, msg);
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#addDescription(org.eclipse.ecf.core.ContainerDescription)
+ */
+ public ContainerDescription addDescription(
+ ContainerDescription scd) {
+ trace("addDescription("+scd+")");
+ return addDescription0(scd);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#getDescriptions()
+ */
+ public List getDescriptions() {
+ return getDescriptions0();
+ }
+ protected List getDescriptions0() {
+ return new ArrayList(containerdescriptions.values());
+ }
+ protected ContainerDescription addDescription0(
+ ContainerDescription n) {
+ if (n == null)
+ return null;
+ return (ContainerDescription) containerdescriptions.put(n
+ .getName(), n);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#containsDescription(org.eclipse.ecf.core.ContainerDescription)
+ */
+ public boolean containsDescription(
+ ContainerDescription scd) {
+ return containsDescription0(scd);
+ }
+ protected boolean containsDescription0(
+ ContainerDescription scd) {
+ if (scd == null)
+ return false;
+ return containerdescriptions.containsKey(scd.getName());
+ }
+ protected ContainerDescription getDescription0(
+ ContainerDescription scd) {
+ if (scd == null)
+ return null;
+ return (ContainerDescription) containerdescriptions.get(scd
+ .getName());
+ }
+ protected ContainerDescription getDescription0(
+ String name) {
+ if (name == null)
+ return null;
+ return (ContainerDescription) containerdescriptions.get(name);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.ISharedObjectContainerFactory#getDescriptionByName(java.lang.String)
+ */
+ public ContainerDescription getDescriptionByName(
+ String name) throws ContainerInstantiationException {
+ trace("getDescriptionByName("+name+")");
+ ContainerDescription res = getDescription0(name);
+ if (res == null) {
+ throw new ContainerInstantiationException(
+ "ContainerDescription named '" + name
+ + "' not found");
+ }
+ return res;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#makeContainer(org.eclipse.ecf.core.ContainerDescription, java.lang.String[], java.lang.Object[])
+ */
+ public IContainer makeContainer(
+ ContainerDescription desc, String[] argTypes,
+ Object[] args) throws ContainerInstantiationException {
+ trace("makeContainer("+desc+","+Trace.convertStringAToString(argTypes)+","+Trace.convertObjectAToString(args)+")");
+ if (desc == null)
+ throw new ContainerInstantiationException(
+ "ContainerDescription cannot be null");
+ ContainerDescription cd = getDescription0(desc);
+ if (cd == null)
+ throw new ContainerInstantiationException(
+ "ContainerDescription named '" + desc.getName()
+ + "' not found");
+ Class clazzes[] = null;
+ IContainerInstantiator instantiator = null;
+ try {
+ instantiator = (IContainerInstantiator) cd
+ .getInstantiator();
+ clazzes = AbstractFactory.getClassesForTypes(argTypes, args, cd.getClassLoader());
+ } catch (Exception e) {
+ ContainerInstantiationException newexcept = new ContainerInstantiationException(
+ "makeContainer exception with description: "+desc+": "+e.getClass().getName()+": "+e.getMessage());
+ newexcept.setStackTrace(e.getStackTrace());
+ dumpStack("Exception in makeContainer",newexcept);
+ throw newexcept;
+ }
+ if (instantiator == null)
+ throw new ContainerInstantiationException(
+ "Instantiator for ContainerDescription "
+ + cd.getName() + " is null");
+ // Ask instantiator to actually create instance
+ return (IContainer) instantiator
+ .makeInstance(desc,clazzes, args);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#makeContainer(java.lang.String)
+ */
+ public IContainer makeContainer(
+ String descriptionName)
+ throws ContainerInstantiationException {
+ return makeContainer(
+ getDescriptionByName(descriptionName), null, null);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#makeContainer(java.lang.String, java.lang.Object[])
+ */
+ public IContainer makeContainer(
+ String descriptionName, Object[] args)
+ throws ContainerInstantiationException {
+ return makeContainer(
+ getDescriptionByName(descriptionName), null, args);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#makeContainer(java.lang.String, java.lang.String[], java.lang.Object[])
+ */
+ public IContainer makeContainer(
+ String descriptionName, String[] argsTypes, Object[] args)
+ throws ContainerInstantiationException {
+ return makeContainer(
+ getDescriptionByName(descriptionName), argsTypes, args);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#removeDescription(org.eclipse.ecf.core.ContainerDescription)
+ */
+ public ContainerDescription removeDescription(
+ ContainerDescription scd) {
+ trace("removeDescription("+scd+")");
+ return removeDescription0(scd);
+ }
+ protected ContainerDescription removeDescription0(
+ ContainerDescription n) {
+ if (n == null)
+ return null;
+ return (ContainerDescription) containerdescriptions.remove(n
+ .getName());
+ }
+
+} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerInstantiationException.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerInstantiationException.java
new file mode 100644
index 000000000..58d14aee3
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerInstantiationException.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ecf.core;
+
+import org.eclipse.ecf.core.util.ECFException;
+
+public class ContainerInstantiationException extends ECFException {
+
+ private static final long serialVersionUID = -6979687717421003065L;
+
+ public ContainerInstantiationException() {
+ super();
+ }
+
+ public ContainerInstantiationException(String message) {
+ super(message);
+ }
+
+ public ContainerInstantiationException(Throwable cause) {
+ super(cause);
+ }
+
+ public ContainerInstantiationException(String message,
+ Throwable cause) {
+ super(message, cause);
+ }
+
+} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerJoinException.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerJoinException.java
index d619a8cdf..d3bdae2f6 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerJoinException.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerJoinException.java
@@ -11,25 +11,25 @@ package org.eclipse.ecf.core;
import org.eclipse.ecf.core.util.ECFException;
-public class SharedObjectContainerJoinException extends ECFException {
+public class ContainerJoinException extends ECFException {
- private static final long serialVersionUID = 3834874676269561909L;
+ private static final long serialVersionUID = 4078658849424746859L;
- public SharedObjectContainerJoinException() {
+ public ContainerJoinException() {
super();
}
/**
* @param message
*/
- public SharedObjectContainerJoinException(String message) {
+ public ContainerJoinException(String message) {
super(message);
}
/**
* @param cause
*/
- public SharedObjectContainerJoinException(Throwable cause) {
+ public ContainerJoinException(Throwable cause) {
super(cause);
}
@@ -37,7 +37,7 @@ public class SharedObjectContainerJoinException extends ECFException {
* @param message
* @param cause
*/
- public SharedObjectContainerJoinException(String message, Throwable cause) {
+ public ContainerJoinException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainer.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainer.java
index 31ab5555a..9a053d60f 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainer.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainer.java
@@ -23,12 +23,20 @@ public interface IContainer extends IAdaptable {
* @param joinContext
* any required context to allow this container to authenticate
* on join with remote containers
- * @exception SharedObjectContainerJoinException
+ * @exception ContainerJoinException
* thrown if communication cannot be established with remote
* service
*/
public void joinGroup(ID groupID, IJoinContext joinContext)
- throws SharedObjectContainerJoinException;
+ throws ContainerJoinException;
+
+ /**
+ * Get the group id that this container has joined. Return null if no group
+ * has previously been joined.
+ *
+ * @return ID of the group previously joined
+ */
+ public ID getGroupID();
/**
* Leave a container group. This operation will disconnect the local
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainerFactory.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainerFactory.java
new file mode 100644
index 000000000..649faf4a2
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IContainerFactory.java
@@ -0,0 +1,162 @@
+package org.eclipse.ecf.core;
+
+import java.util.List;
+
+public interface IContainerFactory {
+
+ /*
+ * Add a ContainerDescription to the set of known
+ * SharedObjectContainerDescriptions.
+ *
+ * @param scd the ContainerDescription to add to this factory
+ * @return ContainerDescription the old description of the same
+ * name, null if none found
+ */
+ public ContainerDescription addDescription(
+ ContainerDescription scd);
+
+ /**
+ * Get a collection of the ContainerDescriptions currently known to
+ * this factory. This allows clients to query the factory to determine what if
+ * any other ContainerDescriptions are currently registered with
+ * the factory, and if so, what they are.
+ *
+ * @return List of ContainerDescription instances
+ */
+ public List getDescriptions();
+
+ /**
+ * Check to see if a given named description is already contained by this
+ * factory
+ *
+ * @param scd
+ * the ContainerDescription to look for
+ * @return true if description is already known to factory, false otherwise
+ */
+ public boolean containsDescription(ContainerDescription scd);
+
+ /**
+ * Get the known ContainerDescription given it's name.
+ *
+ * @param name
+ * @return ContainerDescription found
+ * @throws ContainerInstantiationException
+ */
+ public ContainerDescription getDescriptionByName(String name)
+ throws ContainerInstantiationException;
+
+ /**
+ * Make IContainer instance. Given a
+ * ContainerDescription object, a String [] of argument types,
+ * and an Object [] of parameters, this method will
+ * <p>
+ * <ul>
+ * <li>lookup the known ContainerDescriptions to find one of
+ * matching name</li>
+ * <li>if found, will retrieve or create an
+ * IContainerInstantiator for that description</li>
+ * <li>Call the IContainerInstantiator.makeInstance method to
+ * return an instance of IContainer</li>
+ * </ul>
+ *
+ * @param desc
+ * the ContainerDescription to use to create the
+ * instance
+ * @param argTypes
+ * a String [] defining the types of the args parameter
+ * @param args
+ * an Object [] of arguments passed to the makeInstance method of
+ * the IContainerInstantiator
+ * @return a valid instance of IContainer
+ * @throws ContainerInstantiationException
+ */
+ public IContainer makeContainer(
+ ContainerDescription desc, String[] argTypes,
+ Object[] args) throws ContainerInstantiationException;
+
+ /**
+ * Make IContainer instance. Given a
+ * ContainerDescription name, this method will
+ * <p>
+ * <ul>
+ * <li>lookup the known ContainerDescriptions to find one of
+ * matching name</li>
+ * <li>if found, will retrieve or create an
+ * IContainerInstantiator for that description</li>
+ * <li>Call the IContainerInstantiator.makeInstance method to
+ * return an instance of IContainer</li>
+ * </ul>
+ *
+ * @param descriptionName
+ * the ContainerDescription name to lookup
+ * @return a valid instance of IContainer
+ * @throws ContainerInstantiationException
+ */
+ public IContainer makeContainer(
+ String descriptionName)
+ throws ContainerInstantiationException;
+
+ /**
+ * Make IContainer instance. Given a
+ * ContainerDescription name, this method will
+ * <p>
+ * <ul>
+ * <li>lookup the known ContainerDescriptions to find one of
+ * matching name</li>
+ * <li>if found, will retrieve or create an
+ * IContainerInstantiator for that description</li>
+ * <li>Call the IContainerInstantiator.makeInstance method to
+ * return an instance of IContainer</li>
+ * </ul>
+ *
+ * @param descriptionName
+ * the ContainerDescription name to lookup
+ * @param args
+ * the Object [] of arguments passed to the
+ * IContainerInstantiator.makeInstance method
+ * @return a valid instance of IContainer
+ * @throws ContainerInstantiationException
+ */
+ public IContainer makeContainer(
+ String descriptionName, Object[] args)
+ throws ContainerInstantiationException;
+
+ /**
+ * Make IContainer instance. Given a
+ * ContainerDescription name, this method will
+ * <p>
+ * <ul>
+ * <li>lookup the known ContainerDescriptions to find one of
+ * matching name</li>
+ * <li>if found, will retrieve or create an
+ * IContainerInstantiator for that description</li>
+ * <li>Call the IContainerInstantiator.makeInstance method to
+ * return an instance of IContainer</li>
+ * </ul>
+ *
+ * @param descriptionName
+ * the ContainerDescription name to lookup
+ * @param argsTypes
+ * the String [] of argument types of the following args
+ * @param args
+ * the Object [] of arguments passed to the
+ * IContainerInstantiator.makeInstance method
+ * @return a valid instance of IContainer
+ * @throws ContainerInstantiationException
+ */
+ public IContainer makeContainer(
+ String descriptionName, String[] argsTypes, Object[] args)
+ throws ContainerInstantiationException;
+
+ /**
+ * Remove given description from set known to this factory.
+ *
+ * @param scd
+ * the ContainerDescription to remove
+ * @return the removed ContainerDescription, null if nothing
+ * removed
+ */
+ public ContainerDescription removeDescription(
+ ContainerDescription scd);
+
+} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IReliableContainer.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IReliableContainer.java
new file mode 100644
index 000000000..adc8efd8e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/IReliableContainer.java
@@ -0,0 +1,21 @@
+package org.eclipse.ecf.core;
+
+import org.eclipse.ecf.core.identity.ID;
+
+public interface IReliableContainer extends IContainer {
+
+ /**
+ * Get the current membership of the joined group. This method will
+ * accurately report the current group membership of the connected group.
+ *
+ * @return ID[] the IDs of the current group membership
+ */
+ public ID[] getGroupMemberIDs();
+
+ /**
+ * @return true if this ISharedObjectContainer instance is in the 'manager'
+ * role for the group, false otherwise
+ */
+ public boolean isGroupManager();
+
+}
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContainer.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContainer.java
index 8713fecea..33661b9ad 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContainer.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContainer.java
@@ -9,13 +9,11 @@
package org.eclipse.ecf.core;
-import org.eclipse.ecf.core.identity.ID;
-
/**
* Core interface that must be implemented by all ECF container instances.
* Instances are typically created via {@link SharedObjectContainerFactory}
*/
-public interface ISharedObjectContainer extends IContainer {
+public interface ISharedObjectContainer extends IReliableContainer {
/**
* Return the ISharedObjectContainerConfig for this ISharedObjectContainer.
@@ -46,28 +44,6 @@ public interface ISharedObjectContainer extends IContainer {
public void removeListener(ISharedObjectContainerListener l);
/**
- * Get the group id that this container has joined. Return null if no group
- * has previously been joined.
- *
- * @return ID of the group previously joined
- */
- public ID getGroupID();
-
- /**
- * Get the current membership of the joined group. This method will
- * accurately report the current group membership of the connected group.
- *
- * @return ID[] the IDs of the current group membership
- */
- public ID[] getGroupMemberIDs();
-
- /**
- * @return true if this ISharedObjectContainer instance is in the 'manager'
- * role for the group, false otherwise
- */
- public boolean isGroupManager();
-
- /**
* Get SharedObjectManager for this container
*
* @return ISharedObjectManager for this container instance
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContext.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContext.java
index 15f406eb8..d7a853e56 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContext.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ISharedObjectContext.java
@@ -63,7 +63,7 @@ public interface ISharedObjectContext extends IAdaptable {
* @see org.eclipse.ecf.core.ISharedObjectContainer#joinGroup()
*/
public void joinGroup(ID groupID, IJoinContext joinContext)
- throws SharedObjectContainerJoinException;
+ throws ContainerJoinException;
/**
* (non-Javadoc)
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerInstantiationException.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerInstantiationException.java
index f1fc5e7ea..e4518bf67 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerInstantiationException.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerInstantiationException.java
@@ -9,9 +9,7 @@
package org.eclipse.ecf.core;
-import org.eclipse.ecf.core.util.ECFException;
-
-public class SharedObjectContainerInstantiationException extends ECFException {
+public class SharedObjectContainerInstantiationException extends ContainerInstantiationException {
private static final long serialVersionUID = 3257283617356265781L;
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/provider/IContainerInstantiator.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/provider/IContainerInstantiator.java
new file mode 100644
index 000000000..973438251
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/provider/IContainerInstantiator.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ecf.core.provider;
+
+import org.eclipse.ecf.core.ContainerDescription;
+import org.eclipse.ecf.core.ContainerInstantiationException;
+import org.eclipse.ecf.core.IContainer;
+
+public interface IContainerInstantiator {
+
+ public IContainer makeInstance(ContainerDescription description, Class[] argTypes, Object[] args)
+ throws ContainerInstantiationException;
+} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
index 417e17a66..f62301fbc 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
@@ -23,6 +23,9 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.core.ContainerDescription;
+import org.eclipse.ecf.core.ContainerFactory;
+import org.eclipse.ecf.core.IContainerFactory;
import org.eclipse.ecf.core.ISharedObjectContainerFactory;
import org.eclipse.ecf.core.SharedObjectContainerDescription;
import org.eclipse.ecf.core.SharedObjectContainerFactory;
@@ -32,6 +35,7 @@ import org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.identity.provider.IDInstantiator;
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
import org.eclipse.ecf.core.provider.ISharedObjectContainerInstantiator;
import org.osgi.framework.BundleContext;
@@ -46,6 +50,7 @@ public class ECFPlugin extends Plugin {
public static final String INSTANTIATOR_DATA_ATTRIBUTE = "description";
public static final String NAMESPACE_DEFAULT_CLASS = "org.eclipse.ecf.core.identity.Namespace";
public static final String CONTAINER_FACTORY_EPOINT = "org.eclipse.ecf.containerFactory";
+ public static final String SIMPLE_CONTAINER_FACTORY_EPOINT = "org.eclipse.ecf.simpleContainerFactory";
public static final String CONTAINER_FACTORY_EPOINT_CLASS_ATTRIBUTE = "class";
public static final String CONTAINER_FACTORY_EPOINT_NAME_ATTRIBUTE = "name";
public static final String CONTAINER_FACTORY_EPOINT_DESC_ATTRIBUTE = "description";
@@ -236,6 +241,71 @@ public class ECFPlugin extends Plugin {
}
}
+ protected void setupSimpleContainerExtensionPoint(BundleContext bc) {
+ String bundleName = getDefault().getBundle().getSymbolicName();
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = reg
+ .getExtensionPoint(SIMPLE_CONTAINER_FACTORY_EPOINT);
+ if (extensionPoint == null) {
+ return;
+ }
+ IConfigurationElement[] members = extensionPoint
+ .getConfigurationElements();
+ // For each configuration element
+ for (int m = 0; m < members.length; m++) {
+ IConfigurationElement member = members[m];
+ // Get the label of the extender plugin and the ID of the extension.
+ IExtension extension = member.getDeclaringExtension();
+ Object exten = null;
+ String name = null;
+ try {
+ // The only required attribute is "class"
+ exten = member
+ .createExecutableExtension(CONTAINER_FACTORY_EPOINT_CLASS_ATTRIBUTE);
+ String clazz = exten.getClass().getName();
+ // Get name and get version, if available
+ name = member
+ .getAttribute(CONTAINER_FACTORY_EPOINT_NAME_ATTRIBUTE);
+ if (name == null) {
+ name = clazz;
+ }
+ // Get description, if present
+ String description = member
+ .getAttribute(CONTAINER_FACTORY_EPOINT_DESC_ATTRIBUTE);
+ if (description == null) {
+ description = "";
+ }
+ // Get any arguments
+ DefaultArgs defaults = getDefaultArgs(member
+ .getChildren(ARG_ELEMENT_NAME));
+ // Get any property elements
+ Map properties = getProperties(member
+ .getChildren(PROPERTY_ELEMENT_NAME));
+ // Now make description instance
+ ContainerDescription scd = new ContainerDescription(
+ name, (IContainerInstantiator) exten,
+ description, defaults.getTypes(), defaults
+ .getDefaults(), defaults.getNames(), properties);
+ debug("setupContainerExtensionPoint:created description:" + scd);
+ IContainerFactory factory = ContainerFactory.getDefault();
+ if (factory.containsDescription(scd)) {
+ throw new CoreException(getStatusForContException(
+ extension, bundleName, name));
+ }
+ // Now add the description and we're ready to go.
+ factory.addDescription(scd);
+ debug("setupContainerExtensionPoint:added description to factory:"
+ + scd);
+ } catch (CoreException e) {
+ log(e.getStatus());
+ dumpStack("CoreException in setupContainerExtensionPoint", e);
+ } catch (Exception e) {
+ log(getStatusForContException(extension, bundleName, name));
+ dumpStack("Exception in setupContainerExtensionPoint", e);
+ }
+ }
+ }
+
protected void setupIdentityExtensionPoint(BundleContext context) {
String bundleName = getDefault().getBundle().getSymbolicName();
// Process extension points
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPClientSOContainer.java b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPClientSOContainer.java
index ddcd7a10f..52fbd0c97 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPClientSOContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPClientSOContainer.java
@@ -14,8 +14,8 @@ import java.util.Map;
import javax.security.auth.callback.Callback;
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.SharedObjectAddException;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.comm.AsynchConnectionEvent;
import org.eclipse.ecf.core.comm.ConnectionInstantiationException;
import org.eclipse.ecf.core.comm.ISynchAsynchConnection;
@@ -219,16 +219,16 @@ public class XMPPClientSOContainer extends ClientSOContainer {
}
public void joinGroup(ID remote, IJoinContext joinContext)
- throws SharedObjectContainerJoinException {
+ throws ContainerJoinException {
try {
addSharedObjectToContainer(remote);
super.joinGroup(remote, joinContext);
- } catch (SharedObjectContainerJoinException e) {
+ } catch (ContainerJoinException e) {
cleanUpConnectFail();
throw e;
} catch (SharedObjectAddException e1) {
cleanUpConnectFail();
- throw new SharedObjectContainerJoinException(
+ throw new ContainerJoinException(
"Exception adding shared object " + sharedObjectID, e1);
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPGroupChatSOContainer.java b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPGroupChatSOContainer.java
index 20a6dc96c..b925d603d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPGroupChatSOContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/container/XMPPGroupChatSOContainer.java
@@ -10,8 +10,9 @@ package org.eclipse.ecf.provider.xmpp.container;
import java.io.IOException;
import java.util.HashMap;
+
+import org.eclipse.ecf.core.ContainerJoinException;
import org.eclipse.ecf.core.SharedObjectAddException;
-import org.eclipse.ecf.core.SharedObjectContainerJoinException;
import org.eclipse.ecf.core.comm.AsynchConnectionEvent;
import org.eclipse.ecf.core.comm.ConnectionInstantiationException;
import org.eclipse.ecf.core.comm.ISynchAsynchConnection;
@@ -141,7 +142,7 @@ public class XMPPGroupChatSOContainer extends ClientSOContainer {
}
public void joinGroup(ID remote, Object data)
- throws SharedObjectContainerJoinException {
+ throws ContainerJoinException {
String nickname = "";
String password = "";
try {
@@ -152,12 +153,12 @@ public class XMPPGroupChatSOContainer extends ClientSOContainer {
multiuserchat.join(nickname,password);
} catch (XMPPException e) {
cleanUpConnectFail();
- SharedObjectContainerJoinException ce = new SharedObjectContainerJoinException("Exception joining with nickname "+nickname);
+ ContainerJoinException ce = new ContainerJoinException("Exception joining with nickname "+nickname);
ce.setStackTrace(e.getStackTrace());
throw ce;
} catch (SharedObjectAddException e1) {
cleanUpConnectFail();
- SharedObjectContainerJoinException ce = new SharedObjectContainerJoinException("Exception adding shared object " + sharedObjectID);
+ ContainerJoinException ce = new ContainerJoinException("Exception adding shared object " + sharedObjectID);
ce.setStackTrace(e1.getStackTrace());
throw ce;
}

Back to the top