summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-03-22 15:18:46 (EDT)
committerEike Stepper2007-03-22 15:18:46 (EDT)
commit3eb59e513278b894153bf601911e788363a39575 (patch)
tree57f255e576828f4c973a87dc91eda94ed45f33a1
parent3ef517a5167306a360c18c97e7365ac1d2aac80d (diff)
downloadcdo-3eb59e513278b894153bf601911e788363a39575.zip
cdo-3eb59e513278b894153bf601911e788363a39575.tar.gz
cdo-3eb59e513278b894153bf601911e788363a39575.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java4
-rw-r--r--plugins/org.eclipse.net4j.jvm/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.net4j.jvm/plugin.xml18
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java77
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactory.java40
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorImpl.java83
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManager.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManagerImpl.java)20
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ClientJVMConnectorImpl.java)16
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/AbstractJVMConnector.java)17
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java40
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMServerConnector.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ServerJVMConnectorImpl.java)4
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMAcceptor.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptor.java)2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMAcceptorManager.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptorManager.java)10
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMConnector.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConnector.java)2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMConstants.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConstants.java)2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java50
-rw-r--r--plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.net4j.tcp/build.properties3
-rw-r--r--plugins/org.eclipse.net4j.tcp/plugin.xml18
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannelImpl.java)12
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorImpl.java)85
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactory.java60
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPClientConnector.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ClientTCPConnectorImpl.java)19
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/AbstractTCPConnector.java)51
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactory.java78
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorImpl.java)22
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorFactory.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactoryImpl.java)18
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorInjector.java47
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ServerTCPConnectorImpl.java)4
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptor.java)2
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPConnector.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnector.java)2
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPConstants.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConstants.java)2
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPSelector.java)6
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelectorListener.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPSelectorListener.java)14
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPUtil.java60
-rw-r--r--plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.net4j.tests/Net4j SignalTest.launch4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java (renamed from plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTCPTest.java)45
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java16
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java36
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocol.java32
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocolFactory.java52
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java42
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java21
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.net4j/TODOS.txt1
-rw-r--r--plugins/org.eclipse.net4j/build.properties4
-rw-r--r--plugins/org.eclipse.net4j/javadoc.xml46
-rw-r--r--plugins/org.eclipse.net4j/plugin.xml8
-rw-r--r--plugins/org.eclipse.net4j/schema/factories.exsd124
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java56
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AcceptorFactory.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java)17
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ClientProtocolFactory.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java)19
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java133
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorFactory.java (renamed from plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java)17
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/DescriptionUtil.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java22
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactory.java53
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryID.java82
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ServerProtocolFactory.java29
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/TransportContainer.java130
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java130
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/PluginElementProcessorList.java80
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/Factory.java25
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryCreationException.java38
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryDescriptor.java71
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryKey.java37
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/PluginFactoryRegistry.java91
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java22
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorAcceptedEvent.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java43
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java25
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/StringUtil.java20
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IElementProcessor.java20
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java13
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactory.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactoryKey.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactoryID.java)10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/ProductCreationException.java38
93 files changed, 1731 insertions, 936 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java
index 776bcf6..b3769a4 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java
@@ -10,13 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.bundle;
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMLogger;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OMTracer;
-
-import org.eclipse.internal.net4j.util.om.OSGiActivator;
-
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index 8f514aa..0fb088e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -6,10 +6,6 @@
*/
package org.eclipse.emf.cdo.internal.ui.editor;
-import org.eclipse.emf.cdo.CDOAdapter;
-import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
index 607d0fc..796ca29 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditorInput.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.editor;
-import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
import org.eclipse.jface.resource.ImageDescriptor;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java
index 02f015a..1123ef6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java
@@ -10,17 +10,8 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.views;
-import org.eclipse.emf.cdo.CDOAdapter;
-import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.container.CDOContainerAdapter;
-import org.eclipse.emf.cdo.internal.container.CDOContainerAdapterImpl;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.registry.IRegistry;
-import org.eclipse.net4j.util.registry.IRegistryEvent;
-
import org.eclipse.swt.graphics.Image;
import java.text.MessageFormat;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
index fa7baf7..e8fce8f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
@@ -1,17 +1,11 @@
package org.eclipse.emf.cdo.internal.ui.views;
-import org.eclipse.emf.cdo.CDOConstants;
-import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.container.CDOContainerAdapter;
import org.eclipse.emf.cdo.internal.ui.bundle.CDOUI;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
-import org.eclipse.net4j.container.Container;
-import org.eclipse.net4j.container.ContainerManager;
-import org.eclipse.net4j.transport.ConnectorException;
-
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.core.internal.resources.Container;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java
index fd7a94d..cfe767c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizard.java
@@ -1,12 +1,6 @@
package org.eclipse.emf.cdo.internal.ui.wizards;
-import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.container.CDOContainerAdapter;
-
-import org.eclipse.net4j.container.Container;
-import org.eclipse.net4j.container.ContainerManager;
-import org.eclipse.net4j.transport.ConnectorException;
-
+import org.eclipse.core.internal.resources.Container;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java
index 66a05a5..ebf3ef7 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewEditorWizardPage.java
@@ -1,7 +1,5 @@
package org.eclipse.emf.cdo.internal.ui.wizards;
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.internal.ui.bundle.SharedIcons;
import org.eclipse.emf.common.util.EList;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java
index 4dad73c..08886b0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizard.java
@@ -1,11 +1,6 @@
package org.eclipse.emf.cdo.internal.ui.wizards;
-import org.eclipse.emf.cdo.container.CDOContainerAdapter;
-
-import org.eclipse.net4j.container.Container;
-import org.eclipse.net4j.container.ContainerManager;
-import org.eclipse.net4j.transport.ConnectorException;
-
+import org.eclipse.core.internal.resources.Container;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java
index 4481864..918f3ef 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/wizards/NewSessionWizardPage.java
@@ -1,8 +1,6 @@
package org.eclipse.emf.cdo.internal.ui.wizards;
-import org.eclipse.net4j.container.Container;
-import org.eclipse.net4j.container.ContainerManager;
-
+import org.eclipse.core.internal.resources.Container;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
diff --git a/plugins/org.eclipse.net4j.jvm/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.jvm/META-INF/MANIFEST.MF
index e668dad..47b0bb1 100644
--- a/plugins/org.eclipse.net4j.jvm/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.jvm/META-INF/MANIFEST.MF
@@ -1,14 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.net4j.jvm
+Bundle-SymbolicName: org.eclipse.net4j.jvm;singleton:=true
Bundle-Version: 0.8.0.qualifier
Bundle-Activator: org.eclipse.net4j.internal.jvm.bundle.JVM$Activator
Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.net4j;visibility:=reexport
-Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime;resolution:=optional,
+ org.eclipse.net4j;visibility:=reexport
Import-Package: org.osgi.framework;version="1.3.0";resolution:=optional
Export-Package: org.eclipse.net4j.internal.jvm;version="0.8.0",
org.eclipse.net4j.internal.jvm.bundle;version="0.8.0",
org.eclipse.net4j.jvm;version="0.8.0"
+Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.net4j.jvm/plugin.xml b/plugins/org.eclipse.net4j.jvm/plugin.xml
new file mode 100644
index 0000000..5aa799c
--- /dev/null
+++ b/plugins/org.eclipse.net4j.jvm/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<plugin>
+
+ <extension
+ point="org.eclipse.net4j.factories">
+ <factory
+ class="org.eclipse.net4j.internal.jvm.JVMAcceptorFactory"
+ productGroup="org.eclipse.net4j.acceptors"
+ type="jvm"/>
+ <factory
+ class="org.eclipse.net4j.internal.jvm.JVMConnectorFactory"
+ productGroup="org.eclipse.net4j.connectors"
+ type="jvm"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
new file mode 100644
index 0000000..0eb804a
--- /dev/null
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptor.java
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.jvm;
+
+import org.eclipse.net4j.jvm.IJVMAcceptor;
+import org.eclipse.net4j.util.StringUtil;
+
+import org.eclipse.internal.net4j.transport.Acceptor;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class JVMAcceptor extends Acceptor implements IJVMAcceptor
+{
+ private String name;
+
+ public JVMAcceptor()
+ {
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public JVMServerConnector handleAccept(JVMClientConnector client)
+ {
+ JVMServerConnector connector = new JVMServerConnector(client);
+ addConnector(connector);
+ return connector;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("JVMAcceptor[{0}]", name); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ if (StringUtil.isEmpty(name))
+ {
+ throw new IllegalStateException("No name"); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ JVMAcceptorManager.INSTANCE.registerAcceptor(this);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ JVMAcceptorManager.INSTANCE.deregisterAcceptor(this);
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactory.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactory.java
new file mode 100644
index 0000000..0a0310f
--- /dev/null
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactory.java
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.jvm;
+
+import org.eclipse.net4j.jvm.IJVMConstants;
+import org.eclipse.net4j.util.factory.ProductCreationException;
+
+import org.eclipse.internal.net4j.transport.AcceptorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class JVMAcceptorFactory extends AcceptorFactory<JVMAcceptor>
+{
+ public JVMAcceptorFactory()
+ {
+ super(IJVMConstants.TYPE);
+ }
+
+ public JVMAcceptor create(String description) throws ProductCreationException
+ {
+ JVMAcceptor acceptor = new JVMAcceptor();
+ acceptor.setName(description);
+ return acceptor;
+ }
+
+ @Override
+ public String getDescriptionFor(JVMAcceptor acceptor)
+ {
+ return acceptor.getName();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorImpl.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorImpl.java
deleted file mode 100644
index 4b4dbb9..0000000
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
- * 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:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.jvm;
-
-import org.eclipse.net4j.jvm.JVMAcceptor;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.transport.Acceptor;
-import org.eclipse.internal.net4j.transport.DescriptionUtil;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class JVMAcceptorImpl extends Acceptor implements JVMAcceptor
-{
- @SuppressWarnings("unused")
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, JVMAcceptorImpl.class);
-
- private String name;
-
- public JVMAcceptorImpl()
- {
- }
-
- public String getName()
- {
- return name;
- }
-
- public ServerJVMConnectorImpl handleAccept(ClientJVMConnectorImpl client)
- {
- ServerJVMConnectorImpl connector = new ServerJVMConnectorImpl(client);
- connector.setReceiveExecutor(getReceiveExecutor());
- connector.setProtocolFactoryRegistry(getProtocolFactoryRegistry());
- connector.setBufferProvider(getBufferProvider());
- return connector;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("JVMAcceptor[{0}]", getDescription()); //$NON-NLS-1$
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- if (getDescription() == null)
- {
- throw new IllegalStateException("getDescription() == null"); //$NON-NLS-1$
- }
- else
- {
- name = DescriptionUtil.getElement(getDescription(), 1);
- }
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- JVMAcceptorManagerImpl.INSTANCE.registerAcceptor(this);
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- JVMAcceptorManagerImpl.INSTANCE.deregisterAcceptor(this);
- super.doDeactivate();
- }
-}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManagerImpl.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManager.java
index fcc6e8c..c092d12 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManagerImpl.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManager.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.internal.jvm;
-import org.eclipse.net4j.jvm.JVMAcceptor;
-import org.eclipse.net4j.jvm.JVMAcceptorManager;
+import org.eclipse.net4j.jvm.IJVMAcceptor;
+import org.eclipse.net4j.jvm.IJVMAcceptorManager;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
@@ -19,25 +19,25 @@ import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
/**
* @author Eike Stepper
*/
-public class JVMAcceptorManagerImpl implements JVMAcceptorManager
+public class JVMAcceptorManager implements IJVMAcceptorManager
{
// @Singleton
- public static final JVMAcceptorManagerImpl INSTANCE = new JVMAcceptorManagerImpl();
+ public static final JVMAcceptorManager INSTANCE = new JVMAcceptorManager();
- private IRegistry<String, JVMAcceptor> acceptorRegistry = new HashMapRegistry();
+ private IRegistry<String, IJVMAcceptor> acceptorRegistry = new HashMapRegistry();
- public IRegistry<String, JVMAcceptor> getAcceptorRegistry()
+ public IRegistry<String, IJVMAcceptor> getAcceptorRegistry()
{
// TODO Introduce UnmodifiableRegistry
return acceptorRegistry;
}
- public JVMAcceptorImpl getAcceptor(String name)
+ public JVMAcceptor getAcceptor(String name)
{
- return (JVMAcceptorImpl)acceptorRegistry.get(name);
+ return (JVMAcceptor)acceptorRegistry.get(name);
}
- public boolean registerAcceptor(JVMAcceptorImpl acceptor)
+ public boolean registerAcceptor(JVMAcceptor acceptor)
{
String name = acceptor.getName();
if (!acceptorRegistry.containsKey(name))
@@ -49,7 +49,7 @@ public class JVMAcceptorManagerImpl implements JVMAcceptorManager
return false;
}
- public boolean deregisterAcceptor(JVMAcceptorImpl acceptor)
+ public boolean deregisterAcceptor(JVMAcceptor acceptor)
{
return acceptorRegistry.remove(acceptor.getName()) != null;
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ClientJVMConnectorImpl.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java
index 330ba59..4799e9c 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ClientJVMConnectorImpl.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMClientConnector.java
@@ -20,9 +20,9 @@ import org.eclipse.internal.net4j.util.lifecycle.LifecycleEventAdapter;
/**
* @author Eike Stepper
*/
-public class ClientJVMConnectorImpl extends AbstractJVMConnector
+public class JVMClientConnector extends JVMConnector
{
- private JVMAcceptorImpl acceptor;
+ private JVMAcceptor acceptor;
private IListener peerLifecycleListener = new LifecycleEventAdapter()
{
@@ -34,7 +34,7 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
}
};
- public ClientJVMConnectorImpl()
+ public JVMClientConnector()
{
}
@@ -43,7 +43,7 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
return ConnectorLocation.CLIENT;
}
- public JVMAcceptorImpl getAcceptor()
+ public JVMAcceptor getAcceptor()
{
return acceptor;
}
@@ -52,7 +52,7 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
- acceptor = JVMAcceptorManagerImpl.INSTANCE.getAcceptor(getName());
+ acceptor = JVMAcceptorManager.INSTANCE.getAcceptor(getName());
if (acceptor == null)
{
throw new IllegalStateException("acceptor == null");
@@ -63,7 +63,7 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
protected void doActivate() throws Exception
{
super.doActivate();
- AbstractJVMConnector peer = acceptor.handleAccept(this);
+ JVMConnector peer = acceptor.handleAccept(this);
setPeer(peer);
}
@@ -74,9 +74,9 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
super.doDeactivate();
}
- protected AbstractJVMConnector createServerPeer() throws Exception
+ protected JVMConnector createServerPeer() throws Exception
{
- ServerJVMConnectorImpl server = new ServerJVMConnectorImpl(this);
+ JVMServerConnector server = new JVMServerConnector(this);
server.setBufferProvider(getBufferProvider());
server.setReceiveExecutor(getReceiveExecutor());
server.addListener(peerLifecycleListener);
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/AbstractJVMConnector.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
index 4704d07..2a70382 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/AbstractJVMConnector.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnector.java
@@ -24,13 +24,13 @@ import java.util.Queue;
*
* @author Eike Stepper
*/
-public abstract class AbstractJVMConnector extends Connector
+public abstract class JVMConnector extends Connector
{
- private AbstractJVMConnector peer;
+ private JVMConnector peer;
private String name;
- public AbstractJVMConnector()
+ public JVMConnector()
{
}
@@ -39,12 +39,17 @@ public abstract class AbstractJVMConnector extends Connector
return name;
}
- public AbstractJVMConnector getPeer()
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public JVMConnector getPeer()
{
return peer;
}
- public void setPeer(AbstractJVMConnector peer)
+ public void setPeer(JVMConnector peer)
{
this.peer = peer;
}
@@ -54,7 +59,7 @@ public abstract class AbstractJVMConnector extends Connector
{
try
{
- Channel channel = getPeer().createChannel(channelIndex, protocolID, null);
+ Channel channel = getPeer().createChannel(channelIndex, protocolID);
if (channel == null)
{
throw new ConnectorException("Failed to register channel with peer"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java
new file mode 100644
index 0000000..f7b99a3
--- /dev/null
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactory.java
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.jvm;
+
+import org.eclipse.net4j.jvm.IJVMConstants;
+import org.eclipse.net4j.util.factory.ProductCreationException;
+
+import org.eclipse.internal.net4j.transport.ConnectorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class JVMConnectorFactory extends ConnectorFactory<JVMClientConnector>
+{
+ public JVMConnectorFactory(String type)
+ {
+ super(IJVMConstants.TYPE);
+ }
+
+ public JVMClientConnector create(String description) throws ProductCreationException
+ {
+ JVMClientConnector connector = new JVMClientConnector();
+ connector.setName(description);
+ return connector;
+ }
+
+ @Override
+ public String getDescriptionFor(JVMClientConnector connector)
+ {
+ return connector.getName();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ServerJVMConnectorImpl.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMServerConnector.java
index 1fddd23..2340767 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ServerJVMConnectorImpl.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMServerConnector.java
@@ -16,9 +16,9 @@ import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
/**
* @author Eike Stepper
*/
-public class ServerJVMConnectorImpl extends AbstractJVMConnector
+public class JVMServerConnector extends JVMConnector
{
- public ServerJVMConnectorImpl(ClientJVMConnectorImpl clientPeer)
+ public JVMServerConnector(JVMClientConnector clientPeer)
{
setPeer(clientPeer);
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptor.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMAcceptor.java
index ff0d4c1..cbecd6ba 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptor.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMAcceptor.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.transport.IAcceptor;
/**
* @author Eike Stepper
*/
-public interface JVMAcceptor extends IAcceptor
+public interface IJVMAcceptor extends IAcceptor
{
public String getName();
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptorManager.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMAcceptorManager.java
index 5709133..1362db3 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptorManager.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMAcceptorManager.java
@@ -10,17 +10,17 @@
**************************************************************************/
package org.eclipse.net4j.jvm;
-import org.eclipse.net4j.internal.jvm.JVMAcceptorManagerImpl;
+import org.eclipse.net4j.internal.jvm.JVMAcceptorManager;
import org.eclipse.net4j.util.registry.IRegistry;
/**
* @author Eike Stepper
*/
-public interface JVMAcceptorManager
+public interface IJVMAcceptorManager
{
- public static final JVMAcceptorManager INSTANCE = JVMAcceptorManagerImpl.INSTANCE;
+ public static final IJVMAcceptorManager INSTANCE = JVMAcceptorManager.INSTANCE;
- public IRegistry<String, JVMAcceptor> getAcceptorRegistry();
+ public IRegistry<String, IJVMAcceptor> getAcceptorRegistry();
- public JVMAcceptor getAcceptor(String name);
+ public IJVMAcceptor getAcceptor(String name);
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConnector.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMConnector.java
index 3a27e3a..cfa2cbc 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConnector.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMConnector.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.transport.IConnector;
/**
* @author Eike Stepper
*/
-public interface JVMConnector extends IConnector
+public interface IJVMConnector extends IConnector
{
public String getName();
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConstants.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMConstants.java
index 7c61a92..647aea2 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConstants.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/IJVMConstants.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.jvm;
/**
* @author Eike Stepper
*/
-public interface JVMConstants
+public interface IJVMConstants
{
public static final String TYPE = "jvm";
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java
deleted file mode 100644
index 0a3aa81..0000000
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMUtil.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
- * 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:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.jvm;
-
-import org.eclipse.internal.net4j.transport.DescriptionUtil;
-
-/**
- * @author Eike Stepper
- */
-public final class JVMUtil
-{
- private JVMUtil()
- {
- }
-
- public static String createAcceptorDescription()
- {
- return createAcceptorDescription(JVMConstants.DEFAULT_NAME);
- }
-
- public static String createAcceptorDescription(String name)
- {
- Object[] elements = { name };
- return DescriptionUtil.getDescription(JVMConstants.TYPE, elements);
- }
-
- public static String createConnectorDescription()
- {
- return createConnectorDescription(JVMConstants.DEFAULT_NAME);
- }
-
- public static String createConnectorDescription(String name)
- {
- return createConnectorDescription(null, name);
- }
-
- public static String createConnectorDescription(String userName, String name)
- {
- Object[] elements = { userName, name };
- return DescriptionUtil.getDescription(JVMConstants.TYPE, elements);
- }
-}
diff --git a/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF
index c304620..cbe248a 100644
--- a/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.tcp/META-INF/MANIFEST.MF
@@ -1,14 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.net4j.tcp
+Bundle-SymbolicName: org.eclipse.net4j.tcp;singleton:=true
Bundle-Version: 0.8.0.qualifier
Bundle-Activator: org.eclipse.net4j.internal.tcp.bundle.TCP$Activator
Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.net4j;visibility:=reexport
-Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime;resolution:=optional,
+ org.eclipse.net4j;visibility:=reexport
Import-Package: org.osgi.framework;version="1.3.0";resolution:=optional
Export-Package: org.eclipse.net4j.internal.tcp;version="0.8.0",
org.eclipse.net4j.internal.tcp.bundle;version="0.8.0",
org.eclipse.net4j.tcp;version="0.8.0"
+Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.net4j.tcp/build.properties b/plugins/org.eclipse.net4j.tcp/build.properties
index d801b47..5e316ac 100644
--- a/plugins/org.eclipse.net4j.tcp/build.properties
+++ b/plugins/org.eclipse.net4j.tcp/build.properties
@@ -3,4 +3,5 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
.options,\
- plugin.properties
+ plugin.properties,\
+ plugin.xml
diff --git a/plugins/org.eclipse.net4j.tcp/plugin.xml b/plugins/org.eclipse.net4j.tcp/plugin.xml
new file mode 100644
index 0000000..c57536b
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tcp/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<plugin>
+
+ <extension
+ point="org.eclipse.net4j.factories">
+ <factory
+ class="org.eclipse.net4j.internal.tcp.TCPAcceptorFactory"
+ productGroup="org.eclipse.net4j.acceptors"
+ type="tcp"/>
+ <factory
+ class="org.eclipse.net4j.internal.tcp.TCPConnectorFactory"
+ productGroup="org.eclipse.net4j.connectors"
+ type="tcp"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannelImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
index 5b22de2..f6ebc36 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannelImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
/**
* @author Eike Stepper
*/
-public final class ControlChannelImpl extends Channel
+public final class ControlChannel extends Channel
{
public static final short CONTROL_CHANNEL_ID = -1;
@@ -40,11 +40,11 @@ public final class ControlChannelImpl extends Channel
public static final byte FAILURE = 0;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL, ControlChannelImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL, ControlChannel.class);
private SynchronizingCorrelator<Short, Boolean> registrations = new SynchronizingCorrelator();
- public ControlChannelImpl(AbstractTCPConnector connector)
+ public ControlChannel(TCPConnector connector)
{
super(connector.getReceiveExecutor());
setChannelIndex(CONTROL_CHANNEL_ID);
@@ -101,7 +101,7 @@ public final class ControlChannelImpl extends Channel
{
byte[] handlerFactoryUTF8 = BufferUtil.getByteArray(byteBuffer);
String protocolID = BufferUtil.fromUTF8(handlerFactoryUTF8);
- Channel channel = ((AbstractTCPConnector)getConnector()).createChannel(channelIndex, protocolID, null);
+ Channel channel = ((TCPConnector)getConnector()).createChannel(channelIndex, protocolID);
if (channel != null)
{
channel.activate();
@@ -136,7 +136,7 @@ public final class ControlChannelImpl extends Channel
try
{
- Channel channel = ((AbstractTCPConnector)getConnector()).getChannel(channelIndex);
+ Channel channel = ((TCPConnector)getConnector()).getChannel(channelIndex);
if (channel != null)
{
channel.deactivate();
@@ -159,7 +159,7 @@ public final class ControlChannelImpl extends Channel
default:
Net4j.LOG.error("Invalid opcode: " + opcode); //$NON-NLS-1$
- ((AbstractTCPConnector)getConnector()).deactivate();
+ ((TCPConnector)getConnector()).deactivate();
}
}
finally
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
index a0c5d17..bf34cfc 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java
@@ -10,20 +10,18 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.tcp.TCPAcceptor;
-import org.eclipse.net4j.tcp.TCPSelector;
-import org.eclipse.net4j.tcp.TCPSelectorListener;
-import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.tcp.ITCPAcceptor;
+import org.eclipse.net4j.tcp.ITCPSelector;
+import org.eclipse.net4j.tcp.ITCPSelectorListener;
+import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.transport.Acceptor;
-import org.eclipse.internal.net4j.transport.DescriptionUtil;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
-import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.ServerSocketChannel;
@@ -34,13 +32,11 @@ import java.util.concurrent.CountDownLatch;
/**
* @author Eike Stepper
*/
-public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelectorListener.Passive
+public class TCPAcceptor extends Acceptor implements ITCPAcceptor, ITCPSelectorListener.Passive
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, TCPAcceptorImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, TCPAcceptor.class);
- private static final String DEFAULT_ADDRESS = "0.0.0.0";
-
- private TCPSelectorImpl selector;
+ private TCPSelector selector;
private SelectionKey selectionKey;
@@ -54,7 +50,7 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
private int port;
- public TCPAcceptorImpl()
+ public TCPAcceptor()
{
}
@@ -63,17 +59,27 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
return address;
}
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
public int getPort()
{
return port;
}
- public TCPSelectorImpl getSelector()
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+ public TCPSelector getSelector()
{
return selector;
}
- public void setSelector(TCPSelectorImpl selector)
+ public void setSelector(TCPSelector selector)
{
this.selector = selector;
}
@@ -102,7 +108,7 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
}
}
- public void handleAccept(TCPSelector selector, ServerSocketChannel serverSocketChannel)
+ public void handleAccept(ITCPSelector selector, ServerSocketChannel serverSocketChannel)
{
try
{
@@ -115,7 +121,7 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
}
socketChannel.configureBlocking(false);
- ServerTCPConnectorImpl connector = createConnector(socketChannel);
+ TCPServerConnector connector = createConnector(socketChannel);
addConnector(connector);
}
}
@@ -137,19 +143,13 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
@Override
public String toString()
{
- return MessageFormat.format("TCPAcceptor[{0}]", getDescription()); //$NON-NLS-1$
+ return MessageFormat.format("TCPAcceptor[{0}:{1}]", address, port); //$NON-NLS-1$
}
- protected ServerTCPConnectorImpl createConnector(SocketChannel socketChannel)
+ protected TCPServerConnector createConnector(SocketChannel socketChannel)
{
- String description = createConnectorDescription(socketChannel);
-
- ServerTCPConnectorImpl connector = new ServerTCPConnectorImpl();
- connector.setDescription(description);
+ TCPServerConnector connector = new TCPServerConnector();
connector.setSocketChannel(socketChannel);
- connector.setReceiveExecutor(getReceiveExecutor());
- connector.setProtocolFactoryRegistry(getProtocolFactoryRegistry());
- connector.setBufferProvider(getBufferProvider());
connector.setSelector(selector);
return connector;
}
@@ -158,20 +158,9 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
- if (getDescription() == null)
+ if (StringUtil.isEmpty(address))
{
- throw new IllegalStateException("description == null"); //$NON-NLS-1$
- }
- else
- {
- String[] elements = DescriptionUtil.getElements(getDescription());
- address = elements[1];
- if (address.length() == 0)
- {
- address = DEFAULT_ADDRESS;
- }
-
- port = Integer.parseInt(elements[2]);
+ throw new IllegalStateException("No address"); //$NON-NLS-1$
}
if (selector == null)
@@ -230,24 +219,4 @@ public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelecto
serverSocketChannel.close();
super.doDeactivate();
}
-
- private String createConnectorDescription(SocketChannel socketChannel)
- {
- SocketAddress addr = socketChannel.socket().getRemoteSocketAddress();
- String host = addr.toString();
- if (host.startsWith("/"))
- {
- host = host.substring(1);
- }
-
- int port = 0;
- int colon = host.indexOf(':');
- if (colon != -1)
- {
- port = Integer.parseInt(host.substring(colon + 1));
- host = host.substring(0, colon);
- }
-
- return TCPUtil.createConnectorDescription(host, port);
- }
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactory.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactory.java
new file mode 100644
index 0000000..e7ae40e
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactory.java
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.tcp;
+
+import org.eclipse.net4j.tcp.ITCPConstants;
+import org.eclipse.net4j.util.StringUtil;
+
+import org.eclipse.internal.net4j.transport.AcceptorFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class TCPAcceptorFactory extends AcceptorFactory<TCPAcceptor>
+{
+ public static final String SEPARATOR = ":"; //$NON-NLS-1$
+
+ public TCPAcceptorFactory()
+ {
+ super(ITCPConstants.TYPE);
+ }
+
+ public TCPAcceptor create(String description)
+ {
+ String address = ITCPConstants.DEFAULT_ADDRESS;
+ int port = ITCPConstants.DEFAULT_PORT;
+
+ if (!StringUtil.isEmpty(description))
+ {
+ String[] tokens = description.split(SEPARATOR);
+ if (!StringUtil.isEmpty(tokens[0]))
+ {
+ address = tokens[0];
+ }
+
+ if (tokens.length > 1 && !StringUtil.isEmpty(tokens[1]))
+ {
+ port = Integer.parseInt(tokens[1]);
+ }
+ }
+
+ TCPAcceptor acceptor = new TCPAcceptor();
+ acceptor.setAddress(address);
+ acceptor.setPort(port);
+ return acceptor;
+ }
+
+ @Override
+ public String getDescriptionFor(TCPAcceptor acceptor)
+ {
+ return acceptor.getAddress() + SEPARATOR + acceptor.getPort();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ClientTCPConnectorImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPClientConnector.java
index f126cc3..6efdfbc 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ClientTCPConnectorImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPClientConnector.java
@@ -23,9 +23,9 @@ import java.text.MessageFormat;
/**
* @author Eike Stepper
*/
-public class ClientTCPConnectorImpl extends AbstractTCPConnector
+public class TCPClientConnector extends TCPConnector
{
- public ClientTCPConnectorImpl()
+ public TCPClientConnector()
{
try
{
@@ -58,6 +58,21 @@ public class ClientTCPConnectorImpl extends AbstractTCPConnector
}
@Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ if (getHost() == null)
+ {
+ throw new IllegalStateException("host == null");
+ }
+
+ if (getPort() == 0)
+ {
+ throw new IllegalStateException("port == 0");
+ }
+ }
+
+ @Override
protected void doActivate() throws Exception
{
super.doActivate();
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/AbstractTCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
index 70871ec..fb3cd2d 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/AbstractTCPConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnector.java
@@ -10,9 +10,9 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.tcp.TCPConnector;
-import org.eclipse.net4j.tcp.TCPSelector;
-import org.eclipse.net4j.tcp.TCPSelectorListener;
+import org.eclipse.net4j.tcp.ITCPConnector;
+import org.eclipse.net4j.tcp.ITCPSelector;
+import org.eclipse.net4j.tcp.ITCPSelectorListener;
import org.eclipse.net4j.transport.ConnectorException;
import org.eclipse.net4j.transport.ConnectorState;
import org.eclipse.net4j.transport.IBuffer;
@@ -33,25 +33,25 @@ import java.util.Queue;
/**
* @author Eike Stepper
*/
-public abstract class AbstractTCPConnector extends Connector implements TCPConnector, TCPSelectorListener.Active
+public abstract class TCPConnector extends Connector implements ITCPConnector, ITCPSelectorListener.Active
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, AbstractTCPConnector.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, TCPConnector.class);
private SocketChannel socketChannel;
- private TCPSelector selector;
+ private ITCPSelector selector;
private SelectionKey selectionKey;
private IBuffer inputBuffer;
- private ControlChannelImpl controlChannel;
+ private ControlChannel controlChannel;
private String host;
private int port;
- public AbstractTCPConnector()
+ public TCPConnector()
{
}
@@ -60,17 +60,27 @@ public abstract class AbstractTCPConnector extends Connector implements TCPConne
return host;
}
+ void setHost(String host)
+ {
+ this.host = host;
+ }
+
public int getPort()
{
return port;
}
- public TCPSelector getSelector()
+ void setPort(int port)
+ {
+ this.port = port;
+ }
+
+ public ITCPSelector getSelector()
{
return selector;
}
- public void setSelector(TCPSelector selector)
+ public void setSelector(ITCPSelector selector)
{
this.selector = selector;
}
@@ -108,7 +118,7 @@ public abstract class AbstractTCPConnector extends Connector implements TCPConne
}
}
- public void handleConnect(TCPSelector selector, SocketChannel channel)
+ public void handleConnect(ITCPSelector selector, SocketChannel channel)
{
try
{
@@ -135,7 +145,7 @@ public abstract class AbstractTCPConnector extends Connector implements TCPConne
}
}
- public void handleRead(TCPSelector selector, SocketChannel socketChannel)
+ public void handleRead(ITCPSelector selector, SocketChannel socketChannel)
{
try
{
@@ -148,8 +158,7 @@ public abstract class AbstractTCPConnector extends Connector implements TCPConne
if (byteBuffer != null)
{
short channelIndex = inputBuffer.getChannelIndex();
- Channel channel = channelIndex == ControlChannelImpl.CONTROL_CHANNEL_ID ? controlChannel
- : getChannel(channelIndex);
+ Channel channel = channelIndex == ControlChannel.CONTROL_CHANNEL_ID ? controlChannel : getChannel(channelIndex);
if (channel != null)
{
channel.handleBufferFromMultiplexer(inputBuffer);
@@ -178,7 +187,7 @@ public abstract class AbstractTCPConnector extends Connector implements TCPConne
}
}
- public void handleWrite(TCPSelector selector, SocketChannel socketChannel)
+ public void handleWrite(ITCPSelector selector, SocketChannel socketChannel)
{
try
{
@@ -284,23 +293,13 @@ public abstract class AbstractTCPConnector extends Connector implements TCPConne
{
throw new IllegalStateException("selector == null");
}
-
- if (host == null)
- {
- throw new IllegalStateException("host == null");
- }
-
- if (port == 0)
- {
- throw new IllegalStateException("port == 0");
- }
}
@Override
protected void doActivate() throws Exception
{
super.doActivate();
- controlChannel = new ControlChannelImpl(this);
+ controlChannel = new ControlChannel(this);
controlChannel.activate();
selector.registerAsync(socketChannel, this);
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactory.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactory.java
new file mode 100644
index 0000000..1b93924
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactory.java
@@ -0,0 +1,78 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.tcp;
+
+import org.eclipse.net4j.tcp.ITCPConstants;
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.factory.ProductCreationException;
+
+import org.eclipse.internal.net4j.transport.ConnectorFactory;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * @author Eike Stepper
+ */
+public class TCPConnectorFactory extends ConnectorFactory<TCPClientConnector>
+{
+ private static final String URL_SCHEME = "http://";
+
+ public TCPConnectorFactory()
+ {
+ super(ITCPConstants.TYPE);
+ }
+
+ public TCPClientConnector create(String description)
+ {
+ try
+ {
+ // TODO Don't use URL
+ URL url = new URL(URL_SCHEME + description);
+ String userID = url.getUserInfo();
+ String host = url.getHost();
+ int port = url.getPort();
+ if (port == -1)
+ {
+ port = ITCPConstants.DEFAULT_PORT;
+ }
+
+ TCPClientConnector connector = new TCPClientConnector();
+ connector.setUserID(userID);
+ connector.setHost(host);
+ connector.setPort(port);
+ return connector;
+ }
+ catch (MalformedURLException ex)
+ {
+ throw new ProductCreationException(ex);
+ }
+ }
+
+ @Override
+ public String getDescriptionFor(TCPClientConnector connector)
+ {
+ String description = connector.getHost();
+ String userID = connector.getUserID();
+ if (!StringUtil.isEmpty(userID))
+ {
+ description = userID + "@" + description;
+ }
+
+ int port = connector.getPort();
+ if (port != ITCPConstants.DEFAULT_PORT)
+ {
+ description = description + ":" + port;
+ }
+
+ return description;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
index aeaa54c..75c47cc 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelector.java
@@ -10,10 +10,10 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.tcp.TCPSelector;
-import org.eclipse.net4j.tcp.TCPSelectorListener;
-import org.eclipse.net4j.tcp.TCPSelectorListener.Active;
-import org.eclipse.net4j.tcp.TCPSelectorListener.Passive;
+import org.eclipse.net4j.tcp.ITCPSelector;
+import org.eclipse.net4j.tcp.ITCPSelectorListener;
+import org.eclipse.net4j.tcp.ITCPSelectorListener.Active;
+import org.eclipse.net4j.tcp.ITCPSelectorListener.Passive;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
@@ -35,9 +35,9 @@ import java.util.concurrent.ConcurrentLinkedQueue;
/**
* @author Eike Stepper
*/
-public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
+public class TCPSelector extends Lifecycle implements ITCPSelector, Runnable
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SELECTOR, TCPSelectorImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SELECTOR, TCPSelector.class);
private Selector selector;
@@ -45,7 +45,7 @@ public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
private Thread thread;
- public TCPSelectorImpl()
+ public TCPSelector()
{
}
@@ -224,7 +224,7 @@ public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
if (channel instanceof ServerSocketChannel)
{
ServerSocketChannel ssChannel = (ServerSocketChannel)selKey.channel();
- TCPSelectorListener.Passive listener = (TCPSelectorListener.Passive)selKey.attachment();
+ ITCPSelectorListener.Passive listener = (ITCPSelectorListener.Passive)selKey.attachment();
if (selKey.isAcceptable())
{
@@ -239,7 +239,7 @@ public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
else if (channel instanceof SocketChannel)
{
SocketChannel sChannel = (SocketChannel)channel;
- TCPSelectorListener.Active listener = (TCPSelectorListener.Active)selKey.attachment();
+ ITCPSelectorListener.Active listener = (ITCPSelectorListener.Active)selKey.attachment();
if (selKey.isConnectable())
{
@@ -334,7 +334,7 @@ public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
}
}
- private void doRegister(final ServerSocketChannel channel, final TCPSelectorListener.Passive listener)
+ private void doRegister(final ServerSocketChannel channel, final ITCPSelectorListener.Passive listener)
{
if (TRACER.isEnabled())
{
@@ -353,7 +353,7 @@ public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
}
}
- private void doRegister(final SocketChannel channel, final TCPSelectorListener.Active listener)
+ private void doRegister(final SocketChannel channel, final ITCPSelectorListener.Active listener)
{
if (TRACER.isEnabled())
{
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactoryImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorFactory.java
index 1330087..8ba166f 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorFactory.java
@@ -10,21 +10,25 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.tcp.TCPConstants;
-import org.eclipse.net4j.transport.IAcceptor;
+import org.eclipse.net4j.tcp.ITCPConstants;
+
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.factory.Factory;
/**
* @author Eike Stepper
*/
-public class TCPAcceptorFactoryImpl implements IAcceptorFactory
+public class TCPSelectorFactory extends Factory<TCPSelector>
{
- public String getType()
+ public static final String SELECTOR_GROUP = Net4j.BUNDLE_ID + ".selectors";
+
+ public TCPSelectorFactory()
{
- return TCPConstants.TYPE;
+ super(SELECTOR_GROUP, ITCPConstants.TYPE);
}
- public IAcceptor createAcceptor()
+ public TCPSelector create(String description)
{
- return new TCPAcceptorImpl();
+ return new TCPSelector();
}
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorInjector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorInjector.java
new file mode 100644
index 0000000..aaf25e1
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorInjector.java
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.internal.tcp;
+
+import org.eclipse.net4j.tcp.ITCPConstants;
+import org.eclipse.net4j.util.container.IElementProcessor;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public class TCPSelectorInjector implements IElementProcessor
+{
+ public TCPSelectorInjector()
+ {
+ }
+
+ public Object process(IManagedContainer container, String productGroup, String factoryType, String description,
+ Object element)
+ {
+ if (element instanceof TCPAcceptor)
+ {
+ TCPAcceptor acceptor = (TCPAcceptor)element;
+ acceptor.setSelector(getSelector(container));
+ }
+ else if (element instanceof TCPConnector)
+ {
+ TCPConnector connector = (TCPConnector)element;
+ connector.setSelector(getSelector(container));
+ }
+
+ return element;
+ }
+
+ protected TCPSelector getSelector(IManagedContainer container)
+ {
+ return (TCPSelector)container.getElement(TCPSelectorFactory.SELECTOR_GROUP, ITCPConstants.TYPE, null);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ServerTCPConnectorImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java
index 217276a..2ba8f66 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ServerTCPConnectorImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java
@@ -17,9 +17,9 @@ import java.text.MessageFormat;
/**
* @author Eike Stepper
*/
-public class ServerTCPConnectorImpl extends AbstractTCPConnector
+public class TCPServerConnector extends TCPConnector
{
- public ServerTCPConnectorImpl()
+ public TCPServerConnector()
{
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptor.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java
index b3a65f4..019a88f 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptor.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPAcceptor.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.transport.IAcceptor;
/**
* @author Eike Stepper
*/
-public interface TCPAcceptor extends IAcceptor
+public interface ITCPAcceptor extends IAcceptor
{
public String getAddress();
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPConnector.java
index 0ee76dc..7029168 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPConnector.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.transport.IConnector;
/**
* @author Eike Stepper
*/
-public interface TCPConnector extends IConnector
+public interface ITCPConnector extends IConnector
{
public String getHost();
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConstants.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPConstants.java
index 5637c77..1677120 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConstants.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPConstants.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.tcp;
/**
* @author Eike Stepper
*/
-public interface TCPConstants
+public interface ITCPConstants
{
public static final String TYPE = "tcp";
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPSelector.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java
index 493eead..a776e66 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPSelector.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelector.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.tcp;
-import org.eclipse.net4j.tcp.TCPSelectorListener.Active;
-import org.eclipse.net4j.tcp.TCPSelectorListener.Passive;
+import org.eclipse.net4j.tcp.ITCPSelectorListener.Active;
+import org.eclipse.net4j.tcp.ITCPSelectorListener.Passive;
import java.nio.channels.SelectionKey;
import java.nio.channels.ServerSocketChannel;
@@ -20,7 +20,7 @@ import java.nio.channels.SocketChannel;
/**
* @author Eike Stepper
*/
-public interface TCPSelector
+public interface ITCPSelector
{
public void invokeAsync(Runnable operation);
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPSelectorListener.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelectorListener.java
index 7bf7290..6eeec06 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPSelectorListener.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/ITCPSelectorListener.java
@@ -17,27 +17,27 @@ import java.nio.channels.SocketChannel;
/**
* @author Eike Stepper
*/
-public interface TCPSelectorListener
+public interface ITCPSelectorListener
{
public void registered(SelectionKey selectionKey);
/**
* @author Eike Stepper
*/
- public interface Passive extends TCPSelectorListener
+ public interface Passive extends ITCPSelectorListener
{
- public void handleAccept(TCPSelector selector, ServerSocketChannel serverSocketChannel);
+ public void handleAccept(ITCPSelector selector, ServerSocketChannel serverSocketChannel);
}
/**
* @author Eike Stepper
*/
- public interface Active extends TCPSelectorListener
+ public interface Active extends ITCPSelectorListener
{
- public void handleConnect(TCPSelector selector, SocketChannel channel);
+ public void handleConnect(ITCPSelector selector, SocketChannel channel);
- public void handleRead(TCPSelector selector, SocketChannel socketChannel);
+ public void handleRead(ITCPSelector selector, SocketChannel socketChannel);
- public void handleWrite(TCPSelector selector, SocketChannel socketChannel);
+ public void handleWrite(ITCPSelector selector, SocketChannel socketChannel);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPUtil.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPUtil.java
deleted file mode 100644
index ceb5456..0000000
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPUtil.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
- * 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:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.tcp;
-
-import org.eclipse.internal.net4j.transport.DescriptionUtil;
-
-/**
- * @author Eike Stepper
- */
-public final class TCPUtil
-{
- private TCPUtil()
- {
- }
-
- public static String createAcceptorDescription()
- {
- return createAcceptorDescription(TCPConstants.DEFAULT_ADDRESS);
- }
-
- public static String createAcceptorDescription(String address)
- {
- return createAcceptorDescription(address, TCPConstants.DEFAULT_PORT);
- }
-
- public static String createAcceptorDescription(String address, int port)
- {
- Object[] elements = { address, port };
- return DescriptionUtil.getDescription(TCPConstants.TYPE, elements);
- }
-
- public static String createConnectorDescription(String host)
- {
- return createConnectorDescription(null, host);
- }
-
- public static String createConnectorDescription(String host, int port)
- {
- return createConnectorDescription(null, host, port);
- }
-
- public static String createConnectorDescription(String userName, String host)
- {
- return createConnectorDescription(userName, host, TCPConstants.DEFAULT_PORT);
- }
-
- public static String createConnectorDescription(String userName, String host, int port)
- {
- Object[] elements = { userName, host, port };
- return DescriptionUtil.getDescription(TCPConstants.TYPE, elements);
- }
-}
diff --git a/plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF
index a6c9bc6..ce95c3b 100644
--- a/plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF
@@ -8,5 +8,8 @@ Bundle-Activator: org.eclipse.net4j.tests.bundle.Activator
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime,
- org.junit,
- org.eclipse.net4j.tcp.container;visibility:=reexport
+ org.junit;visibility:=reexport,
+ org.eclipse.net4j.tcp;visibility:=reexport
+Export-Package: org.eclipse.net4j.tests,
+ org.eclipse.net4j.tests.bundle,
+ org.eclipse.net4j.tests.signal
diff --git a/plugins/org.eclipse.net4j.tests/Net4j SignalTest.launch b/plugins/org.eclipse.net4j.tests/Net4j SignalTest.launch
index 28f2362..666182b 100644
--- a/plugins/org.eclipse.net4j.tests/Net4j SignalTest.launch
+++ b/plugins/org.eclipse.net4j.tests/Net4j SignalTest.launch
@@ -5,10 +5,10 @@
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.net4j.tests"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
+<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.net4j.tests"/>
+<listEntry value="/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTCPTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
index 47f58ab..4f24c48 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTCPTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
@@ -10,27 +10,26 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.container.Container;
-import org.eclipse.net4j.container.ContainerUtil;
-import org.eclipse.net4j.tcp.TCPUtil;
-import org.eclipse.net4j.tcp.internal.container.TCPContainerAdapterFactoryImpl;
+import org.eclipse.net4j.internal.tcp.TCPAcceptorFactory;
+import org.eclipse.net4j.internal.tcp.TCPConnectorFactory;
+import org.eclipse.net4j.internal.tcp.TCPSelectorFactory;
+import org.eclipse.net4j.internal.tcp.TCPSelectorInjector;
+import org.eclipse.net4j.tcp.ITCPConstants;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.internal.net4j.transport.Acceptor;
import org.eclipse.internal.net4j.transport.Connector;
+import org.eclipse.internal.net4j.transport.TransportContainer;
/**
* @author Eike Stepper
*/
-public abstract class AbstractTCPTest extends AbstractOMTest
+public abstract class AbstractTransportTest extends AbstractOMTest
{
- protected static final String ACCEPTOR_DESCRIPTION = TCPUtil.createAcceptorDescription();
+ protected static final String HOST = "localhost";
- protected static final String CONNECTOR_DESCRIPTION = TCPUtil.createConnectorDescription("localhost");
+ protected TransportContainer container;
- protected Container container;
-
- @SuppressWarnings("unused")
private Acceptor acceptor;
private Connector connector;
@@ -70,14 +69,13 @@ public abstract class AbstractTCPTest extends AbstractOMTest
}
}
- protected Container createContainer()
+ protected TransportContainer createContainer()
{
- Container container = ContainerUtil.createContainer();
- if (container != null)
- {
- container.register(new TCPContainerAdapterFactoryImpl());
- }
-
+ TransportContainer container = new TransportContainer();
+ container.registerFactory(new TCPSelectorFactory());
+ container.registerFactory(new TCPAcceptorFactory());
+ container.registerFactory(new TCPConnectorFactory());
+ container.addPostProcessor(new TCPSelectorInjector());
return container;
}
@@ -85,7 +83,7 @@ public abstract class AbstractTCPTest extends AbstractOMTest
{
if (acceptor == null)
{
- acceptor = (Acceptor)container.getAcceptor(ACCEPTOR_DESCRIPTION);
+ acceptor = container.getAcceptor(ITCPConstants.TYPE, null);
}
return acceptor;
@@ -95,18 +93,21 @@ public abstract class AbstractTCPTest extends AbstractOMTest
{
if (connector == null)
{
- connector = (Connector)container.getConnector(CONNECTOR_DESCRIPTION);
+ connector = container.getConnector(ITCPConstants.TYPE, HOST);
}
return connector;
}
- protected void startTransport()
+ protected void startTransport() throws Exception
{
if (container != null)
{
- assertTrue(getAcceptor().isActive());
- assertTrue(getConnector().isActive());
+ Acceptor acceptor = getAcceptor();
+ acceptor.activate();
+
+ Connector connector = getConnector();
+ connector.activate();
}
}
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
index b123ca4..94b685a 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
@@ -10,31 +10,33 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.container.Container;
import org.eclipse.net4j.tests.signal.Request1;
import org.eclipse.net4j.tests.signal.Request2;
import org.eclipse.net4j.tests.signal.TestSignalProtocol;
+import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.internal.net4j.transport.TransportContainer;
+
import java.util.Arrays;
/**
* @author Eike Stepper
*/
-public class SignalTest extends AbstractTCPTest
+public class SignalTest extends AbstractTransportTest
{
@Override
- protected Container createContainer()
+ protected TransportContainer createContainer()
{
- Container container = super.createContainer();
- container.register(new TestSignalProtocol.Factory());
+ TransportContainer container = super.createContainer();
+ container.registerFactory(new TestSignalServerProtocolFactory());
return container;
}
public void testInteger() throws Exception
{
startTransport();
- IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_ID);
+ IChannel channel = getConnector().openChannel(TestSignalProtocol.TYPE);
int data = 0x0a;
int result = new Request1(channel, data).send();
assertEquals(data, result);
@@ -43,7 +45,7 @@ public class SignalTest extends AbstractTCPTest
public void testArray() throws Exception
{
startTransport();
- IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_ID);
+ IChannel channel = getConnector().openChannel(TestSignalProtocol.TYPE);
byte[] data = TinyData.getBytes();
byte[] result = new Request2(channel, data).send();
assertTrue(Arrays.equals(data, result));
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java
index 4f3841f..1fc924e 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java
@@ -10,11 +10,10 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.container.Container;
import org.eclipse.net4j.stream.ChannelInputStream;
import org.eclipse.net4j.stream.ChannelOutputStream;
-import org.eclipse.net4j.tests.signal.TestSignalProtocol;
-import org.eclipse.net4j.transport.IAcceptorAcceptedEvent;
+import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
+import org.eclipse.net4j.transport.IAcceptorEvent;
import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.transport.IConnectorChannelsEvent;
@@ -22,6 +21,8 @@ import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.internal.net4j.transport.TransportContainer;
+
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -36,13 +37,13 @@ import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
*/
-public class TCPTransportTest extends AbstractTCPTest
+public class TCPTransportTest extends AbstractTransportTest
{
@Override
- protected Container createContainer()
+ protected TransportContainer createContainer()
{
- Container container = super.createContainer();
- container.register(new TestSignalProtocol.Factory());
+ TransportContainer container = super.createContainer();
+ container.registerFactory(new TestSignalServerProtocolFactory());
return container;
}
@@ -73,10 +74,10 @@ public class TCPTransportTest extends AbstractTCPTest
{
final int COUNT = 3;
final CountDownLatch counter = new CountDownLatch(COUNT);
- container.register(new TestProtocolFactory(counter));
+ container.registerFactory(new TestProtocolFactory(counter));
startTransport();
- IChannel channel = getConnector().openChannel(TestProtocolFactory.PROTOCOL_ID);
+ IChannel channel = getConnector().openChannel(TestProtocolFactory.TYPE);
for (int i = 0; i < COUNT; i++)
{
IBuffer buffer = provideBuffer();
@@ -154,9 +155,9 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof IAcceptorAcceptedEvent)
+ if (event instanceof IAcceptorEvent)
{
- IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ IAcceptorEvent e = (IAcceptorEvent)event;
e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
@@ -217,9 +218,9 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof IAcceptorAcceptedEvent)
+ if (event instanceof IAcceptorEvent)
{
- IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ IAcceptorEvent e = (IAcceptorEvent)event;
e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
@@ -283,9 +284,9 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof IAcceptorAcceptedEvent)
+ if (event instanceof IAcceptorEvent)
{
- IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ IAcceptorEvent e = (IAcceptorEvent)event;
e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
@@ -311,6 +312,7 @@ public class TCPTransportTest extends AbstractTCPTest
new Thread()
{
+ @Override
public void run()
{
try
@@ -363,9 +365,9 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof IAcceptorAcceptedEvent)
+ if (event instanceof IAcceptorEvent)
{
- IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ IAcceptorEvent e = (IAcceptorEvent)event;
e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocol.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocol.java
new file mode 100644
index 0000000..ae1e624
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocol.java
@@ -0,0 +1,32 @@
+package org.eclipse.net4j.tests;
+
+import org.eclipse.net4j.transport.IBuffer;
+
+import org.eclipse.internal.net4j.transport.Protocol;
+
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author Eike Stepper
+ */
+public final class TestProtocol extends Protocol
+{
+ private CountDownLatch counter;
+
+ public TestProtocol(CountDownLatch counter)
+ {
+ this.counter = counter;
+ }
+
+ public String getType()
+ {
+ return TestProtocolFactory.TYPE;
+ }
+
+ public void handleBuffer(IBuffer buffer)
+ {
+ System.out.println("BUFFER ARRIVED");
+ buffer.release();
+ counter.countDown();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocolFactory.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocolFactory.java
index 042ebd9..0637646 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocolFactory.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocolFactory.java
@@ -10,67 +10,29 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.IBuffer;
-import org.eclipse.net4j.transport.IChannel;
-import org.eclipse.net4j.transport.IProtocol;
-import org.eclipse.net4j.transport.IProtocolFactory;
+import org.eclipse.net4j.util.factory.ProductCreationException;
-import org.eclipse.internal.net4j.transport.Protocol;
-import org.eclipse.internal.net4j.transport.ProtocolFactory;
+import org.eclipse.internal.net4j.transport.ServerProtocolFactory;
-import java.util.Set;
import java.util.concurrent.CountDownLatch;
/**
* @author Eike Stepper
*/
-public class TestProtocolFactory extends ProtocolFactory implements IProtocolFactory
+public class TestProtocolFactory extends ServerProtocolFactory<TestProtocol>
{
- public static final String PROTOCOL_ID = "test.protocol";
+ public static final String TYPE = "test.protocol";
private CountDownLatch counter;
public TestProtocolFactory(CountDownLatch counter)
{
+ super(TYPE);
this.counter = counter;
}
- public String getProtocolID()
+ public TestProtocol create(String description) throws ProductCreationException
{
- return PROTOCOL_ID;
- }
-
- public Set<ConnectorLocation> getLocations()
- {
- return IProtocolFactory.SYMMETRIC;
- }
-
- public IProtocol createProtocol(IChannel channel, Object protocolData)
- {
- return new TestProtocol(channel);
- }
-
- /**
- * @author Eike Stepper
- */
- private final class TestProtocol extends Protocol
- {
- public TestProtocol(IChannel channel)
- {
- super(channel);
- }
-
- public String getProtocolID()
- {
- return PROTOCOL_ID;
- }
-
- public void handleBuffer(IBuffer buffer)
- {
- System.out.println("BUFFER ARRIVED");
- buffer.release();
- counter.countDown();
- }
+ return new TestProtocol(counter);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java
index 4b4d72b..8749840 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java
@@ -12,38 +12,25 @@ package org.eclipse.net4j.tests.signal;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
-import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.IChannel;
-import org.eclipse.net4j.transport.IProtocol;
-import org.eclipse.net4j.transport.IProtocolFactory;
-
-import org.eclipse.internal.net4j.transport.ProtocolFactory;
-
-import java.util.Set;
/**
* @author Eike Stepper
*/
public class TestSignalProtocol extends SignalProtocol
{
- public static final String PROTOCOL_ID = "signal.protocol";
+ public static final String TYPE = "signal.protocol";
public static final short SIGNAL1 = 1;
public static final short SIGNAL2 = 2;
- public static final short SIGNAL3 = 3;
-
- public static final short SIGNAL4 = 4;
-
- public TestSignalProtocol(IChannel channel)
+ public TestSignalProtocol()
{
- super(channel);
}
- public String getProtocolID()
+ public String getType()
{
- return PROTOCOL_ID;
+ return TYPE;
}
@Override
@@ -59,25 +46,4 @@ public class TestSignalProtocol extends SignalProtocol
throw new IllegalArgumentException("Invalid signalID " + signalID);
}
-
- /**
- * @author Eike Stepper
- */
- public static class Factory extends ProtocolFactory
- {
- public String getProtocolID()
- {
- return PROTOCOL_ID;
- }
-
- public Set<ConnectorLocation> getLocations()
- {
- return IProtocolFactory.SYMMETRIC;
- }
-
- public IProtocol createProtocol(IChannel channel, Object protocolData)
- {
- return new TestSignalProtocol(channel);
- }
- }
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java
new file mode 100644
index 0000000..c4cc159
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java
@@ -0,0 +1,21 @@
+package org.eclipse.net4j.tests.signal;
+
+import org.eclipse.net4j.util.factory.ProductCreationException;
+
+import org.eclipse.internal.net4j.transport.ServerProtocolFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class TestSignalServerProtocolFactory extends ServerProtocolFactory<TestSignalProtocol>
+{
+ public TestSignalServerProtocolFactory()
+ {
+ super(TestSignalProtocol.TYPE);
+ }
+
+ public TestSignalProtocol create(String description) throws ProductCreationException
+ {
+ return new TestSignalProtocol();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index 3edb1de..b82768c 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -1,12 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.net4j
+Bundle-SymbolicName: org.eclipse.net4j;singleton:=true
Bundle-Version: 0.8.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.internal.net4j.bundle.Net4j$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime;resolution:=optional
Import-Package: org.eclipse.osgi.service.debug;version="1.0.0";resolution:=optional,
org.osgi.framework;version="1.3.0";resolution:=optional,
org.osgi.service.log;version="1.3.0";resolution:=optional,
@@ -40,4 +41,3 @@ Export-Package: org.eclipse.internal.net4j.bundle;version="0.8.0",
org.eclipse.net4j.util.registry;version="0.8.0",
org.eclipse.net4j.util.stream;version="0.8.0"
Eclipse-LazyStart: true
-Require-Bundle: org.eclipse.core.runtime;resolution:=optional
diff --git a/plugins/org.eclipse.net4j/TODOS.txt b/plugins/org.eclipse.net4j/TODOS.txt
deleted file mode 100644
index fe0d4a2..0000000
--- a/plugins/org.eclipse.net4j/TODOS.txt
+++ /dev/null
@@ -1 +0,0 @@
-SSL
diff --git a/plugins/org.eclipse.net4j/build.properties b/plugins/org.eclipse.net4j/build.properties
index 666d03a..72ff082 100644
--- a/plugins/org.eclipse.net4j/build.properties
+++ b/plugins/org.eclipse.net4j/build.properties
@@ -7,4 +7,6 @@ bin.includes = META-INF/,\
about.html,\
copyright.txt,\
epl-v10.html,\
- license.html
+ license.html,\
+ plugin.xml,\
+ schema/
diff --git a/plugins/org.eclipse.net4j/javadoc.xml b/plugins/org.eclipse.net4j/javadoc.xml
deleted file mode 100644
index f439bd5..0000000
--- a/plugins/org.eclipse.net4j/javadoc.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
- 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:
- Eike Stepper - Initial API and implementation
-
--->
-<project default="javadoc">
- <target name="javadoc">
- <javadoc
- access="protected"
- author="true"
- destdir="doc"
- nodeprecated="false"
- nodeprecatedlist="false"
- noindex="false"
- nonavbar="false"
- notree="false"
- source="1.5"
- sourcepath="src"
- splitindex="true"
- use="true"
- version="true">
- <package name="org.eclipse.net4j"/>
- <package name="org.eclipse.net4j.message"/>
- <package name="org.eclipse.net4j.remote"/>
- <package name="org.eclipse.net4j.signal"/>
- <package name="org.eclipse.net4j.transport"/>
- <package name="org.eclipse.net4j.transport.tcp"/>
- <package name="org.eclipse.net4j.transport.util"/>
- <package name="org.eclipse.net4j.util"/>
- <package name="org.eclipse.net4j.util.concurrent"/>
- <package name="org.eclipse.net4j.util.lifecycle"/>
- <package name="org.eclipse.net4j.util.om"/>
- <package name="org.eclipse.net4j.util.registry"/>
- <package name="org.eclipse.net4j.util.stream"/>
- <link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
- </javadoc>
- </target>
-</project>
diff --git a/plugins/org.eclipse.net4j/plugin.xml b/plugins/org.eclipse.net4j/plugin.xml
new file mode 100644
index 0000000..c22e936
--- /dev/null
+++ b/plugins/org.eclipse.net4j/plugin.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<plugin>
+
+ <extension-point id="factories" name="Factories" schema="schema/factories.exsd"/>
+
+</plugin>
diff --git a/plugins/org.eclipse.net4j/schema/factories.exsd b/plugins/org.eclipse.net4j/schema/factories.exsd
new file mode 100644
index 0000000..b755309
--- /dev/null
+++ b/plugins/org.eclipse.net4j/schema/factories.exsd
@@ -0,0 +1,124 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.net4j">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.net4j" id="factories" name="Factories"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="factory" 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>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="class"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="productGroup" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.net4j.util.factory.IFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
index b58c6ae..0427749 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
@@ -11,14 +11,14 @@
package org.eclipse.internal.net4j.transport;
import org.eclipse.net4j.transport.IAcceptor;
-import org.eclipse.net4j.transport.IAcceptorAcceptedEvent;
+import org.eclipse.net4j.transport.IAcceptorEvent;
import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.transport.IConnector;
-import org.eclipse.net4j.transport.IProtocolFactory;
-import org.eclipse.net4j.transport.IProtocolFactoryID;
-import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.factory.IFactory;
+import org.eclipse.net4j.util.factory.IFactoryKey;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -26,7 +26,7 @@ import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.util.container.LifecycleEventConverter;
-import org.eclipse.internal.net4j.util.event.Event;
+import org.eclipse.internal.net4j.util.container.SingleDeltaContainerEvent;
import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.util.HashSet;
@@ -36,13 +36,13 @@ import java.util.concurrent.ExecutorService;
/**
* @author Eike Stepper
*/
-public abstract class Acceptor extends Lifecycle implements IAcceptor, IContainer<IConnector>
+public abstract class Acceptor extends Lifecycle implements IAcceptor
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, Acceptor.class);
private IBufferProvider bufferProvider;
- private IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry;
+ private IRegistry<IFactoryKey, IFactory> factoryRegistry;
private ExecutorService receiveExecutor;
@@ -82,14 +82,14 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
this.receiveExecutor = receiveExecutor;
}
- public IRegistry<IProtocolFactoryID, IProtocolFactory> getProtocolFactoryRegistry()
+ public IRegistry<IFactoryKey, IFactory> getFactoryRegistry()
{
- return protocolFactoryRegistry;
+ return factoryRegistry;
}
- public void setProtocolFactoryRegistry(IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry)
+ public void setFactoryRegistry(IRegistry<IFactoryKey, IFactory> factoryRegistry)
{
- this.protocolFactoryRegistry = protocolFactoryRegistry;
+ this.factoryRegistry = factoryRegistry;
}
public IConnector[] getAcceptedConnectors()
@@ -100,6 +100,11 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
}
}
+ public boolean isEmpty()
+ {
+ return acceptedConnectors.isEmpty();
+ }
+
public IConnector[] getElements()
{
return getAcceptedConnectors();
@@ -109,6 +114,9 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
{
try
{
+ connector.setBufferProvider(bufferProvider);
+ connector.setReceiveExecutor(receiveExecutor);
+ connector.setFactoryRegistry(factoryRegistry);
connector.activate();
connector.addListener(lifecycleEventConverter);
@@ -122,7 +130,7 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
TRACER.trace("Added connector " + connector); //$NON-NLS-1$
}
- fireEvent(new AcceptorAcceptedEventImpl(this, connector));
+ fireEvent(new AcceptorEvent(this, connector, IContainerDelta.Kind.ADDED));
}
catch (Exception ex)
{
@@ -142,6 +150,8 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
{
TRACER.trace("Removed connector " + connector); //$NON-NLS-1$
}
+
+ fireEvent(new AcceptorEvent(this, connector, IContainerDelta.Kind.REMOVED));
}
@Override
@@ -153,13 +163,15 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
throw new IllegalStateException("bufferProvider == null"); //$NON-NLS-1$
}
- if (protocolFactoryRegistry == null && TRACER.isEnabled())
+ if (factoryRegistry == null && TRACER.isEnabled())
{
- TRACER.trace("protocolFactoryRegistry == null"); //$NON-NLS-1$
+ // Just a reminder during development
+ TRACER.trace("factoryRegistry == null"); //$NON-NLS-1$
}
if (receiveExecutor == null && TRACER.isEnabled())
{
+ // Just a reminder during development
TRACER.trace("receiveExecutor == null"); //$NON-NLS-1$
}
}
@@ -178,21 +190,23 @@ public abstract class Acceptor extends Lifecycle implements IAcceptor, IContaine
/**
* @author Eike Stepper
*/
- private static class AcceptorAcceptedEventImpl extends Event implements IAcceptorAcceptedEvent
+ private static class AcceptorEvent extends SingleDeltaContainerEvent<IConnector> implements IAcceptorEvent
{
private static final long serialVersionUID = 1L;
- private IConnector acceptedConnector;
+ public AcceptorEvent(IAcceptor acceptor, IConnector connector, Kind kind)
+ {
+ super(acceptor, connector, kind);
+ }
- public AcceptorAcceptedEventImpl(INotifier notifier, IConnector acceptedConnector)
+ public IAcceptor getAcceptor()
{
- super(notifier);
- this.acceptedConnector = acceptedConnector;
+ return (IAcceptor)getContainer();
}
public IConnector getConnector()
{
- return acceptedConnector;
+ return getDeltaElement();
}
}
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AcceptorFactory.java
index f92ec8a..3336e8d 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AcceptorFactory.java
@@ -8,23 +8,22 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.jvm;
+package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.jvm.JVMConstants;
import org.eclipse.net4j.transport.IAcceptor;
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.factory.Factory;
+
/**
* @author Eike Stepper
*/
-public class JVMAcceptorFactoryImpl implements IAcceptorFactory
+public abstract class AcceptorFactory<PRODUCT extends IAcceptor> extends Factory<PRODUCT>
{
- public String getType()
- {
- return JVMConstants.TYPE;
- }
+ public static final String ACCEPTOR_GROUP = Net4j.BUNDLE_ID + ".acceptors";
- public IAcceptor createAcceptor()
+ public AcceptorFactory(String type)
{
- return new JVMAcceptorImpl();
+ super(ACCEPTOR_GROUP, type);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
index cd96202..085a1d1 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
@@ -82,7 +82,7 @@ public class Channel extends Lifecycle implements IChannel, IBufferProvider
this.channelIndex = channelIndex;
}
- public IConnector getConnector()
+ public Connector getConnector()
{
return connector;
}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ClientProtocolFactory.java
index ea42559..5b4daf2 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ClientProtocolFactory.java
@@ -8,23 +8,22 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.tcp;
+package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.tcp.TCPConstants;
-import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IProtocol;
+
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.factory.Factory;
/**
* @author Eike Stepper
*/
-public class TCPConnectorFactoryImpl implements IConnectorFactory
+public abstract class ClientProtocolFactory<PRODUCT extends IProtocol> extends Factory<PRODUCT>
{
- public String getType()
- {
- return TCPConstants.TYPE;
- }
+ public static final String CLIENT_PROTOCOL_GROUP = Net4j.BUNDLE_ID + ".clientProtocols";
- public IConnector createConnector()
+ public ClientProtocolFactory(String type)
{
- return new ClientTCPConnectorImpl();
+ super(CLIENT_PROTOCOL_GROUP, type);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
index 1a9e31f..5294f8c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
@@ -17,21 +17,27 @@ import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IConnectorChannelsEvent;
import org.eclipse.net4j.transport.IConnectorCredentials;
import org.eclipse.net4j.transport.IConnectorStateEvent;
import org.eclipse.net4j.transport.IProtocol;
-import org.eclipse.net4j.transport.IProtocolFactory;
-import org.eclipse.net4j.transport.IProtocolFactoryID;
-import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.factory.IFactory;
+import org.eclipse.net4j.util.factory.IFactoryKey;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.util.container.LifecycleEventConverter;
+import org.eclipse.internal.net4j.util.container.SingleDeltaContainerEvent;
import org.eclipse.internal.net4j.util.event.Event;
+import org.eclipse.internal.net4j.util.factory.FactoryKey;
import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.util.ArrayList;
@@ -44,7 +50,7 @@ import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
*/
-public abstract class Connector extends Lifecycle implements IConnector, IContainer<IChannel>
+public abstract class Connector extends Lifecycle implements IConnector
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, Connector.class);
@@ -54,7 +60,7 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
private IConnectorCredentials credentials;
- private IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry;
+ private IRegistry<IFactoryKey, IFactory> factoryRegistry;
private IBufferProvider bufferProvider;
@@ -77,7 +83,22 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
* Is registered with each {@link IChannel} of this {@link IConnector}.
* <p>
*/
- private transient IListener lifecycleEventConverter = new LifecycleEventConverter(this);
+ private transient IListener lifecycleEventConverter = new LifecycleEventConverter(this)
+ {
+ @Override
+ protected void added(ILifecycleEvent e)
+ {
+ super.added(e);
+ fireEvent(new ConnectorChannelsEvent(Connector.this, (IChannel)e.getLifecycle(), IContainerDelta.Kind.ADDED));
+ }
+
+ @Override
+ protected void removed(ILifecycleEvent e)
+ {
+ fireEvent(new ConnectorChannelsEvent(Connector.this, (IChannel)e.getLifecycle(), IContainerDelta.Kind.REMOVED));
+ super.removed(e);
+ }
+ };
private transient CountDownLatch finishedConnecting;
@@ -99,14 +120,14 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
this.receiveExecutor = receiveExecutor;
}
- public IRegistry<IProtocolFactoryID, IProtocolFactory> getProtocolFactoryRegistry()
+ public IRegistry<IFactoryKey, IFactory> getFactoryRegistry()
{
- return protocolFactoryRegistry;
+ return factoryRegistry;
}
- public void setProtocolFactoryRegistry(IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry)
+ public void setFactoryRegistry(IRegistry<IFactoryKey, IFactory> factoryRegistry)
{
- this.protocolFactoryRegistry = protocolFactoryRegistry;
+ this.factoryRegistry = factoryRegistry;
}
public IBufferProvider getBufferProvider()
@@ -166,7 +187,7 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
}
connectorState = newState;
- fireEvent(new ConnectorStateEventImpl(this, oldState, newState));
+ fireEvent(new ConnectorStateEvent(this, oldState, newState));
switch (newState)
{
case DISCONNECTED:
@@ -289,6 +310,11 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
return result.toArray(new IChannel[result.size()]);
}
+ public boolean isEmpty()
+ {
+ return getElements().length == 0;
+ }
+
public IChannel[] getElements()
{
return getChannels();
@@ -301,14 +327,9 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
public IChannel openChannel(String protocolID) throws ConnectorException
{
- return openChannel(protocolID, null);
- }
-
- public IChannel openChannel(String protocolID, Object protocolData) throws ConnectorException
- {
waitForConnection(Long.MAX_VALUE);
short channelIndex = findFreeChannelIndex();
- Channel channel = createChannel(channelIndex, protocolID, protocolData);
+ Channel channel = createChannel(channelIndex, protocolID);
registerChannelWithPeer(channelIndex, protocolID);
try
@@ -327,14 +348,24 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
return channel;
}
- public Channel createChannel(short channelIndex, String protocolID, Object protocolData)
+ public Channel createChannel(short channelIndex, String protocolID)
{
Channel channel = new Channel(receiveExecutor);
- IProtocol protocol = createProtocol(protocolID, channel, protocolData);
- if (TRACER.isEnabled())
+ IProtocol protocol = createProtocol(protocolID);
+ if (protocol != null)
{
- TRACER.trace("Opening channel " + channelIndex //$NON-NLS-1$
- + (protocol == null ? " without protocol" : " with protocol " + protocolID)); //$NON-NLS-1$ //$NON-NLS-2$
+ protocol.setChannel(channel);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Opening channel {0} with protocol {1}", channelIndex, protocolID); //$NON-NLS-1$
+ }
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Opening channel {0} without protocol", channelIndex); //$NON-NLS-1$
+ }
}
channel.setChannelIndex(channelIndex);
@@ -426,27 +457,39 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
channels.set(channelIndex, NULL_CHANNEL);
}
- protected IProtocol createProtocol(String protocolID, IChannel channel, Object protocolData)
+ protected IProtocol createProtocol(String type)
{
- if (protocolID == null || protocolID.length() == 0 || protocolFactoryRegistry == null)
+ if (StringUtil.isEmpty(type) || factoryRegistry == null)
{
return null;
}
- IProtocolFactoryID protocolFactoryID = ProtocolFactoryID.create(getLocation(), protocolID);
- IProtocolFactory factory = protocolFactoryRegistry.get(protocolFactoryID);
-
+ IFactoryKey key = createProtocolFactoryKey(type);
+ IFactory<IProtocol> factory = factoryRegistry.get(key);
if (factory == null)
{
if (TRACER.isEnabled())
{
- TRACER.trace("Unknown protocol " + protocolID); //$NON-NLS-1$
+ TRACER.trace("Unknown protocol " + type); //$NON-NLS-1$
}
return null;
}
- return factory.createProtocol(channel, protocolData);
+ return factory.create(null);
+ }
+
+ protected IFactoryKey createProtocolFactoryKey(String type)
+ {
+ switch (getLocation())
+ {
+ case SERVER:
+ return new FactoryKey(ServerProtocolFactory.SERVER_PROTOCOL_GROUP, type);
+ case CLIENT:
+ return new FactoryKey(ClientProtocolFactory.CLIENT_PROTOCOL_GROUP, type);
+ default:
+ throw new IllegalStateException();
+ }
}
@Override
@@ -458,10 +501,10 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
throw new IllegalStateException("bufferProvider == null"); //$NON-NLS-1$
}
- if (protocolFactoryRegistry == null && TRACER.isEnabled())
+ if (factoryRegistry == null && TRACER.isEnabled())
{
// Just a reminder during development
- TRACER.trace("No protocolFactoryRegistry!"); //$NON-NLS-1$
+ TRACER.trace("No factoryRegistry!"); //$NON-NLS-1$
}
if (receiveExecutor == null && TRACER.isEnabled())
@@ -523,7 +566,7 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
/**
* @author Eike Stepper
*/
- private static class ConnectorStateEventImpl extends Event implements IConnectorStateEvent
+ private static class ConnectorStateEvent extends Event implements IConnectorStateEvent
{
private static final long serialVersionUID = 1L;
@@ -531,7 +574,7 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
private ConnectorState newState;
- public ConnectorStateEventImpl(INotifier notifier, ConnectorState oldState, ConnectorState newState)
+ public ConnectorStateEvent(INotifier notifier, ConnectorState oldState, ConnectorState newState)
{
super(notifier);
this.oldState = oldState;
@@ -548,4 +591,28 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
return newState;
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ private static class ConnectorChannelsEvent extends SingleDeltaContainerEvent<IChannel> implements
+ IConnectorChannelsEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ public ConnectorChannelsEvent(IConnector connector, IChannel channel, Kind kind)
+ {
+ super(connector, channel, kind);
+ }
+
+ public IConnector getConnector()
+ {
+ return (IConnector)getContainer();
+ }
+
+ public IChannel getChannel()
+ {
+ return getDeltaElement();
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorFactory.java
index b724717..538d22a 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorFactory.java
@@ -8,23 +8,22 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.internal.jvm;
+package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.jvm.JVMConstants;
import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.factory.Factory;
+
/**
* @author Eike Stepper
*/
-public class JVMConnectorFactoryImpl implements IConnectorFactory
+public abstract class ConnectorFactory<PRODUCT extends IConnector> extends Factory<PRODUCT>
{
- public String getType()
- {
- return JVMConstants.TYPE;
- }
+ public static final String CONNECTOR_GROUP = Net4j.BUNDLE_ID + ".connectors";
- public IConnector createConnector()
+ public ConnectorFactory(String type)
{
- return new ClientJVMConnectorImpl();
+ super(CONNECTOR_GROUP, type);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/DescriptionUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/DescriptionUtil.java
index da94c5f..022451e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/DescriptionUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/DescriptionUtil.java
@@ -13,6 +13,7 @@ package org.eclipse.internal.net4j.transport;
/**
* @author Eike Stepper
*/
+@Deprecated
public final class DescriptionUtil
{
public static final String SEPARATOR = ":"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java
index 7fd4fa3..724476a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java
@@ -22,18 +22,22 @@ import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
*/
public abstract class Protocol extends Lifecycle implements IProtocol, IBufferProvider
{
- private IChannel channel;
+ private Channel channel;
- public Protocol(IChannel channel)
+ public Protocol()
{
- this.channel = channel;
}
- public IChannel getChannel()
+ public Channel getChannel()
{
return channel;
}
+ public void setChannel(IChannel channel)
+ {
+ this.channel = (Channel)channel;
+ }
+
public short getBufferCapacity()
{
return BufferUtil.getBufferProvider(channel).getBufferCapacity();
@@ -50,6 +54,16 @@ public abstract class Protocol extends Lifecycle implements IProtocol, IBufferPr
}
@Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ if (channel == null)
+ {
+ throw new IllegalStateException("channel == null");
+ }
+ }
+
+ @Override
protected void doDeactivate() throws Exception
{
channel = null;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactory.java
deleted file mode 100644
index 25ae987..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
- * 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:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.internal.net4j.transport;
-
-import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.IProtocolFactory;
-import org.eclipse.net4j.transport.IProtocolFactoryID;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ProtocolFactory implements IProtocolFactory
-{
- public ProtocolFactory()
- {
- }
-
- public final boolean isForClients()
- {
- return getLocations().contains(ConnectorLocation.CLIENT);
- }
-
- public final boolean isForServers()
- {
- return getLocations().contains(ConnectorLocation.SERVER);
- }
-
- public final boolean isSymmetric()
- {
- return isForClients() && isForServers();
- }
-
- public IProtocolFactoryID getID(ConnectorLocation location)
- {
- return ProtocolFactoryID.create(location, getProtocolID());
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("Protocol.Factory({0}, {1})", getProtocolID(), getLocations());
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryID.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryID.java
deleted file mode 100644
index 7eedfac..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryID.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
- * 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:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.internal.net4j.transport;
-
-import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.IProtocolFactoryID;
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.internal.net4j.util.Value;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class ProtocolFactoryID extends Value implements IProtocolFactoryID
-{
- private static final long serialVersionUID = 1L;
-
- private ConnectorLocation location;
-
- private String protocolID;
-
- public ProtocolFactoryID(ConnectorLocation location, String protocolID)
- {
- this.location = location;
- this.protocolID = protocolID;
- }
-
- public ConnectorLocation getLocation()
- {
- return location;
- }
-
- public String getProtocolID()
- {
- return protocolID;
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException
- {
- return this;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof IProtocolFactoryID)
- {
- IProtocolFactoryID that = (IProtocolFactoryID)obj;
- return this.location == that.getLocation() && ObjectUtil.equals(this.protocolID, that.getProtocolID());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return location.hashCode() ^ protocolID.hashCode();
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}[{1}]", location, protocolID);
- }
-
- public static IProtocolFactoryID create(ConnectorLocation location, String protocolID)
- {
- return new ProtocolFactoryID(location, protocolID);
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ServerProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ServerProtocolFactory.java
new file mode 100644
index 0000000..a359d4c
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ServerProtocolFactory.java
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.transport;
+
+import org.eclipse.net4j.transport.IProtocol;
+
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ServerProtocolFactory<PRODUCT extends IProtocol> extends Factory<PRODUCT>
+{
+ public static final String SERVER_PROTOCOL_GROUP = Net4j.BUNDLE_ID + ".serverProtocols";
+
+ public ServerProtocolFactory(String type)
+ {
+ super(SERVER_PROTOCOL_GROUP, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/TransportContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/TransportContainer.java
new file mode 100644
index 0000000..f75c6c6
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/TransportContainer.java
@@ -0,0 +1,130 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.transport;
+
+import org.eclipse.net4j.transport.IBufferProvider;
+import org.eclipse.net4j.transport.ITransportContainer;
+import org.eclipse.net4j.transport.TransportUtil;
+import org.eclipse.net4j.util.container.IElementProcessor;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.container.ManagedContainer;
+
+import java.text.MessageFormat;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * @author Eike Stepper
+ */
+public class TransportContainer extends ManagedContainer implements ITransportContainer
+{
+ public static final String EXECUTOR_SERVICE_GROUP = Net4j.BUNDLE_ID + ".executorServices";
+
+ public static final String BUFFER_PROVIDER_GROUP = Net4j.BUNDLE_ID + ".bufferProviders";
+
+ public static final short DEFAULT_BUFFER_CAPACITY = 4096;
+
+ public static final ThreadFactory THREAD_FACTORY = new ThreadFactory()
+ {
+ public Thread newThread(Runnable r)
+ {
+ Thread thread = new Thread(r);
+ thread.setDaemon(true);
+ return thread;
+ }
+ };
+
+ private short bufferCapacity;
+
+ public TransportContainer(short bufferCapacity)
+ {
+ this.bufferCapacity = bufferCapacity;
+ putElement(BUFFER_PROVIDER_GROUP, null, null, createBufferProvider());
+ putElement(EXECUTOR_SERVICE_GROUP, null, null, createExecutorService());
+ addPostProcessor(new PostProcessor());
+ }
+
+ public TransportContainer()
+ {
+ this(DEFAULT_BUFFER_CAPACITY);
+ }
+
+ public short getBufferCapacity()
+ {
+ return bufferCapacity;
+ }
+
+ public BufferProvider getBufferProvider()
+ {
+ return (BufferProvider)getElement(BUFFER_PROVIDER_GROUP, null, null);
+ }
+
+ public ExecutorService getExecutorService()
+ {
+ return (ExecutorService)getElement(EXECUTOR_SERVICE_GROUP, null, null);
+ }
+
+ public Acceptor getAcceptor(String type, String description)
+ {
+ return (Acceptor)getElement(AcceptorFactory.ACCEPTOR_GROUP, type, description);
+ }
+
+ public Connector getConnector(String type, String description)
+ {
+ return (Connector)getElement(ConnectorFactory.CONNECTOR_GROUP, type, description);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("TransportContainer[{0}]", bufferCapacity);
+ }
+
+ protected IBufferProvider createBufferProvider()
+ {
+ return TransportUtil.createBufferPool(getBufferCapacity());
+ }
+
+ protected ExecutorService createExecutorService()
+ {
+ return Executors.newCachedThreadPool(THREAD_FACTORY);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class PostProcessor implements IElementProcessor
+ {
+ public Object process(final IManagedContainer container, final String productGroup, final String factoryType,
+ final String description, final Object element)
+ {
+ if (element instanceof Acceptor)
+ {
+ Acceptor acceptor = (Acceptor)element;
+ acceptor.setBufferProvider(getBufferProvider());
+ acceptor.setReceiveExecutor(getExecutorService());
+ acceptor.setFactoryRegistry(getFactoryRegistry());
+ }
+ else if (element instanceof Connector)
+ {
+ Connector connector = (Connector)element;
+ connector.setBufferProvider(getBufferProvider());
+ connector.setReceiveExecutor(getExecutorService());
+ connector.setFactoryRegistry(getFactoryRegistry());
+ }
+
+ return element;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java
index 667eb19..0c3da3d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ManagedContainer.java
@@ -12,13 +12,16 @@ package org.eclipse.internal.net4j.util.container;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IElementProcessor;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.factory.IFactory;
+import org.eclipse.net4j.util.factory.IFactoryKey;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.registry.IRegistry;
-import org.eclipse.internal.net4j.util.event.Notifier;
+import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.util.factory.FactoryKey;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
import java.io.IOException;
@@ -27,6 +30,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -36,49 +40,54 @@ import java.util.Map.Entry;
/**
* @author Eike Stepper
*/
-public class ManagedContainer extends Notifier implements IManagedContainer
+public class ManagedContainer extends Lifecycle implements IManagedContainer
{
- private IRegistry<FactoryKey, IFactory> factoryRegistry = new HashMapRegistry();
+ private IRegistry<IFactoryKey, IFactory> factoryRegistry;
+
+ private List<IElementProcessor> postProcessors;
private IRegistry<ElementKey, Object> elementRegistry = new HashMapRegistry();
private long maxElementID;
- public IFactory[] getFactories()
+ public ManagedContainer()
{
- return factoryRegistry.values().toArray(new IFactory[factoryRegistry.size()]);
}
- public IFactory[] getFactories(String productGroup)
+ public synchronized IRegistry<IFactoryKey, IFactory> getFactoryRegistry()
{
- List<IFactory> result = new ArrayList();
- for (IFactory factory : factoryRegistry.values())
+ if (factoryRegistry == null)
{
- if (ObjectUtil.equals(factory.getProductGroup(), productGroup))
- {
- result.add(factory);
- }
+ factoryRegistry = createFactoryRegistry();
}
- return result.toArray(new IFactory[result.size()]);
+ return factoryRegistry;
}
- public IFactory getFactory(String productGroup, String factoryType)
+ public ManagedContainer registerFactory(IFactory factory)
{
- FactoryKey key = new FactoryKey(productGroup, factoryType);
- return factoryRegistry.get(key);
+ getFactoryRegistry().put(factory.getKey(), factory);
+ return this;
}
- public void registerFactory(IFactory factory)
+ public synchronized List<IElementProcessor> getPostProcessors()
{
- FactoryKey key = new FactoryKey(factory.getProductGroup(), factory.getType());
- factoryRegistry.put(key, factory);
+ if (postProcessors == null)
+ {
+ postProcessors = createPostProcessors();
+ }
+
+ return postProcessors;
}
- public void deregisterFactory(IFactory factory)
+ public void addPostProcessor(IElementProcessor postProcessor)
{
- FactoryKey key = new FactoryKey(factory.getProductGroup(), factory.getType());
- factoryRegistry.remove(key);
+ getPostProcessors().add(postProcessor);
+ }
+
+ public void removePostProcessor(IElementProcessor postProcessor)
+ {
+ getPostProcessors().remove(postProcessor);
}
public boolean isEmpty()
@@ -133,6 +142,8 @@ public class ManagedContainer extends Notifier implements IManagedContainer
element = createElement(productGroup, factoryType, description);
if (element != null)
{
+ element = postProcessElement(productGroup, factoryType, description, element);
+ LifecycleUtil.activate(element);
key.setID(++maxElementID);
elementRegistry.put(key, element);
fireEvent(new SingleDeltaContainerEvent(this, element, IContainerDelta.Kind.ADDED));
@@ -143,6 +154,29 @@ public class ManagedContainer extends Notifier implements IManagedContainer
}
}
+ /**
+ * TODO Replace usages by factories (BufferProvider, ExecutorService,
+ * ProtocolFactoryRegistry)
+ */
+ public Object putElement(String productGroup, String factoryType, String description, Object element)
+ {
+ synchronized (elementRegistry)
+ {
+ ContainerEvent event = new ContainerEvent(this);
+ ElementKey key = new ElementKey(productGroup, factoryType, description);
+ key.setID(++maxElementID);
+ Object oldElement = elementRegistry.put(key, element);
+ if (oldElement != null)
+ {
+ event.addDelta(oldElement, IContainerDelta.Kind.REMOVED);
+ }
+
+ event.addDelta(element, IContainerDelta.Kind.ADDED);
+ fireEvent(event);
+ return oldElement;
+ }
+ }
+
public Object removeElement(String productGroup, String factoryType, String description)
{
ElementKey key = new ElementKey(productGroup, factoryType, description);
@@ -219,9 +253,26 @@ public class ManagedContainer extends Notifier implements IManagedContainer
}
}
+ @Override
+ public String toString()
+ {
+ return "ManagedContainer";
+ }
+
+ protected HashMapRegistry createFactoryRegistry()
+ {
+ return new HashMapRegistry();
+ }
+
+ protected ArrayList createPostProcessors()
+ {
+ return new ArrayList();
+ }
+
protected Object createElement(String productGroup, String factoryType, String description)
{
- IFactory factory = getFactory(productGroup, factoryType);
+ FactoryKey key = new FactoryKey(productGroup, factoryType);
+ IFactory factory = getFactoryRegistry().get(key);
if (factory != null)
{
return factory.create(description);
@@ -230,6 +281,16 @@ public class ManagedContainer extends Notifier implements IManagedContainer
return null;
}
+ protected Object postProcessElement(String productGroup, String factoryType, String description, Object element)
+ {
+ for (IElementProcessor processor : getPostProcessors())
+ {
+ element = processor.process(this, productGroup, factoryType, description, element);
+ }
+
+ return element;
+ }
+
protected void initMaxElementID()
{
synchronized (elementRegistry)
@@ -246,6 +307,23 @@ public class ManagedContainer extends Notifier implements IManagedContainer
}
}
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (Object element : elementRegistry.values())
+ {
+ try
+ {
+ LifecycleUtil.deactivateNoisy(element);
+ }
+ catch (RuntimeException ex)
+ {
+ Net4j.LOG.error(ex);
+ }
+ }
+ super.doDeactivate();
+ }
+
/**
* @author Eike Stepper
*/
@@ -312,6 +390,12 @@ public class ManagedContainer extends Notifier implements IManagedContainer
return ObjectUtil.hashCode(productGroup) ^ ObjectUtil.hashCode(factoryType) ^ ObjectUtil.hashCode(description);
}
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}[{1}, {2}]", productGroup, factoryType, description);
+ }
+
public int compareTo(Object o)
{
if (o instanceof ElementKey)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/PluginElementProcessorList.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/PluginElementProcessorList.java
new file mode 100644
index 0000000..4feabbb
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/PluginElementProcessorList.java
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container;
+
+import org.eclipse.net4j.util.container.IElementProcessor;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IRegistryChangeEvent;
+import org.eclipse.core.runtime.IRegistryChangeListener;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class PluginElementProcessorList extends Lifecycle
+{
+ private static final String ATTR_CLASS = "class";
+
+ public static final String NAMESPACE = Net4j.BUNDLE_ID;
+
+ public static final String EXT_POINT = "postProcessors";
+
+ private List<IElementProcessor> processors = new ArrayList();
+
+ private IRegistryChangeListener extensionRegistryListener = new IRegistryChangeListener()
+ {
+ public void registryChanged(IRegistryChangeEvent event)
+ {
+ IExtensionDelta[] deltas = event.getExtensionDeltas(NAMESPACE, EXT_POINT);
+ for (IExtensionDelta delta : deltas)
+ {
+ // TODO Handle ExtensionDelta
+ Net4j.LOG.warn("ExtensionDelta not handled: " + delta);
+ }
+ }
+ };
+
+ public PluginElementProcessorList()
+ {
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = extensionRegistry.getConfigurationElementsFor(NAMESPACE, EXT_POINT);
+ for (IConfigurationElement element : elements)
+ {
+ IElementProcessor processor = (IElementProcessor)element.createExecutableExtension(ATTR_CLASS);
+ processors.add(processor);
+ }
+
+ extensionRegistry.addRegistryChangeListener(extensionRegistryListener, NAMESPACE);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ extensionRegistry.removeRegistryChangeListener(extensionRegistryListener);
+ processors.clear();
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/Factory.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/Factory.java
index 61bcf1f..9ba58f2 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/Factory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/Factory.java
@@ -12,6 +12,8 @@ package org.eclipse.internal.net4j.util.factory;
import org.eclipse.net4j.util.factory.IFactory;
+import java.text.MessageFormat;
+
/**
* @author Eike Stepper
*/
@@ -19,9 +21,14 @@ public abstract class Factory<PRODUCT> implements IFactory<PRODUCT>
{
private FactoryKey key;
+ public Factory(FactoryKey key)
+ {
+ this.key = key;
+ }
+
public Factory(String productGroup, String type)
{
- key = new FactoryKey(productGroup, type);
+ this(new FactoryKey(productGroup, type));
}
public FactoryKey getKey()
@@ -29,18 +36,24 @@ public abstract class Factory<PRODUCT> implements IFactory<PRODUCT>
return key;
}
- public String getFactoryType()
+ public String getProductGroup()
{
- return key.getFactoryType();
+ return key.getProductGroup();
}
- public String getProductGroup()
+ public String getType()
{
- return key.getProductGroup();
+ return key.getType();
+ }
+
+ public String getDescriptionFor(PRODUCT product)
+ {
+ return null;
}
+ @Override
public String toString()
{
- return key.toString();
+ return MessageFormat.format("Factory[{0}, {1}]", getProductGroup(), getType());
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryCreationException.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryCreationException.java
new file mode 100644
index 0000000..135f808
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryCreationException.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.factory;
+
+/**
+ * @author Eike Stepper
+ */
+public class FactoryCreationException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ public FactoryCreationException()
+ {
+ }
+
+ public FactoryCreationException(String message)
+ {
+ super(message);
+ }
+
+ public FactoryCreationException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public FactoryCreationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryDescriptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryDescriptor.java
new file mode 100644
index 0000000..71e988a
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryDescriptor.java
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.factory;
+
+import org.eclipse.net4j.util.factory.IFactory;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * @author Eike Stepper
+ */
+public class FactoryDescriptor extends Factory
+{
+ private static final String ATTR_PRODUCT_GROUP = "productGroup";
+
+ private static final String ATTR_TYPE = "type";
+
+ private static final String ATTR_CLASS = "class";
+
+ private IConfigurationElement configurationElement;
+
+ public FactoryDescriptor(IConfigurationElement configurationElement)
+ {
+ super(createFactoryKey(configurationElement));
+ this.configurationElement = configurationElement;
+ }
+
+ public IConfigurationElement getConfigurationElement()
+ {
+ return configurationElement;
+ }
+
+ public IFactory createFactory()
+ {
+ try
+ {
+ return (IFactory)configurationElement.createExecutableExtension(ATTR_CLASS);
+ }
+ catch (CoreException ex)
+ {
+ throw new FactoryCreationException(ex);
+ }
+ }
+
+ public Object create(String description)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getDescriptionFor(Object product)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ private static FactoryKey createFactoryKey(IConfigurationElement element)
+ {
+ String productGroup = element.getAttribute(ATTR_PRODUCT_GROUP);
+ String type = element.getAttribute(ATTR_TYPE);
+ return new FactoryKey(productGroup, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryKey.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryKey.java
index abdb7be..a305494 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryKey.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/FactoryKey.java
@@ -1,6 +1,8 @@
package org.eclipse.internal.net4j.util.factory;
import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.factory.IFactoryKey;
import java.io.Serializable;
import java.text.MessageFormat;
@@ -8,18 +10,18 @@ import java.text.MessageFormat;
/**
* @author Eike Stepper
*/
-public final class FactoryKey implements Serializable
+public final class FactoryKey implements IFactoryKey, Serializable, Comparable
{
private static final long serialVersionUID = 1L;
private String productGroup;
- private String factoryType;
+ private String type;
- public FactoryKey(String productGroup, String factoryType)
+ public FactoryKey(String productGroup, String type)
{
this.productGroup = productGroup;
- this.factoryType = factoryType;
+ this.type = type;
}
public String getProductGroup()
@@ -27,9 +29,9 @@ public final class FactoryKey implements Serializable
return productGroup;
}
- public String getFactoryType()
+ public String getType()
{
- return factoryType;
+ return type;
}
@Override
@@ -38,7 +40,7 @@ public final class FactoryKey implements Serializable
if (obj instanceof FactoryKey)
{
FactoryKey key = (FactoryKey)obj;
- return ObjectUtil.equals(productGroup, key.productGroup) && ObjectUtil.equals(factoryType, key.factoryType);
+ return ObjectUtil.equals(productGroup, key.productGroup) && ObjectUtil.equals(type, key.type);
}
return false;
@@ -47,12 +49,29 @@ public final class FactoryKey implements Serializable
@Override
public int hashCode()
{
- return ObjectUtil.hashCode(productGroup) ^ ObjectUtil.hashCode(factoryType);
+ return ObjectUtil.hashCode(productGroup) ^ ObjectUtil.hashCode(type);
}
@Override
public String toString()
{
- return MessageFormat.format("{0}[{1}]", productGroup, factoryType);
+ return MessageFormat.format("{0}[{1}]", productGroup, type);
+ }
+
+ public int compareTo(Object o)
+ {
+ if (o instanceof FactoryKey)
+ {
+ FactoryKey key = (FactoryKey)o;
+ int result = StringUtil.compare(productGroup, key.productGroup);
+ if (result == 0)
+ {
+ result = StringUtil.compare(type, key.type);
+ }
+
+ return result;
+ }
+
+ return 0;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/PluginFactoryRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/PluginFactoryRegistry.java
new file mode 100644
index 0000000..6910337
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/factory/PluginFactoryRegistry.java
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.factory;
+
+import org.eclipse.net4j.util.factory.IFactory;
+import org.eclipse.net4j.util.factory.IFactoryKey;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionDelta;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IRegistryChangeEvent;
+import org.eclipse.core.runtime.IRegistryChangeListener;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
+
+/**
+ * @author Eike Stepper
+ */
+public class PluginFactoryRegistry extends HashMapRegistry<IFactoryKey, IFactory>
+{
+ public static final String NAMESPACE = Net4j.BUNDLE_ID;
+
+ public static final String EXT_POINT = "factories";
+
+ private IRegistryChangeListener extensionRegistryListener = new IRegistryChangeListener()
+ {
+ public void registryChanged(IRegistryChangeEvent event)
+ {
+ IExtensionDelta[] deltas = event.getExtensionDeltas(NAMESPACE, EXT_POINT);
+ for (IExtensionDelta delta : deltas)
+ {
+ // TODO Handle ExtensionDelta
+ Net4j.LOG.warn("ExtensionDelta not handled: " + delta);
+ }
+ }
+ };
+
+ public PluginFactoryRegistry()
+ {
+ }
+
+ @Override
+ public IFactory get(Object key)
+ {
+ IFactory factory = super.get(key);
+ if (factory instanceof FactoryDescriptor)
+ {
+ FactoryDescriptor descriptor = (FactoryDescriptor)factory;
+ factory = descriptor.createFactory();
+ }
+
+ return factory;
+ }
+
+ public void registerFactory(FactoryDescriptor factory)
+ {
+ put(factory.getKey(), factory);
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = extensionRegistry.getConfigurationElementsFor(NAMESPACE, EXT_POINT);
+ for (IConfigurationElement element : elements)
+ {
+ registerFactory(new FactoryDescriptor(element));
+ }
+
+ extensionRegistry.addRegistryChangeListener(extensionRegistryListener, NAMESPACE);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ extensionRegistry.removeRegistryChangeListener(extensionRegistryListener);
+ clear();
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java
index adb1f58..3417deb 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java
@@ -14,7 +14,7 @@ import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.util.event.Notifier;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.util.Collection;
import java.util.Iterator;
@@ -24,7 +24,7 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public abstract class Registry<K, V> extends Notifier implements IRegistry<K, V>
+public abstract class Registry<K, V> extends Lifecycle implements IRegistry<K, V>
{
private boolean autoCommit;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
index 53e6842..0bb9f3a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
@@ -14,12 +14,10 @@ import org.eclipse.net4j.stream.BufferInputStream;
import org.eclipse.net4j.stream.ChannelOutputStream;
import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.transport.IBufferProvider;
-import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.transport.BufferUtil;
-import org.eclipse.internal.net4j.transport.Channel;
import org.eclipse.internal.net4j.transport.Protocol;
import java.nio.ByteBuffer;
@@ -43,27 +41,17 @@ public abstract class SignalProtocol extends Protocol
private static final ContextTracer STREAM_TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM,
SignalOutputStream.class);
- private ExecutorService executorService;
-
private Map<Integer, Signal> signals = new ConcurrentHashMap(0);
private int nextCorrelationID = MIN_CORRELATION_ID;
- protected SignalProtocol(IChannel channel, ExecutorService executorService)
+ protected SignalProtocol()
{
- super(channel);
-
- if (executorService == null)
- {
- throw new IllegalArgumentException("executorService == null"); //$NON-NLS-1$
- }
-
- this.executorService = executorService;
}
- protected SignalProtocol(IChannel channel)
+ public ExecutorService getExecutorService()
{
- this(channel, ((Channel)channel).getReceiveExecutor());
+ return getChannel().getConnector().getReceiveExecutor();
}
public boolean waitForSignals(long timeout)
@@ -114,7 +102,7 @@ public abstract class SignalProtocol extends Protocol
signal.setInputStream(new SignalInputStream(getInputStreamTimeout()));
signal.setOutputStream(new SignalOutputStream(-correlationID, signalID, false));
signals.put(-correlationID, signal);
- executorService.execute(signal);
+ getExecutorService().execute(signal);
}
}
else
@@ -143,7 +131,7 @@ public abstract class SignalProtocol extends Protocol
@Override
public String toString()
{
- return "SignalProtocol[" + getProtocolID() + ", " + getChannel() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return "SignalProtocol[" + getType() + ", " + getChannel() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
protected abstract SignalReactor createSignalReactor(short signalID);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
index 7aa19b3..df3688d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
@@ -10,12 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.transport;
-import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.container.IContainer;
/**
* @author Eike Stepper
*/
-public interface IAcceptor extends INotifier
+public interface IAcceptor extends IContainer<IConnector>
{
public IConnector[] getAcceptedConnectors();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorAcceptedEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java
index 5022b3d..578565e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorAcceptedEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorEvent.java
@@ -10,12 +10,14 @@
**************************************************************************/
package org.eclipse.net4j.transport;
-import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.container.IContainerEvent;
/**
* @author Eike Stepper
*/
-public interface IAcceptorAcceptedEvent extends IEvent
+public interface IAcceptorEvent extends IContainerEvent<IConnector>
{
+ public IAcceptor getAcceptor();
+
public IConnector getConnector();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
index 88b4722..bc9049d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.transport;
-import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.internal.net4j.transport.Channel;
import org.eclipse.internal.net4j.transport.Connector;
@@ -31,7 +31,7 @@ import org.eclipse.internal.net4j.transport.Connector;
*
* @author Eike Stepper
*/
-public interface IConnector extends INotifier
+public interface IConnector extends IContainer<IChannel>
{
public ConnectorLocation getLocation();
@@ -102,6 +102,4 @@ public interface IConnector extends INotifier
* @see #openChannel()
*/
public IChannel openChannel(String protocolID) throws ConnectorException;
-
- public IChannel openChannel(String protocolID, Object protocolData) throws ConnectorException;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
index fcff07f..e2a674d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
@@ -17,5 +17,7 @@ import org.eclipse.net4j.util.container.IContainerEvent;
*/
public interface IConnectorChannelsEvent extends IContainerEvent<IChannel>
{
+ public IConnector getConnector();
+
public IChannel getChannel();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
index a1eebd7..60a5cd5 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
@@ -15,7 +15,9 @@ package org.eclipse.net4j.transport;
*/
public interface IProtocol extends IBufferHandler
{
- public String getProtocolID();
+ public String getType();
public IChannel getChannel();
+
+ public void setChannel(IChannel channel);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java
deleted file mode 100644
index 047d471..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
- * 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:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.transport;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public interface IProtocolFactory
-{
- public static final Set<ConnectorLocation> FOR_CLIENTS = Collections.singleton(ConnectorLocation.CLIENT);
-
- public static final Set<ConnectorLocation> FOR_SERVERS = Collections.singleton(ConnectorLocation.SERVER);
-
- public static final Set<ConnectorLocation> SYMMETRIC = Collections.unmodifiableSet(new HashSet(Arrays
- .asList(new ConnectorLocation[] { ConnectorLocation.CLIENT, ConnectorLocation.SERVER })));
-
- public String getProtocolID();
-
- public Set<ConnectorLocation> getLocations();
-
- public boolean isForClients();
-
- public boolean isForServers();
-
- public boolean isSymmetric();
-
- public IProtocolFactoryID getID(ConnectorLocation location);
-
- public IProtocol createProtocol(IChannel channel, Object protocolData);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java
new file mode 100644
index 0000000..0dba548
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ITransportContainer.java
@@ -0,0 +1,21 @@
+package org.eclipse.net4j.transport;
+
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ITransportContainer extends IManagedContainer
+{
+ public short getBufferCapacity();
+
+ public IBufferProvider getBufferProvider();
+
+ public ExecutorService getExecutorService();
+
+ public IAcceptor getAcceptor(String type, String description);
+
+ public IConnector getConnector(String type, String description);
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
index 8488783..c986a07 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
@@ -20,6 +20,7 @@ import java.lang.annotation.Target;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Collection;
import java.util.Map;
import java.util.WeakHashMap;
@@ -209,8 +210,28 @@ public final class ReflectUtil
builder.append(segmentPrefix);
builder.append(field.getName());
builder.append(" = "); //$NON-NLS-1$
- builder.append(getValue(object, field));
- builder.append(NL);
+
+ Object value = getValue(object, field);
+ if (value instanceof Map)
+ {
+ value = ((Map)value).entrySet();
+ }
+
+ if (value instanceof Collection)
+ {
+ builder.append(NL);
+ for (Object element : (Collection)value)
+ {
+ builder.append(" ");
+ builder.append(element);
+ builder.append(NL);
+ }
+ }
+ else
+ {
+ builder.append(value);
+ builder.append(NL);
+ }
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/StringUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/StringUtil.java
index cc0ac52..864ab27 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/StringUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/StringUtil.java
@@ -31,6 +31,21 @@ public final class StringUtil
return str;
}
+ public static int compare(String s1, String s2)
+ {
+ if (s1 == null)
+ {
+ return s2 == null ? 0 : -1;
+ }
+
+ if (s2 == null)
+ {
+ return 1;
+ }
+
+ return s1.compareTo(s2);
+ }
+
public static int occurrences(String str, char c)
{
int count = 0;
@@ -41,4 +56,9 @@ public final class StringUtil
return count;
}
+
+ public static boolean isEmpty(String str)
+ {
+ return str == null || str.length() == 0;
+ }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IElementProcessor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IElementProcessor.java
new file mode 100644
index 0000000..ae70097
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IElementProcessor.java
@@ -0,0 +1,20 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.container;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IElementProcessor
+{
+ public Object process(IManagedContainer container, String productGroup, String factoryType, String description,
+ Object element);
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java
index 90ccb55..68f9ab6 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IManagedContainer.java
@@ -11,25 +11,26 @@
package org.eclipse.net4j.util.container;
import org.eclipse.net4j.util.factory.IFactory;
+import org.eclipse.net4j.util.factory.IFactoryKey;
+import org.eclipse.net4j.util.registry.IRegistry;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.List;
/**
* @author Eike Stepper
*/
public interface IManagedContainer extends IContainer
{
- public IFactory[] getFactories();
+ public IRegistry<IFactoryKey, IFactory> getFactoryRegistry();
- public IFactory[] getFactories(String productGroup);
+ public List<IElementProcessor> getPostProcessors();
- public IFactory getFactory(String productGroup, String factoryType);
+ public void addPostProcessor(IElementProcessor postProcessor);
- public void registerFactory(IFactory factory);
-
- public void deregisterFactory(IFactory factory);
+ public void removePostProcessor(IElementProcessor postProcessor);
public Object[] getElements(String productGroup);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactory.java
index 92b752d..add5be7 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactory.java
@@ -15,11 +15,9 @@ package org.eclipse.net4j.util.factory;
*/
public interface IFactory<PRODUCT>
{
- public String getProductGroup();
+ public IFactoryKey getKey();
- public String getType();
-
- public PRODUCT create(String description);
+ public PRODUCT create(String description) throws ProductCreationException;
public String getDescriptionFor(PRODUCT product);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactoryID.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactoryKey.java
index e5e1256..4862e8f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactoryID.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/IFactoryKey.java
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
* 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
@@ -8,14 +8,14 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.transport;
+package org.eclipse.net4j.util.factory;
/**
* @author Eike Stepper
*/
-public interface IProtocolFactoryID
+public interface IFactoryKey
{
- public ConnectorLocation getLocation();
+ public String getProductGroup();
- public String getProtocolID();
+ public String getType();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/ProductCreationException.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/ProductCreationException.java
new file mode 100644
index 0000000..c2bba42
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/factory/ProductCreationException.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.factory;
+
+/**
+ * @author Eike Stepper
+ */
+public class ProductCreationException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ public ProductCreationException()
+ {
+ }
+
+ public ProductCreationException(String message)
+ {
+ super(message);
+ }
+
+ public ProductCreationException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public ProductCreationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}