Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2006-10-26 01:28:57 +0000
committerslewis2006-10-26 01:28:57 +0000
commit8da73fda7073885c1e1fd6a35c771020fe13a3ea (patch)
treed67f474c88bfea789e83268f0a96bcb4e1b4ac97
parent3f37479c4553f8f23be27ef2e7e3559b2de74d03 (diff)
downloadorg.eclipse.ecf-8da73fda7073885c1e1fd6a35c771020fe13a3ea.tar.gz
org.eclipse.ecf-8da73fda7073885c1e1fd6a35c771020fe13a3ea.tar.xz
org.eclipse.ecf-8da73fda7073885c1e1fd6a35c771020fe13a3ea.zip
Removed connectionFactory extension point definition, schema, and supporting classes and code
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java1
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/plugin.xml12
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/app/ClientApplication.java7
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java32
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPClientSOContainer.java7
-rw-r--r--framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF1
-rw-r--r--framework/bundles/org.eclipse.ecf/plugin.xml1
-rw-r--r--framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd204
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionFactory.java209
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionTypeDescription.java155
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/provider/ISynchAsynchConnectionInstantiator.java44
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java155
12 files changed, 3 insertions, 825 deletions
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java
index 723dd284f..10891d224 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/Trace.java
@@ -136,6 +136,7 @@ public class Trace {
*
*/
public static boolean shouldTrace(Plugin plugin, String option) {
+ if (plugin == null) return false;
if (shouldTrace(plugin)) {
Boolean value = null;
diff --git a/framework/bundles/org.eclipse.ecf.provider/plugin.xml b/framework/bundles/org.eclipse.ecf.provider/plugin.xml
index 10ed0c70f..9aa6224a9 100644
--- a/framework/bundles/org.eclipse.ecf.provider/plugin.xml
+++ b/framework/bundles/org.eclipse.ecf.provider/plugin.xml
@@ -2,18 +2,6 @@
<?eclipse version="3.1"?>
<plugin>
<extension
- point="org.eclipse.ecf.connectionFactory">
- <connectionFactory
- class="org.eclipse.ecf.provider.comm.tcp.Client$Creator"
- description="TCP Client Connection Factory"
- name="org.eclipse.ecf.provider.comm.tcp.Client">
- <defaultargument
- value="30000"
- type="java.lang.Integer"
- name="keepAlive"/>
- </connectionFactory>
- </extension>
- <extension
point="org.eclipse.ecf.containerFactory">
<containerFactory
class="org.eclipse.ecf.provider.generic.ContainerInstantiator"
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/app/ClientApplication.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/app/ClientApplication.java
index 2f542526b..fded413a6 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/app/ClientApplication.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/app/ClientApplication.java
@@ -12,8 +12,6 @@ import java.util.HashMap;
import java.util.Random;
import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.ContainerFactory;
-import org.eclipse.ecf.core.comm.ConnectionTypeDescription;
-import org.eclipse.ecf.core.comm.ConnectionFactory;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.sharedobject.ISharedObject;
@@ -37,9 +35,6 @@ public class ClientApplication {
public static final int DEFAULT_TIMEOUT = TCPServerSOContainer.DEFAULT_KEEPALIVE;
- public static final String CONNECTION_NAME = org.eclipse.ecf.provider.comm.tcp.Client.class.getName();
- public static final String CONNECTION_CLASS = org.eclipse.ecf.provider.comm.tcp.Client.Creator.class.getName();
-
public static final String CONTAINER_FACTORY_NAME = ContainerInstantiator.class.getName();
public static final String CONTAINER_FACTORY_CLASS = CONTAINER_FACTORY_NAME;
@@ -74,8 +69,6 @@ public class ClientApplication {
}
}
// Setup factory descriptions since Eclipse does not do this for us
- ConnectionTypeDescription cd = new ConnectionTypeDescription(ClientApplication.class.getClassLoader(),CONNECTION_NAME,CONNECTION_CLASS,null);
- ConnectionFactory.getDefault().addDescription(cd);
contd = new ContainerTypeDescription(ClientApplication.class.getClassLoader(),CONTAINER_FACTORY_NAME,CONTAINER_FACTORY_CLASS,null);
ContainerFactory.getDefault().addDescription(contd);
for(int i=0; i < clientCount; i++) {
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
index 680119aac..821347fc8 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
@@ -27,49 +27,17 @@ import java.util.Random;
import java.util.Vector;
import org.eclipse.ecf.core.comm.AsynchEvent;
-import org.eclipse.ecf.core.comm.ConnectionCreateException;
-import org.eclipse.ecf.core.comm.ConnectionTypeDescription;
import org.eclipse.ecf.core.comm.DisconnectEvent;
import org.eclipse.ecf.core.comm.IConnectionListener;
import org.eclipse.ecf.core.comm.ISynchAsynchConnection;
import org.eclipse.ecf.core.comm.ISynchAsynchEventHandler;
import org.eclipse.ecf.core.comm.SynchEvent;
-import org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.util.SimpleQueueImpl;
import org.eclipse.ecf.provider.Trace;
public final class Client implements ISynchAsynchConnection {
- public static class Creator implements ISynchAsynchConnectionInstantiator {
- public ISynchAsynchConnection createInstance(
- ConnectionTypeDescription description,
- ISynchAsynchEventHandler handler, Class[] clazzes,
- Object[] args) throws ConnectionCreateException {
- try {
- String[] argVals = description.getArgDefaults();
- Integer ka = null;
- if (argVals != null && argVals.length > 0) {
- String val = argVals[0];
- if (val != null) {
- ka = new Integer(val);
- }
- }
- if (args != null && args.length > 0) {
- if (args[0] instanceof Integer) {
- ka = (Integer) args[0];
- } else if (args[0] instanceof String) {
- ka = new Integer((String) args[0]);
- }
- }
- return new Client(handler, ka);
- } catch (Exception e) {
- throw new ConnectionCreateException(
- "Exception in creating connection "
- + Client.class.getName(), e);
- }
- }
- }
public static final String PROTOCOL = "ecftcp";
protected static final Trace trace = Trace.create("connection");
public static final int DEFAULT_SNDR_PRIORITY = Thread.NORM_PRIORITY;
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPClientSOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPClientSOContainer.java
index 1ac73b202..23eb99a2a 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPClientSOContainer.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPClientSOContainer.java
@@ -11,12 +11,12 @@
package org.eclipse.ecf.provider.generic;
-import org.eclipse.ecf.core.comm.ConnectionFactory;
import org.eclipse.ecf.core.comm.ConnectionCreateException;
import org.eclipse.ecf.core.comm.ISynchAsynchConnection;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.sharedobject.ISharedObjectContainerConfig;
+import org.eclipse.ecf.provider.comm.tcp.Client;
public class TCPClientSOContainer extends ClientSOContainer {
int keepAlive = 0;
@@ -40,10 +40,7 @@ public class TCPClientSOContainer extends ClientSOContainer {
protected ISynchAsynchConnection createConnection(ID remoteSpace,
Object data) throws ConnectionCreateException {
debug("createClientConnection:" + remoteSpace + ":" + data);
- Object[] args = { new Integer(keepAlive) };
- ISynchAsynchConnection conn = null;
- conn = ConnectionFactory.getDefault().createSynchAsynchConnection(receiver,
- DEFAULT_COMM_NAME, args);
+ ISynchAsynchConnection conn = new Client(receiver,keepAlive);
return conn;
}
diff --git a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
index 1ce270440..d15556638 100644
--- a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
@@ -15,7 +15,6 @@ Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Export-Package: org.eclipse.ecf.core,
org.eclipse.ecf.core.comm,
- org.eclipse.ecf.core.comm.provider,
org.eclipse.ecf.core.events,
org.eclipse.ecf.core.provider,
org.eclipse.ecf.core.security,
diff --git a/framework/bundles/org.eclipse.ecf/plugin.xml b/framework/bundles/org.eclipse.ecf/plugin.xml
index dc2f69362..d26a47859 100644
--- a/framework/bundles/org.eclipse.ecf/plugin.xml
+++ b/framework/bundles/org.eclipse.ecf/plugin.xml
@@ -2,6 +2,5 @@
<?eclipse version="3.1"?>
<plugin>
<extension-point id="containerFactory" name="ECF Container Factory" schema="schema/containerFactory.exsd"/>
- <extension-point id="connectionFactory" name="ECF Connection Factory" schema="schema/connectionFactory.exsd"/>
<extension-point id="startup" name="ECF Start Up" schema="schema/startup.exsd"/>
</plugin>
diff --git a/framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd b/framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd
deleted file mode 100644
index c12feb4dd..000000000
--- a/framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd
+++ /dev/null
@@ -1,204 +0,0 @@
-<?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="connectionFactory" name="ECF Connection Factory"/>
- </appInfo>
- <documentation>
- This extension allows plugins to register themselves as &apos;providers&apos; of ECF connection factories. Once registered via this extension point, plugins can provide implementations of custom ISynchAsynchConnection instances via the ECF connection factory (&lt;b&gt;org.eclipse.ecf.core.comm.ConnectionFactory&lt;/b&gt;).
-&lt;p&gt;Plugins using this extension point can define new implementation classes of the core ISynchAsynchConnection interface. When client requests are made to ECF to create &lt;b&gt;ISynchAsynchConnection&lt;/b&gt; instances via the ConnectionFactory.createSynchAsynchConnection() methods, requests to create instances of the appropriate type will be re-directed to the given extension.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="connectionFactory"/>
- </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="connectionFactory">
- <annotation>
- <documentation>
- Connection factory definition
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="defaultargument"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- Required class that provides implementation of connection factory. The class must implement &lt;b&gt;org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator&lt;/b&gt;
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- Optional name for connection factory. If this name is not explicitly given, the class will be used for the name.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- An optional description for the connection factory.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="defaultargument">
- <annotation>
- <documentation>
- Default argument to be passed to createInstance method. Value of this element (if any) is used to provide a default value for the given argument
- </documentation>
- </annotation>
- <complexType>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- The fully qualified type of the 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
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 0.2.0
- </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.connectionFactory&quot;&gt;
- &lt;connectionFactory
- class=&quot;org.eclipse.ecf.provider.comm.tcp.Client$Creator&quot;
- description=&quot;TCP Client Connection Factory&quot;
- name=&quot;org.eclipse.ecf.provider.comm.tcp.Client&quot;&gt;
- &lt;defaultargument
- value=&quot;10000&quot;
- type=&quot;java.lang.Integer&quot;
- name=&quot;keepAlive&quot;/&gt;
- &lt;/connectionFactory&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-
-Here&apos;s an example implementation of this extension point:
-
-&lt;pre&gt;
- public ISynchAsynchConnection createInstance(ConnectionTypeDescription description,
- ISynchAsynchConnectionEventHandler handler, Class[] clazzes,
- Object[] args) throws ConnectionInstantiationException {
- try {
- String [] argVals = description.getArgDefaults();
- Integer ka = null;
- if (argVals != null &amp;&amp; argVals.length != 0) {
- String val = argVals[0];
- if (val != null) {
- ka = new Integer(val);
- }
- }
- if (args != null &amp;&amp; args.length != 0) {
- if (args[0] instanceof Integer) {
- ka = (Integer) args[0];
- } else if (args[0] instanceof String) {
- ka = new Integer((String) args[0]);
- }
- }
- return new Client(handler, ka);
- } catch (Exception e) {
- throw new ConnectionInstantiationException(
- &quot;Exception in creating connection &quot;
- + Client.class.getName(), e);
- }
- }
-&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.comm.ContainerFactory&lt;/b&gt; static methods. Specifically, the &apos;createSynchAsynchConnection&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;ConnectionFactory.addDescription(ConnectionTypeDescription)&lt;/b&gt; method. The available connection factories can be queried with the &lt;b&gt;ConnectionFactory.getDescriptions()&lt;/b&gt; method.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The supplied implementations of this extension point are:
-
-In org.eclipse.ecf.provider plugin:
-
-org.eclipse.ecf.provider.tcp.Client$Creator
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 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/comm/ConnectionFactory.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionFactory.java
deleted file mode 100644
index 10e8fc19c..000000000
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionFactory.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * 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.comm;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator;
-import org.eclipse.ecf.core.util.AbstractFactory;
-import org.eclipse.ecf.core.util.Trace;
-import org.eclipse.ecf.internal.core.ECFDebugOptions;
-import org.eclipse.ecf.internal.core.ECFPlugin;
-
-public class ConnectionFactory {
-
- private static Hashtable connectiontypes = new Hashtable();
-
- protected static ConnectionFactory instance = null;
-
- static {
- instance = new ConnectionFactory();
- }
-
- public static ConnectionFactory getDefault() {
- return instance;
- }
-
- protected ConnectionFactory() {
-
- }
-
- public ConnectionTypeDescription addDescription(
- ConnectionTypeDescription scd) {
- String method = "addDescription";
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ConnectionFactory.class,
- method, scd);
- ConnectionTypeDescription result = addDescription0(scd);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ConnectionFactory.class, method, result);
- return result;
- }
-
- protected ConnectionTypeDescription addDescription0(
- ConnectionTypeDescription n) {
- if (n == null)
- return null;
- return (ConnectionTypeDescription) connectiontypes.put(n.getName(), n);
- }
-
- public boolean containsDescription(ConnectionTypeDescription scd) {
- return containsDescription0(scd);
- }
-
- protected boolean containsDescription0(ConnectionTypeDescription scd) {
- if (scd == null)
- return false;
- return connectiontypes.containsKey(scd.getName());
- }
-
- public ConnectionTypeDescription getDescription(
- ConnectionTypeDescription scd) {
- return getDescription0(scd);
- }
-
- protected ConnectionTypeDescription getDescription0(
- ConnectionTypeDescription scd) {
- if (scd == null)
- return null;
- return (ConnectionTypeDescription) connectiontypes.get(scd.getName());
- }
-
- protected ConnectionTypeDescription getDescription0(String name) {
- if (name == null)
- return null;
- return (ConnectionTypeDescription) connectiontypes.get(name);
- }
-
- public ConnectionTypeDescription getDescriptionByName(String name) {
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ConnectionFactory.class,
- "getDescriptionByName", name);
- ConnectionTypeDescription result = getDescription0(name);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ConnectionFactory.class, "getDescriptionByName", result);
- return result;
- }
-
- public List getDescriptions() {
- return getDescriptions0();
- }
-
- protected List getDescriptions0() {
- return new ArrayList(connectiontypes.values());
- }
-
- public ISynchAsynchConnection createSynchAsynchConnection(
- ISynchAsynchEventHandler handler, ConnectionTypeDescription desc,
- Object[] args) throws ConnectionCreateException {
- if (handler == null)
- throw new ConnectionCreateException("handler cannot be null");
- return createSynchAsynchConnection(handler, desc, null, args);
- }
-
- protected void throwConnectionCreateException(String message,
- Throwable cause, String method) throws ConnectionCreateException {
- ConnectionCreateException except = (cause == null) ? new ConnectionCreateException(
- message)
- : new ConnectionCreateException(message, cause);
- Trace.throwing(ECFPlugin.getDefault(),
- ECFDebugOptions.EXCEPTIONS_THROWING, ConnectionFactory.class,
- method, except);
- throw except;
- }
-
- public ISynchAsynchConnection createSynchAsynchConnection(
- ISynchAsynchEventHandler handler, ConnectionTypeDescription desc,
- String[] argTypes, Object[] args) throws ConnectionCreateException {
- String method = "createSynchAsynchConnection";
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ConnectionFactory.class,
- method, new Object[] { handler, desc,
- Trace.getArgumentsString(argTypes),
- Trace.getArgumentsString(args) });
- if (handler == null)
- throwConnectionCreateException(
- "ISynchAsynchEventHandler cannot be null", null, method);
- if (desc == null)
- throwConnectionCreateException(
- "ConnectionTypeDescription cannot be null", null, method);
- ConnectionTypeDescription cd = desc;
- if (cd == null)
- throwConnectionCreateException("ConnectionTypeDescription '"
- + desc.getName() + "' not found", null, method);
- ISynchAsynchConnectionInstantiator instantiator = null;
- Class clazzes[] = null;
- try {
- instantiator = (ISynchAsynchConnectionInstantiator) cd
- .getInstantiator();
- clazzes = AbstractFactory.getClassesForTypes(argTypes, args, cd
- .getClassLoader());
- } catch (Exception e) {
- throwConnectionCreateException(
- "createSynchAsynchConnection exception with description:"
- + desc, e, method);
- }
- if (instantiator == null)
- throwConnectionCreateException(
- "Instantiator for ConnectionTypeDescription '"
- + cd.getName() + "' is null", null, method);
- // Ask instantiator to actually create instance
- ISynchAsynchConnection result = instantiator.createInstance(desc,
- handler, clazzes, args);
- if (result == null)
- throwConnectionCreateException("Instantiator returned null for '"
- + cd.getName() + "'", null, method);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ConnectionFactory.class, method, result);
- return result;
-
- }
-
- public ISynchAsynchConnection createSynchAsynchConnection(
- ISynchAsynchEventHandler handler, String descriptionName)
- throws ConnectionCreateException {
- return createSynchAsynchConnection(handler,
- getDescriptionByName(descriptionName), null, null);
- }
-
- public ISynchAsynchConnection createSynchAsynchConnection(
- ISynchAsynchEventHandler handler, String descriptionName,
- Object[] args) throws ConnectionCreateException {
- return createSynchAsynchConnection(handler,
- getDescriptionByName(descriptionName), args);
- }
-
- public ISynchAsynchConnection createSynchAsynchConnection(
- ISynchAsynchEventHandler handler, String descriptionName,
- String[] argTypes, Object[] args) throws ConnectionCreateException {
- return createSynchAsynchConnection(handler,
- getDescriptionByName(descriptionName), argTypes, args);
- }
-
- public ConnectionTypeDescription removeDescription(
- ConnectionTypeDescription scd) {
- String method = "removeDescription";
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ConnectionFactory.class,
- method, scd);
- ConnectionTypeDescription result = removeDescription0(scd);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ConnectionFactory.class, method, scd);
- return result;
- }
-
- protected ConnectionTypeDescription removeDescription0(
- ConnectionTypeDescription n) {
- if (n == null)
- return null;
- return (ConnectionTypeDescription) connectiontypes.remove(n.getName());
- }
-} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionTypeDescription.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionTypeDescription.java
deleted file mode 100644
index e79a1dea4..000000000
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionTypeDescription.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * 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.comm;
-
-import org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator;
-
-public class ConnectionTypeDescription {
- protected String name;
-
- protected String instantiatorClass;
-
- protected ISynchAsynchConnectionInstantiator instantiator;
-
- protected int hashCode = 0;
-
- protected ClassLoader classLoader = null;
-
- protected String description;
-
- protected String[] argTypes;
-
- protected String[] argDefaults;
-
- protected String[] argNames;
-
- protected static final String[] EMPTY = new String[0];
-
- public ConnectionTypeDescription(ClassLoader loader, String name,
- String instantiatorClass, String desc, String[] defTypes,
- String[] defValues, String[] defNames) {
- if (name == null)
- throw new RuntimeException(new InstantiationException(
- "ConnectionTypeDescription<init> name cannot be null"));
- if (instantiatorClass == null)
- throw new RuntimeException(
- new InstantiationException(
- "ConnectionTypeDescription<init> instantiatorClass cannot be null"));
- this.classLoader = loader;
- this.name = name;
- this.instantiatorClass = instantiatorClass;
- this.hashCode = name.hashCode();
- this.argTypes = defTypes;
- this.argDefaults = defValues;
- this.argNames = defNames;
- }
-
- public ConnectionTypeDescription(ClassLoader loader, String name,
- String instantiatorClass, String desc) {
- this(loader, name, instantiatorClass, desc, EMPTY, EMPTY, EMPTY);
- }
-
- public ConnectionTypeDescription(String name, String instantiatorClass,
- String desc) {
- this(null, name, instantiatorClass, desc);
- }
-
- public ConnectionTypeDescription(String name,
- ISynchAsynchConnectionInstantiator inst, String desc,
- String[] defTypes, String[] defValues, String[] defNames) {
- if (name == null)
- throw new RuntimeException(new InstantiationException(
- "ConnectionTypeDescription<init> name cannot be null"));
- if (inst == null)
- throw new RuntimeException(
- new InstantiationException(
- "ConnectionTypeDescription<init> instantiator instance cannot be null"));
- this.instantiator = inst;
- this.name = name;
- this.classLoader = this.instantiator.getClass().getClassLoader();
- this.instantiatorClass = this.instantiator.getClass().getName();
- this.hashCode = name.hashCode();
- this.description = desc;
- this.argTypes = defTypes;
- this.argDefaults = defValues;
- this.argNames = defNames;
- }
-
- public ConnectionTypeDescription(String name,
- ISynchAsynchConnectionInstantiator 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 ConnectionTypeDescription))
- return false;
- ConnectionTypeDescription scd = (ConnectionTypeDescription) other;
- return scd.name.equals(name);
- }
-
- public int hashCode() {
- return hashCode;
- }
-
- public String toString() {
- StringBuffer b = new StringBuffer("ConnectionTypeDescription[");
- 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("]");
- return b.toString();
- }
-
- protected ISynchAsynchConnectionInstantiator getInstantiator()
- throws ClassNotFoundException, InstantiationException,
- IllegalAccessException {
- synchronized (this) {
- if (instantiator == null)
- initializeInstantiator(classLoader);
- return instantiator;
- }
- }
-
- protected 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 = (ISynchAsynchConnectionInstantiator) clazz.newInstance();
- }
-
- public String getDescription() {
- return description;
- }
-
- public String[] getArgDefaults() {
- return argDefaults;
- }
-
- public String[] getArgNames() {
- return argNames;
- }
-
- public String[] getArgTypes() {
- return argTypes;
- }
-} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/provider/ISynchAsynchConnectionInstantiator.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/provider/ISynchAsynchConnectionInstantiator.java
deleted file mode 100644
index b2cae9f10..000000000
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/provider/ISynchAsynchConnectionInstantiator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.comm.provider;
-
-import org.eclipse.ecf.core.comm.ConnectionTypeDescription;
-import org.eclipse.ecf.core.comm.ConnectionCreateException;
-import org.eclipse.ecf.core.comm.ISynchAsynchConnection;
-import org.eclipse.ecf.core.comm.ISynchAsynchEventHandler;
-
-/**
- * Provider interface for the org.eclipse.ecf.core.connectionFactory extension
- * point. Extensions implementing the org.eclipse.ecf.core.connectionFactory
- * extension point must implement this interface.
- *
- */
-public interface ISynchAsynchConnectionInstantiator {
- /**
- * Create a new instance implementing ISynchAsynchConnection
- *
- * @param description
- * the ConnectionTypeDescription use to create the instance
- * @param handler
- * the event handler to be associated with the new connection
- * instance
- * @param clazzes
- * the classes for the args array
- * @param args
- * the arguments passed to the connection factory
- * @return ISynchAsynchConnection created. Must not be null.
- * @throws ConnectionCreateException
- * thrown if new instance of given ConnectionTypeDescription
- * cannot be created for whatever reason
- */
- public ISynchAsynchConnection createInstance(
- ConnectionTypeDescription description,
- ISynchAsynchEventHandler handler, Class[] clazzes, Object[] args)
- throws ConnectionCreateException;
-} \ 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 c5e88e76c..ac4bc129c 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
@@ -31,16 +31,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.IContainerFactory;
-import org.eclipse.ecf.core.comm.ConnectionFactory;
-import org.eclipse.ecf.core.comm.ConnectionTypeDescription;
-import org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator;
import org.eclipse.ecf.core.provider.IContainerInstantiator;
-/*
-import org.eclipse.ecf.core.sharedobject.ISharedObjectFactory;
-import org.eclipse.ecf.core.sharedobject.SharedObjectFactory;
-import org.eclipse.ecf.core.sharedobject.SharedObjectTypeDescription;
-import org.eclipse.ecf.core.sharedobject.provider.ISharedObjectInstantiator;
-*/
import org.eclipse.ecf.core.start.ECFStartJob;
import org.eclipse.ecf.core.start.IECFStart;
import org.eclipse.ecf.core.util.Trace;
@@ -51,11 +42,8 @@ public class ECFPlugin extends Plugin {
public static final String PLUGIN_ID = "org.eclipse.ecf";
public static final String ECFNAMESPACE = PLUGIN_ID;
- public static final String NAMESPACE_EPOINT = ECFNAMESPACE + ".namespace";
public static final String CONTAINER_FACTORY_EPOINT = ECFNAMESPACE
+ ".containerFactory";
- public static final String COMM_FACTORY_EPOINT = ECFNAMESPACE
- + ".connectionFactory";
public static final String START_EPOINT = ECFNAMESPACE + ".startup";
public static final String PLUGIN_RESOURCE_BUNDLE = ECFNAMESPACE
@@ -290,118 +278,6 @@ public class ECFPlugin extends Plugin {
}
addContainerFactoryExtensions(extensionPoint.getConfigurationElements());
}
- /**
- * Remove extensions for comm extension point
- *
- * @param members
- * the members to remove
- */
- protected void removeCommExtensions(IConfigurationElement[] members) {
- String bundleName = getDefault().getBundle().getSymbolicName();
- for (int m = 0; m < members.length; m++) {
- IConfigurationElement member = members[m];
- String name = null;
- IExtension extension = member.getDeclaringExtension();
- try {
- name = member.getAttribute(NAME_ATTRIBUTE);
- if (name == null) {
- name = member.getAttribute(CLASS_ATTRIBUTE);
- }
- if (name == null)
- continue;
- ConnectionTypeDescription cd = ConnectionFactory.getDefault()
- .getDescriptionByName(name);
- if (cd == null || !ConnectionFactory.getDefault().containsDescription(cd)) {
- continue;
- }
- // remove
- ConnectionFactory.getDefault().removeDescription(cd);
- debug("removeCommExtensions:removed connection description:"
- + cd);
- } catch (Exception e) {
- log(getStatusForContException(extension, bundleName, name));
- dumpStack("Exception in removeCommExtensions", e);
- }
- }
- }
- /**
- * Add comm extension point extensions
- *
- * @param members
- * to add
- */
- protected void addCommExtensions(IConfigurationElement[] members) {
- String bundleName = getDefault().getBundle().getSymbolicName();
- // 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 "instantiatorClass"
- exten = member.createExecutableExtension(CLASS_ATTRIBUTE);
- // Verify that object implements
- // ISynchAsynchConnectionInstantiator
- String clazz = exten.getClass().getName();
- // Get name and get version, if available
- name = member.getAttribute(NAME_ATTRIBUTE);
- if (name == null) {
- name = clazz;
- }
- String description = member.getAttribute(DESCRIPTION_ATTRIBUTE);
- if (description == null) {
- description = "";
- }
- // Get any arguments
- // Get any arguments
- DefaultArgs defaults = getDefaultArgs(member
- .getChildren(ARG_ELEMENT_NAME));
- ConnectionTypeDescription cd = new ConnectionTypeDescription(
- name, (ISynchAsynchConnectionInstantiator) exten,
- description, defaults.getTypes(), defaults
- .getDefaults(), defaults.getNames());
- debug("setupCommExtensionPoint:created description:" + cd);
- if (ConnectionFactory.getDefault().containsDescription(cd)) {
- // It's already there...log and throw as we can't use the
- // same named factory
- IStatus s = new Status(
- Status.ERROR,
- bundleName,
- FACTORY_NAME_COLLISION_ERRORCODE,
- getResourceString("ExtPointError.CommNameCollisionPrefix")
- + name
- + getResourceString("ExtPointError.CommNameCollisionSuffix")
- + extension
- .getExtensionPointUniqueIdentifier(),
- null);
- log(s);
- throw new CoreException(getStatusForCommException(
- extension, bundleName, name));
- }
- // Now add the description and we're ready to go.
- ConnectionFactory.getDefault().addDescription(cd);
- debug("setupCommExtensionPoint:added description to factory:"
- + cd);
- } catch (CoreException e) {
- log(e.getStatus());
- dumpStack("CoreException in setupCommExtensionPoint", e);
- } catch (Exception e) {
- log(getStatusForCommException(extension, bundleName, name));
- dumpStack("Exception in setupCommExtensionPoint", e);
- }
- }
- }
- protected void setupCommExtensionPoint(BundleContext bc) {
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IExtensionPoint extensionPoint = reg
- .getExtensionPoint(COMM_FACTORY_EPOINT);
- if (extensionPoint == null) {
- return;
- }
- addCommExtensions(extensionPoint.getConfigurationElements());
- }
protected void setupStartExtensionPoint(BundleContext bc) {
IExtensionRegistry reg = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = reg
@@ -483,8 +359,6 @@ public class ECFPlugin extends Plugin {
Platform.getExtensionRegistry().addRegistryChangeListener(
registryManager);
setupContainerFactoryExtensionPoint(context);
- setupCommExtensionPoint(context);
- //setupSharedObjectExtensionPoint(context);
setupStartExtensionPoint(context);
}
protected class ECFRegistryManager implements IRegistryChangeListener {
@@ -503,35 +377,6 @@ public class ECFPlugin extends Plugin {
break;
}
}
- /*
- delta = event.getExtensionDeltas(ECFNAMESPACE,
- "sharedObjectFactory");
- for (int i = 0; i < delta.length; i++) {
- switch (delta[i].getKind()) {
- case IExtensionDelta.ADDED:
- addSharedObjectExtensions(delta[i].getExtension()
- .getConfigurationElements());
- break;
- case IExtensionDelta.REMOVED:
- removeSharedObjectExtensions(delta[i].getExtension()
- .getConfigurationElements());
- break;
- }
- }
- */
- delta = event.getExtensionDeltas(ECFNAMESPACE, "connectionFactory");
- for (int i = 0; i < delta.length; i++) {
- switch (delta[i].getKind()) {
- case IExtensionDelta.ADDED:
- addCommExtensions(delta[i].getExtension()
- .getConfigurationElements());
- break;
- case IExtensionDelta.REMOVED:
- removeCommExtensions(delta[i].getExtension()
- .getConfigurationElements());
- break;
- }
- }
}
}

Back to the top