Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2004-12-29 19:38:31 +0000
committerslewis2004-12-29 19:38:31 +0000
commit417aa363af7ffe1f0b8f4285493afb4d2e925909 (patch)
tree488714a68b88db2e17f1b1528b944e5cab1cb9cb
parentcc9901265370e99bdac85f85e58ea1ce5b25359a (diff)
downloadorg.eclipse.ecf-417aa363af7ffe1f0b8f4285493afb4d2e925909.tar.gz
org.eclipse.ecf-417aa363af7ffe1f0b8f4285493afb4d2e925909.tar.xz
org.eclipse.ecf-417aa363af7ffe1f0b8f4285493afb4d2e925909.zip
Changed schema for extension point 'comm' to be named 'connectionFactory', changed schema name appropriately. Added tests for container factor and connection factory initialization
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF1
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/plugin.xml7
-rw-r--r--framework/bundles/org.eclipse.ecf/plugin.xml2
-rw-r--r--framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd (renamed from framework/bundles/org.eclipse.ecf/schema/comm.exsd)6
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java19
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionDescription.java22
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionFactory.java32
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/IDFactory.java8
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java4
9 files changed, 73 insertions, 28 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
index 6f79a9250..5315f9653 100644
--- a/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
@@ -8,5 +8,6 @@ Bundle-Localization: plugin
Eclipse-AutoStart: true
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ecf
+Provide-Package: org.eclipse.ecf.provider.comm.tcp
DynamicImport-Package: *
diff --git a/framework/bundles/org.eclipse.ecf.provider/plugin.xml b/framework/bundles/org.eclipse.ecf.provider/plugin.xml
index d428e7eb7..6b4b00e2f 100644
--- a/framework/bundles/org.eclipse.ecf.provider/plugin.xml
+++ b/framework/bundles/org.eclipse.ecf.provider/plugin.xml
@@ -8,4 +8,11 @@
description="Generic Container Instantiator"
name="generic"/>
</extension>
+ <extension
+ point="org.eclipse.ecf.connectionFactory">
+ <connectionFactory
+ class="org.eclipse.ecf.provider.comm.tcp.Client$Creator"
+ description="TCP Client Connection Factory"
+ name="tcpclient"/>
+ </extension>
</plugin>
diff --git a/framework/bundles/org.eclipse.ecf/plugin.xml b/framework/bundles/org.eclipse.ecf/plugin.xml
index c3c37c3b0..8feeee2ee 100644
--- a/framework/bundles/org.eclipse.ecf/plugin.xml
+++ b/framework/bundles/org.eclipse.ecf/plugin.xml
@@ -20,7 +20,7 @@
<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="comm" name="ECF Connection Factory" schema="schema/comm.exsd"/>
+ <extension-point id="connectionFactory" name="connectionFactory" schema="schema/connectionFactory.exsd"/>
<extension
point="org.eclipse.ecf.containerFactory">
diff --git a/framework/bundles/org.eclipse.ecf/schema/comm.exsd b/framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd
index d3db968d0..52488b4b9 100644
--- a/framework/bundles/org.eclipse.ecf/schema/comm.exsd
+++ b/framework/bundles/org.eclipse.ecf/schema/connectionFactory.exsd
@@ -13,7 +13,7 @@
<element name="extension">
<complexType>
<sequence>
- <element ref="connection"/>
+ <element ref="connectionFactory"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@@ -39,9 +39,9 @@
</complexType>
</element>
- <element name="connection">
+ <element name="connectionFactory">
<complexType>
- <attribute name="instantiatorClass" type="string" use="required">
+ <attribute name="class" type="string" use="required">
<annotation>
<documentation>
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java
index af33652ee..38254e67d 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java
@@ -32,13 +32,22 @@ public class SharedObjectContainerDescription {
this.classLoader = loader;
if (name == null)
throw new RuntimeException(new InstantiationException(
- "sharedobjectcontainer description name cannot be null"));
+ "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;
}
public SharedObjectContainerDescription(String name, ISharedObjectContainerInstantiator inst, String desc) {
+ 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();
@@ -63,12 +72,12 @@ public class SharedObjectContainerDescription {
public String toString() {
StringBuffer b = new StringBuffer("SharedObjectContainerDescription[");
- b.append("name: ").append(name).append(", ");
+ b.append("name:").append(name).append(";");
if (instantiator == null)
- b.append("instantiatorClass: ").append(instantiatorClass).append(", ");
+ b.append("class:").append(instantiatorClass).append(";");
else
- b.append("instantiator: ").append(instantiator).append(", ");
- b.append("description: ").append(description).append("]");
+ b.append("instantiator:").append(instantiator).append(";");
+ b.append("desc:").append(description).append("]");
return b.toString();
}
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionDescription.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionDescription.java
index 9f4e7fc41..ad65826a5 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionDescription.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/comm/ConnectionDescription.java
@@ -28,16 +28,26 @@ public class ConnectionDescription {
String name, String instantiatorClass, String desc) {
if (name == null)
throw new RuntimeException(new InstantiationException(
- "stagecontainer description name cannot be null"));
+ "ConnectionDescription<init> name cannot be null"));
+ if (instantiatorClass == null)
+ throw new RuntimeException(new InstantiationException(
+ "ConnectionDescription<init> instantiatorClass cannot be null"));
this.classLoader = loader;
this.name = name;
this.instantiatorClass = instantiatorClass;
this.hashCode = name.hashCode();
}
public ConnectionDescription(String name, ISynchAsynchConnectionInstantiator inst, String desc) {
+ if (name == null)
+ throw new RuntimeException(new InstantiationException(
+ "ConnectionDescription<init> name cannot be null"));
+ if (inst == null)
+ throw new RuntimeException(new InstantiationException(
+ "ConnectionDescription<init> instantiator instance cannot be null"));
this.instantiator = inst;
+ this.name = name;
this.classLoader = this.instantiator.getClass().getClassLoader();
- this.instantiatorClass = this.instantiatorClass.getClass().getName();
+ this.instantiatorClass = this.instantiator.getClass().getName();
this.hashCode = name.hashCode();
this.description = desc;
}
@@ -60,8 +70,12 @@ public class ConnectionDescription {
public String toString() {
StringBuffer b = new StringBuffer("ConnectionDescription[");
- b.append(name).append(";");
- b.append(instantiatorClass).append(";").append(description).append("]");
+ 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();
}
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
index f79b699ce..f305a2c12 100644
--- 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
@@ -11,7 +11,9 @@
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;
@@ -20,12 +22,6 @@ public class ConnectionFactory {
private static Hashtable connectiontypes = new Hashtable();
- static {
- ConnectionDescription cd = new ConnectionDescription(
- (ClassLoader) null, "default",
- "org.eclipse.ecf.provider.comm.tcp.Client$Creator","default connection");
- addDescription(cd);
- }
public final static ConnectionDescription getDescription(
ConnectionDescription scd) {
return getDescription0(scd);
@@ -36,6 +32,9 @@ public class ConnectionFactory {
return null;
return (ConnectionDescription) connectiontypes.get(scd.getName());
}
+ protected static List getDescriptions0() {
+ return new ArrayList(connectiontypes.values());
+ }
protected static ConnectionDescription getDescription0(String name) {
if (name == null)
return null;
@@ -48,6 +47,9 @@ public class ConnectionFactory {
ConnectionDescription scd) {
return removeDescription0(scd);
}
+ public static final List getDescriptions() {
+ return getDescriptions0();
+ }
protected static ConnectionDescription removeDescription0(
ConnectionDescription n) {
@@ -81,11 +83,11 @@ public class ConnectionFactory {
throws ConnectionInstantiationException {
if (handler == null)
- throw new ConnectionInstantiationException("handler cannot be null");
+ throw new ConnectionInstantiationException("ISynchAsynchConnectionEventHandler cannot be null");
if (desc == null)
throw new ConnectionInstantiationException(
"ConnectionDescription cannot be null");
- ConnectionDescription cd = getDescription0(desc);
+ ConnectionDescription cd = desc;
if (cd == null)
throw new ConnectionInstantiationException("ConnectionDescription "
+ desc.getName() + " not found");
@@ -111,14 +113,18 @@ public class ConnectionFactory {
ISynchAsynchConnectionEventHandler handler,
ConnectionDescription desc, Object[] args)
throws ConnectionInstantiationException {
+ if (handler == null)
+ throw new ConnectionInstantiationException("ISynchAsynchConnectionEventHandler cannot be null");
return makeSynchAsynchConnection(handler, desc, null, args);
}
public static ISynchAsynchConnection makeSynchAsynchConnection(
ISynchAsynchConnectionEventHandler handler, String descriptionName,
Object[] args) throws ConnectionInstantiationException {
+ if (handler == null)
+ throw new ConnectionInstantiationException("ISynchAsynchConnectionEventHandler cannot be null");
ConnectionDescription desc = getDescriptionByName(descriptionName);
if (desc == null)
- throw new ConnectionInstantiationException("Connection named '"
+ throw new ConnectionInstantiationException("Connection type named '"
+ descriptionName + "' not found");
return makeSynchAsynchConnection(handler, desc, args);
}
@@ -126,18 +132,22 @@ public class ConnectionFactory {
ISynchAsynchConnectionEventHandler handler, String descriptionName,
String[] argTypes, Object[] args)
throws ConnectionInstantiationException {
+ if (handler == null)
+ throw new ConnectionInstantiationException("ISynchAsynchConnectionEventHandler cannot be null");
ConnectionDescription desc = getDescriptionByName(descriptionName);
if (desc == null)
- throw new ConnectionInstantiationException("Connection named '"
+ throw new ConnectionInstantiationException("Connection type named '"
+ descriptionName + "' not found");
return makeSynchAsynchConnection(handler, desc, argTypes, args);
}
public static ISynchAsynchConnection makeSynchAsynchConnection(
ISynchAsynchConnectionEventHandler handler, String descriptionName)
throws ConnectionInstantiationException {
+ if (handler == null)
+ throw new ConnectionInstantiationException("ISynchAsynchConnectionEventHandler cannot be null");
ConnectionDescription desc = getDescriptionByName(descriptionName);
if (desc == null)
- throw new ConnectionInstantiationException("Connection named '"
+ throw new ConnectionInstantiationException("Connection type named '"
+ descriptionName + "' not found");
return makeSynchAsynchConnection(handler, desc, null, null);
}
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/IDFactory.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/IDFactory.java
index f1a8e53dd..7b5143a5b 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/IDFactory.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/IDFactory.java
@@ -215,7 +215,9 @@ public class IDFactory {
}
public static final ID makeID(String namespacename, String[] argTypes,
Object[] args) throws IDInstantiationException {
- return makeID(getNamespaceByName(namespacename), argTypes, args);
+ Namespace n = getNamespaceByName(namespacename);
+ if (n == null) throw new IDInstantiationException("Namespace named "+namespacename+" not found");
+ return makeID(n, argTypes, args);
}
/**
* Make a new identity. Given a Namespace, and an array of instance
@@ -237,7 +239,9 @@ public class IDFactory {
}
public static final ID makeID(String namespacename, Object[] args)
throws IDInstantiationException {
- return makeID(getNamespaceByName(namespacename), args);
+ Namespace n = getNamespaceByName(namespacename);
+ if (n == null) throw new IDInstantiationException("Namespace named "+namespacename+" not found");
+ return makeID(n, args);
}
public static final ID makeStringID(String idstring)
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 22abf4b9e..2f8f6a6af 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
@@ -50,8 +50,8 @@ public class ECFPlugin extends Plugin {
public static final String CONTAINER_FACTORY_EPOINT_NAME_ATTRIBUTE = "name";
public static final String CONTAINER_FACTORY_EPOINT_DESC_ATTRIBUTE = "description";
- public static final String COMM_FACTORY_EPOINT = "org.eclipse.ecf.comm";
- public static final String COMM_FACTORY_EPOINT_CLASS_ATTRIBUTE = "instantiatorClass";
+ public static final String COMM_FACTORY_EPOINT = "org.eclipse.ecf.connectionFactory";
+ public static final String COMM_FACTORY_EPOINT_CLASS_ATTRIBUTE = "class";
public static final String COMM_FACTORY_EPOINT_NAME_ATTRIBUTE = "name";
public static final String COMM_FACTORY_EPOINT_DESC_ATTRIBUTE = "description";

Back to the top