summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-02-15 16:59:47 (EST)
committerEike Stepper2007-02-15 16:59:47 (EST)
commit88f53fb38b5d289a850faf0fc473aa3bbd9ee283 (patch)
tree7a52ef3639aaffd73a400530cb7d93f6cbea3294
parent66ca74412b6ab4f569d018077f8ebcf872d1e2fa (diff)
downloadcdo-88f53fb38b5d289a850faf0fc473aa3bbd9ee283.zip
cdo-88f53fb38b5d289a850faf0fc473aa3bbd9ee283.tar.gz
cdo-88f53fb38b5d289a850faf0fc473aa3bbd9ee283.tar.bz2
Factored containers out
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactoryImpl.java7
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java7
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterFactoryImpl.java33
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterImpl.java77
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptorFactory.java21
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnectorFactory.java21
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConstants.java (renamed from plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPContainerAdapter.java)10
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPUtil.java14
-rw-r--r--plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTCPTest.java6
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java2
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java2
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocolFactory.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryIDImpl.java5
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainer.java391
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainerAdapter.java41
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/ContainerImpl.java132
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/DefaultContainer.java113
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/TransportContainerAdapter.java49
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/.package.html47
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/Container.java98
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapter.java28
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapterFactory.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerUtil.java253
26 files changed, 32 insertions, 1357 deletions
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/TCPAcceptorFactoryImpl.java
index cbf482f..1077b4b 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/TCPAcceptorFactoryImpl.java
@@ -10,17 +10,18 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.tcp.TCPAcceptorFactory;
+import org.eclipse.net4j.tcp.TCPConstants;
import org.eclipse.net4j.transport.Acceptor;
+import org.eclipse.net4j.transport.AcceptorFactory;
/**
* @author Eike Stepper
*/
-public class TCPAcceptorFactoryImpl implements TCPAcceptorFactory
+public class TCPAcceptorFactoryImpl implements AcceptorFactory
{
public String getType()
{
- return TYPE;
+ return TCPConstants.TYPE;
}
public Acceptor createAcceptor()
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java
index 31bc98b..a0efe0e 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java
@@ -10,17 +10,18 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.tcp.TCPConnectorFactory;
+import org.eclipse.net4j.tcp.TCPConstants;
import org.eclipse.net4j.transport.Connector;
+import org.eclipse.net4j.transport.ConnectorFactory;
/**
* @author Eike Stepper
*/
-public class TCPConnectorFactoryImpl implements TCPConnectorFactory
+public class TCPConnectorFactoryImpl implements ConnectorFactory
{
public String getType()
{
- return TYPE;
+ return TCPConstants.TYPE;
}
public Connector createConnector()
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterFactoryImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterFactoryImpl.java
deleted file mode 100644
index a60876f..0000000
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterFactoryImpl.java
+++ /dev/null
@@ -1,33 +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.tcp;
-
-import org.eclipse.net4j.tcp.TCPContainerAdapter;
-import org.eclipse.net4j.transport.container.Container;
-import org.eclipse.net4j.transport.container.ContainerAdapter;
-import org.eclipse.net4j.transport.container.ContainerAdapterFactory;
-
-public final class TCPContainerAdapterFactoryImpl implements ContainerAdapterFactory
-{
- public TCPContainerAdapterFactoryImpl()
- {
- }
-
- public String getType()
- {
- return TCPContainerAdapter.TYPE;
- }
-
- public ContainerAdapter createAdapter(Container container)
- {
- return new TCPContainerAdapterImpl(container);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterImpl.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterImpl.java
deleted file mode 100644
index 8fc8fd8..0000000
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPContainerAdapterImpl.java
+++ /dev/null
@@ -1,77 +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.tcp;
-
-import org.eclipse.net4j.tcp.TCPContainerAdapter;
-import org.eclipse.net4j.tcp.TCPSelector;
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.AcceptorFactory;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorFactory;
-import org.eclipse.net4j.transport.container.Container;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-
-import org.eclipse.internal.net4j.transport.container.TransportContainerAdapter;
-
-/**
- * @author Eike Stepper
- */
-public class TCPContainerAdapterImpl extends TransportContainerAdapter implements TCPContainerAdapter
-{
- private TCPSelector selector;
-
- public TCPContainerAdapterImpl(Container container)
- {
- super(container, TYPE);
- selector = new TCPSelectorImpl();
- }
-
- public TCPSelector getSelector()
- {
- return selector;
- }
-
- @Override
- protected void onActivate() throws Exception
- {
- super.onActivate();
- LifecycleUtil.activate(selector);
- }
-
- @Override
- protected void onDeactivate() throws Exception
- {
- LifecycleUtil.deactivate(selector);
- super.onDeactivate();
- }
-
- protected AcceptorFactory createAcceptorFactory()
- {
- return new TCPAcceptorFactoryImpl();
- }
-
- protected ConnectorFactory createConnectorFactory()
- {
- return new TCPConnectorFactoryImpl();
- }
-
- public void initAcceptor(Acceptor acceptor)
- {
- TCPAcceptorImpl tcpAcceptor = (TCPAcceptorImpl)acceptor;
- tcpAcceptor.setSelector(getSelector());
- }
-
- public void initConnector(Connector connector)
- {
- AbstractTCPConnector tcpConnector = (AbstractTCPConnector)connector;
- tcpConnector.setSelector(getSelector());
- }
-}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptorFactory.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptorFactory.java
deleted file mode 100644
index 4b0cb68..0000000
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptorFactory.java
+++ /dev/null
@@ -1,21 +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.net4j.transport.AcceptorFactory;
-
-/**
- * @author Eike Stepper
- */
-public interface TCPAcceptorFactory extends AcceptorFactory
-{
- public static final String TYPE = TCPContainerAdapter.TYPE;
-}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnectorFactory.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnectorFactory.java
deleted file mode 100644
index 412b44d..0000000
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnectorFactory.java
+++ /dev/null
@@ -1,21 +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.net4j.transport.ConnectorFactory;
-
-/**
- * @author Eike Stepper
- */
-public interface TCPConnectorFactory extends ConnectorFactory
-{
- public static final String TYPE = TCPContainerAdapter.TYPE;
-}
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPContainerAdapter.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConstants.java
index b24d621..747dac4 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPContainerAdapter.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConstants.java
@@ -10,14 +10,16 @@
**************************************************************************/
package org.eclipse.net4j.tcp;
-import org.eclipse.net4j.transport.container.ContainerAdapter;
-
/**
* @author Eike Stepper
*/
-public interface TCPContainerAdapter extends ContainerAdapter
+public interface TCPConstants
{
+
public static final String TYPE = "TCP";
- public TCPSelector getSelector();
+ public static final String DEFAULT_ADDRESS = "0.0.0.0"; //$NON-NLS-1$
+
+ public static final int DEFAULT_PORT = 2036;
+
}
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
index a7cccdd..0802cd8 100644
--- 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
@@ -17,28 +17,24 @@ import org.eclipse.internal.net4j.transport.DescriptionUtil;
*/
public final class TCPUtil
{
- public static final String DEFAULT_ADDRESS = "0.0.0.0"; //$NON-NLS-1$
-
- public static final int DEFAULT_PORT = 2036;
-
private TCPUtil()
{
}
public static String createAcceptorDescription()
{
- return createAcceptorDescription(DEFAULT_ADDRESS);
+ return createAcceptorDescription(TCPConstants.DEFAULT_ADDRESS);
}
public static String createAcceptorDescription(String address)
{
- return createAcceptorDescription(address, DEFAULT_PORT);
+ return createAcceptorDescription(address, TCPConstants.DEFAULT_PORT);
}
public static String createAcceptorDescription(String address, int port)
{
Object[] elements = { address, port };
- return DescriptionUtil.getDescription(TCPContainerAdapter.TYPE, elements);
+ return DescriptionUtil.getDescription(TCPConstants.TYPE, elements);
}
public static String createConnectorDescription(String host)
@@ -53,12 +49,12 @@ public final class TCPUtil
public static String createConnectorDescription(String host, String userName)
{
- return createConnectorDescription(host, DEFAULT_PORT, userName);
+ return createConnectorDescription(host, TCPConstants.DEFAULT_PORT, userName);
}
public static String createConnectorDescription(String host, int port, String userName)
{
Object[] elements = { host, port, userName };
- return DescriptionUtil.getDescription(TCPContainerAdapter.TYPE, elements);
+ 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 4167f88..a6c9bc6 100644
--- a/plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.tests/META-INF/MANIFEST.MF
@@ -9,5 +9,4 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime,
org.junit,
- org.eclipse.net4j,
- org.eclipse.net4j.tcp
+ org.eclipse.net4j.tcp.container;visibility:=reexport
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/AbstractTCPTest.java
index ff0059e..e6dadac 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/AbstractTCPTest.java
@@ -10,10 +10,10 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.internal.tcp.TCPContainerAdapterFactoryImpl;
+import org.eclipse.net4j.container.Container;
+import org.eclipse.net4j.container.ContainerUtil;
import org.eclipse.net4j.tcp.TCPUtil;
-import org.eclipse.net4j.transport.container.Container;
-import org.eclipse.net4j.transport.container.ContainerUtil;
+import org.eclipse.net4j.tcp.internal.container.TCPContainerAdapterFactoryImpl;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.internal.net4j.transport.AbstractAcceptor;
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 ab0aed7..e5a6a61 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,11 +10,11 @@
**************************************************************************/
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.transport.Channel;
-import org.eclipse.net4j.transport.container.Container;
import java.util.Arrays;
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 1e36f47..f16871b 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,6 +10,7 @@
**************************************************************************/
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;
@@ -17,7 +18,6 @@ import org.eclipse.net4j.transport.AcceptorConnectorsEvent;
import org.eclipse.net4j.transport.Buffer;
import org.eclipse.net4j.transport.Channel;
import org.eclipse.net4j.transport.ConnectorChannelsEvent;
-import org.eclipse.net4j.transport.container.Container;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index 6222771..8af046c 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -13,7 +13,6 @@ Import-Package: org.eclipse.osgi.service.debug;version="1.0.0";resolution:=optio
org.osgi.util.tracker;version="1.3.0";resolution:=optional
Export-Package: org.eclipse.internal.net4j.bundle;version="0.8.0",
org.eclipse.internal.net4j.transport;version="0.8.0",
- org.eclipse.internal.net4j.transport.container;version="0.8.0",
org.eclipse.internal.net4j.transport.embedded;version="0.8.0",
org.eclipse.internal.net4j.util;version="0.8.0",
org.eclipse.internal.net4j.util.concurrent;version="0.8.0",
@@ -25,7 +24,6 @@ Export-Package: org.eclipse.internal.net4j.bundle;version="0.8.0",
org.eclipse.net4j.signal;version="0.8.0",
org.eclipse.net4j.stream;version="0.8.0",
org.eclipse.net4j.transport;version="0.8.0",
- org.eclipse.net4j.transport.container;version="0.8.0",
org.eclipse.net4j.user;version="0.8.0",
org.eclipse.net4j.util;version="0.8.0",
org.eclipse.net4j.util.concurrent;version="0.8.0",
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
index 15bdbbb..726cfbc 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
@@ -23,7 +23,6 @@ import org.eclipse.net4j.transport.ConnectorStateEvent;
import org.eclipse.net4j.transport.Protocol;
import org.eclipse.net4j.transport.ProtocolFactory;
import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.transport.container.ContainerUtil;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.INotifier;
import org.eclipse.net4j.util.lifecycle.LifecycleImpl;
@@ -460,7 +459,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return null;
}
- ProtocolFactoryID protocolFactoryID = ContainerUtil.createProtocolFactoryID(getLocation(), protocolID);
+ ProtocolFactoryID protocolFactoryID = ProtocolFactoryIDImpl.create(getLocation(), protocolID);
ProtocolFactory factory = protocolFactoryRegistry.get(protocolFactoryID);
if (factory == null)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocolFactory.java
index 25b92b5..748be5d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocolFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocolFactory.java
@@ -13,7 +13,6 @@ package org.eclipse.internal.net4j.transport;
import org.eclipse.net4j.transport.ConnectorLocation;
import org.eclipse.net4j.transport.ProtocolFactory;
import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.transport.container.ContainerUtil;
import java.text.MessageFormat;
@@ -43,7 +42,7 @@ public abstract class AbstractProtocolFactory implements ProtocolFactory
public ProtocolFactoryID getID(ConnectorLocation location)
{
- return ContainerUtil.createProtocolFactoryID(location, getProtocolID());
+ return ProtocolFactoryIDImpl.create(location, getProtocolID());
}
@Override
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryIDImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryIDImpl.java
index 833e256..d7c0413 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryIDImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryIDImpl.java
@@ -74,4 +74,9 @@ public class ProtocolFactoryIDImpl extends Value implements ProtocolFactoryID
{
return MessageFormat.format("{0}[{1}]", location, protocolID);
}
+
+ public static ProtocolFactoryID create(ConnectorLocation location, String protocolID)
+ {
+ return new ProtocolFactoryIDImpl(location, protocolID);
+ }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainer.java
deleted file mode 100644
index 2ff8bf3..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainer.java
+++ /dev/null
@@ -1,391 +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.container;
-
-import static org.eclipse.net4j.util.registry.IRegistryDelta.Kind.DEREGISTERED;
-import static org.eclipse.net4j.util.registry.IRegistryDelta.Kind.REGISTERED;
-
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.AcceptorFactory;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorFactory;
-import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.ProtocolFactory;
-import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.transport.container.Container;
-import org.eclipse.net4j.transport.container.ContainerAdapter;
-import org.eclipse.net4j.transport.container.ContainerAdapterFactory;
-import org.eclipse.net4j.util.lifecycle.LifecycleImpl;
-import org.eclipse.net4j.util.lifecycle.LifecycleListener;
-import org.eclipse.net4j.util.lifecycle.LifecycleNotifier;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.registry.IRegistry;
-import org.eclipse.net4j.util.registry.IRegistryDelta;
-import org.eclipse.net4j.util.registry.IRegistryEvent;
-import org.eclipse.net4j.util.registry.IRegistryListener;
-
-import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.transport.AbstractAcceptor;
-import org.eclipse.internal.net4j.transport.AbstractConnector;
-import org.eclipse.internal.net4j.transport.DescriptionUtil;
-import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractContainer extends LifecycleImpl implements Container
-{
- private IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry;
-
- private IRegistry<String, ContainerAdapter> adapters = new HashMapRegistry();
-
- private LifecycleListener acceptorLifecycleListener = new LifecycleListener()
- {
- public void notifyLifecycleAboutToActivate(LifecycleNotifier notifier)
- {
- // Do nothing
- }
-
- public void notifyLifecycleActivated(LifecycleNotifier notifier)
- {
- // Do nothing
- }
-
- public void notifyLifecycleDeactivating(LifecycleNotifier notifier)
- {
- deregisterAcceptor((Acceptor)notifier);
- }
- };
-
- private LifecycleListener connectorLifecycleListener = new LifecycleListener()
- {
- public void notifyLifecycleAboutToActivate(LifecycleNotifier notifier)
- {
- // Do nothing
- }
-
- public void notifyLifecycleActivated(LifecycleNotifier notifier)
- {
- // Do nothing
- }
-
- public void notifyLifecycleDeactivating(LifecycleNotifier notifier)
- {
- deregisterConnector((Connector)notifier);
- }
- };
-
- private IRegistryListener adapterFactoryRegistryListener = new IRegistryListener<String, ContainerAdapterFactory>()
- {
- public void notifyRegistryEvent(IRegistryEvent<String, ContainerAdapterFactory> event)
- {
- IRegistryDelta<String, ContainerAdapterFactory>[] deltas = event.getDeltas();
- for (IRegistryDelta<String, ContainerAdapterFactory> delta : deltas)
- {
- try
- {
- ContainerAdapterFactory factory = delta.getValue();
- switch (delta.getKind())
- {
- case REGISTERED:
- addAdapter(factory.getType());
- break;
-
- case DEREGISTERED:
- // TODO Implement method .notifyRegistryEvent()
- throw new UnsupportedOperationException("Not yet implemented");
- }
- }
- catch (Exception ex)
- {
- Net4j.LOG.error(ex);
- }
- }
- }
- };
-
- protected AbstractContainer(IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry)
- {
- this.adapterFactoryRegistry = adapterFactoryRegistry;
- }
-
- public IRegistry<String, ContainerAdapterFactory> getAdapterFactoryRegistry()
- {
- return adapterFactoryRegistry;
- }
-
- public IRegistry<String, ContainerAdapter> getAdapters()
- {
- return adapters;
- }
-
- public ContainerAdapter getAdapter(String type)
- {
- return adapters.get(type);
- }
-
- public Acceptor getAcceptor(String description)
- {
- IRegistry<String, Acceptor> registry = getAcceptorRegistry();
- Acceptor acceptor = registry.get(description);
- if (acceptor == null)
- {
- acceptor = createAcceptor(description);
- if (acceptor != null)
- {
- LifecycleUtil.addListener(acceptor, acceptorLifecycleListener);
- registry.put(description, acceptor);
- }
- }
-
- return acceptor;
- }
-
- public Connector getConnector(String description)
- {
- IRegistry<String, Connector> registry = getConnectorRegistry();
- Connector connector = registry.get(description);
- if (connector == null)
- {
- connector = createConnector(description);
- if (connector != null)
- {
- LifecycleUtil.addListener(connector, connectorLifecycleListener);
- registry.put(description, connector);
- }
- }
-
- return connector;
- }
-
- public void register(ContainerAdapterFactory factory)
- {
- IRegistry<String, ContainerAdapterFactory> registry = getAdapterFactoryRegistry();
- registry.put(factory.getType(), factory);
- }
-
- public void deregister(ContainerAdapterFactory factory)
- {
- IRegistry<String, ContainerAdapterFactory> registry = getAdapterFactoryRegistry();
- registry.remove(factory.getType());
- }
-
- public void register(AcceptorFactory factory)
- {
- IRegistry<String, AcceptorFactory> registry = getAcceptorFactoryRegistry();
- registry.put(factory.getType(), factory);
- }
-
- public void deregister(AcceptorFactory factory)
- {
- IRegistry<String, AcceptorFactory> registry = getAcceptorFactoryRegistry();
- registry.remove(factory.getType());
- }
-
- public void register(ConnectorFactory factory)
- {
- IRegistry<String, ConnectorFactory> registry = getConnectorFactoryRegistry();
- registry.put(factory.getType(), factory);
- }
-
- public void deregister(ConnectorFactory factory)
- {
- IRegistry<String, ConnectorFactory> registry = getConnectorFactoryRegistry();
- registry.remove(factory.getType());
- }
-
- public void register(ProtocolFactory factory)
- {
- IRegistry<ProtocolFactoryID, ProtocolFactory> registry = getProtocolFactoryRegistry();
- for (ConnectorLocation location : factory.getLocations())
- {
- ProtocolFactoryID id = factory.getID(location);
- registry.put(id, factory);
- }
- }
-
- public void deregister(ProtocolFactory factory)
- {
- IRegistry<ProtocolFactoryID, ProtocolFactory> registry = getProtocolFactoryRegistry();
- for (ConnectorLocation location : factory.getLocations())
- {
- ProtocolFactoryID id = factory.getID(location);
- registry.remove(id);
- }
- }
-
- @Override
- protected void onAboutToActivate() throws Exception
- {
- super.onAboutToActivate();
- if (adapterFactoryRegistry == null)
- {
- throw new IllegalStateException("adapterFactoryRegistry == null");
- }
- }
-
- @Override
- protected void onActivate() throws Exception
- {
- super.onActivate();
- IRegistry<String, ContainerAdapterFactory> registry = getAdapterFactoryRegistry();
- for (ContainerAdapterFactory factory : registry.values())
- {
- addAdapter(factory.getType());
- }
-
- registry.addRegistryListener(adapterFactoryRegistryListener);
- }
-
- @Override
- protected void onDeactivate() throws Exception
- {
- getAdapterFactoryRegistry().removeRegistryListener(adapterFactoryRegistryListener);
- for (ContainerAdapter adapter : adapters.values())
- {
- LifecycleUtil.deactivateNoisy(adapter);
- }
-
- for (Connector connector : getConnectorRegistry().values())
- {
- LifecycleUtil.deactivateNoisy(connector);
- }
-
- for (Acceptor acceptor : getAcceptorRegistry().values())
- {
- LifecycleUtil.deactivateNoisy(acceptor);
- }
-
- super.onDeactivate();
- }
-
- private void deregisterAcceptor(Acceptor acceptor)
- {
- getAcceptorRegistry().remove(acceptor.getDescription());
- LifecycleUtil.removeListener(acceptor, acceptorLifecycleListener);
- }
-
- private void deregisterConnector(Connector connector)
- {
- getConnectorRegistry().remove(connector.getDescription());
- LifecycleUtil.removeListener(connector, connectorLifecycleListener);
- }
-
- private Acceptor createAcceptor(String description)
- {
- IRegistry<String, AcceptorFactory> registry = getAcceptorFactoryRegistry();
- if (registry == null)
- {
- return null;
- }
-
- String type = DescriptionUtil.getType(description);
- AcceptorFactory factory = registry.get(type);
- if (factory == null)
- {
- return null;
- }
-
- AbstractAcceptor acceptor = (AbstractAcceptor)factory.createAcceptor();
- acceptor.setReceiveExecutor(getExecutorService());
- acceptor.setBufferProvider(getBufferProvider());
- acceptor.setDescription(description);
- acceptor.setProtocolFactoryRegistry(getProtocolFactoryRegistry());
-
- for (ContainerAdapter adapter : adapters.values())
- {
- adapter.initAcceptor(acceptor);
- }
-
- try
- {
- LifecycleUtil.activate(acceptor);
- }
- catch (Exception ex)
- {
- Net4j.LOG.error(ex);
- acceptor = null;
- }
-
- return acceptor;
- }
-
- private Connector createConnector(String description)
- {
- IRegistry<String, ConnectorFactory> registry = getConnectorFactoryRegistry();
- if (registry == null)
- {
- return null;
- }
-
- String type = DescriptionUtil.getType(description);
- ConnectorFactory factory = registry.get(type);
- if (factory == null)
- {
- return null;
- }
-
- AbstractConnector connector = (AbstractConnector)factory.createConnector();
- connector.setReceiveExecutor(getExecutorService());
- connector.setBufferProvider(getBufferProvider());
- connector.setDescription(description);
- connector.setProtocolFactoryRegistry(getProtocolFactoryRegistry());
-
- for (ContainerAdapter adapter : adapters.values())
- {
- adapter.initConnector(connector);
- }
-
- try
- {
- LifecycleUtil.activate(connector);
- }
- catch (Exception ex)
- {
- Net4j.LOG.error(ex);
- connector = null;
- }
-
- return connector;
- }
-
- private ContainerAdapter addAdapter(String type)
- {
- ContainerAdapterFactory factory = adapterFactoryRegistry.get(type);
- if (factory == null)
- {
- return null;
- }
-
- ContainerAdapter adapter = createAdapter(factory);
- if (adapter != null)
- {
- adapters.put(type, adapter);
- }
-
- return adapter;
- }
-
- private ContainerAdapter createAdapter(ContainerAdapterFactory factory)
- {
- try
- {
- ContainerAdapter adapter = factory.createAdapter(this);
- LifecycleUtil.activate(adapter);
- return adapter;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return null;
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainerAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainerAdapter.java
deleted file mode 100644
index 65e42a9..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/AbstractContainerAdapter.java
+++ /dev/null
@@ -1,41 +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.container;
-
-import org.eclipse.net4j.transport.container.Container;
-import org.eclipse.net4j.transport.container.ContainerAdapter;
-import org.eclipse.net4j.util.lifecycle.LifecycleImpl;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractContainerAdapter extends LifecycleImpl implements ContainerAdapter
-{
- private Container container;
-
- private String type;
-
- public AbstractContainerAdapter(Container container, String type)
- {
- this.container = container;
- this.type = type;
- }
-
- public Container getContainer()
- {
- return container;
- }
-
- public String getType()
- {
- return type;
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/ContainerImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/ContainerImpl.java
deleted file mode 100644
index 53c132e..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/ContainerImpl.java
+++ /dev/null
@@ -1,132 +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.container;
-
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.AcceptorFactory;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
-import org.eclipse.net4j.transport.ChannelID;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorFactory;
-import org.eclipse.net4j.transport.ProtocolFactory;
-import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.transport.container.ContainerAdapterFactory;
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import java.util.concurrent.ExecutorService;
-
-/**
- * @author Eike Stepper
- */
-public class ContainerImpl extends AbstractContainer
-{
- private ExecutorService executorService;
-
- private BufferProvider bufferProvider;
-
- private IRegistry<String, AcceptorFactory> acceptorFactoryRegistry;
-
- private IRegistry<String, ConnectorFactory> connectorFactoryRegistry;
-
- private IRegistry<ProtocolFactoryID, ProtocolFactory> protocolFactoryRegistry;
-
- private IRegistry<String, Acceptor> acceptorRegistry;
-
- private IRegistry<String, Connector> connectorRegistry;
-
- private IRegistry<ChannelID, Channel> channelRegistry;
-
- public ContainerImpl(IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry)
- {
- super(adapterFactoryRegistry);
- }
-
- public ExecutorService getExecutorService()
- {
- return executorService;
- }
-
- public void setExecutorService(ExecutorService executorService)
- {
- this.executorService = executorService;
- }
-
- public BufferProvider getBufferProvider()
- {
- return bufferProvider;
- }
-
- public void setBufferProvider(BufferProvider bufferProvider)
- {
- this.bufferProvider = bufferProvider;
- }
-
- public IRegistry<String, AcceptorFactory> getAcceptorFactoryRegistry()
- {
- return acceptorFactoryRegistry;
- }
-
- public void setAcceptorFactoryRegistry(IRegistry<String, AcceptorFactory> acceptorFactoryRegistry)
- {
- this.acceptorFactoryRegistry = acceptorFactoryRegistry;
- }
-
- public IRegistry<String, ConnectorFactory> getConnectorFactoryRegistry()
- {
- return connectorFactoryRegistry;
- }
-
- public void setConnectorFactoryRegistry(IRegistry<String, ConnectorFactory> connectorFactoryRegistry)
- {
- this.connectorFactoryRegistry = connectorFactoryRegistry;
- }
-
- public IRegistry<ProtocolFactoryID, ProtocolFactory> getProtocolFactoryRegistry()
- {
- return protocolFactoryRegistry;
- }
-
- public void setProtocolFactoryRegistry(IRegistry<ProtocolFactoryID, ProtocolFactory> protocolFactoryRegistry)
- {
- this.protocolFactoryRegistry = protocolFactoryRegistry;
- }
-
- public IRegistry<String, Acceptor> getAcceptorRegistry()
- {
- return acceptorRegistry;
- }
-
- public void setAcceptorRegistry(IRegistry<String, Acceptor> acceptorRegistry)
- {
- this.acceptorRegistry = acceptorRegistry;
- }
-
- public IRegistry<String, Connector> getConnectorRegistry()
- {
- return connectorRegistry;
- }
-
- public void setConnectorRegistry(IRegistry<String, Connector> connectorRegistry)
- {
- this.connectorRegistry = connectorRegistry;
- }
-
- public IRegistry<ChannelID, Channel> getChannelRegistry()
- {
- return channelRegistry;
- }
-
- public void setChannelRegistry(IRegistry<ChannelID, Channel> channelRegistry)
- {
- this.channelRegistry = channelRegistry;
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/DefaultContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/DefaultContainer.java
deleted file mode 100644
index daaf4f9..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/DefaultContainer.java
+++ /dev/null
@@ -1,113 +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.container;
-
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.container.ContainerAdapterFactory;
-import org.eclipse.net4j.transport.container.ContainerUtil;
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-/**
- * @author Eike Stepper
- */
-public class DefaultContainer extends ContainerImpl
-{
- 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;
- }
- };
-
- public DefaultContainer()
- {
- this(createAdapterFactoryRegistry(), DEFAULT_BUFFER_CAPACITY);
- }
-
- public DefaultContainer(short bufferCapacity)
- {
- this(createAdapterFactoryRegistry(), bufferCapacity);
- }
-
- public DefaultContainer(IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry)
- {
- this(adapterFactoryRegistry, DEFAULT_BUFFER_CAPACITY);
- }
-
- public DefaultContainer(IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry, short bufferCapacity)
- {
- super(adapterFactoryRegistry);
- setExecutorService(createExecutorService());
- setBufferProvider(createBufferProvider(bufferCapacity));
- setAcceptorFactoryRegistry(createAcceptorFactoryRegistry());
- setConnectorFactoryRegistry(createConnectorFactoryRegistry());
- setProtocolFactoryRegistry(createProtocolFactoryRegistry());
- setAcceptorRegistry(createAcceptorRegistry());
- setConnectorRegistry(createConnectorRegistry());
- setChannelRegistry(createChannelRegistry());
- }
-
- protected static IRegistry<String, ContainerAdapterFactory> createAdapterFactoryRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected HashMapRegistry createAcceptorFactoryRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected HashMapRegistry createConnectorFactoryRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected HashMapRegistry createProtocolFactoryRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected HashMapRegistry createAcceptorRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected HashMapRegistry createConnectorRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected HashMapRegistry createChannelRegistry()
- {
- return new HashMapRegistry();
- }
-
- protected ExecutorService createExecutorService()
- {
- return Executors.newCachedThreadPool(THREAD_FACTORY);
- }
-
- protected BufferProvider createBufferProvider(short bufferCapacity)
- {
- return ContainerUtil.createBufferPool(bufferCapacity);
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/TransportContainerAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/TransportContainerAdapter.java
deleted file mode 100644
index 7f05e56..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/container/TransportContainerAdapter.java
+++ /dev/null
@@ -1,49 +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.container;
-
-import org.eclipse.net4j.transport.AcceptorFactory;
-import org.eclipse.net4j.transport.ConnectorFactory;
-import org.eclipse.net4j.transport.container.Container;
-
-public abstract class TransportContainerAdapter extends AbstractContainerAdapter
-{
- private AcceptorFactory acceptorFactory;
-
- private ConnectorFactory connectorFactory;
-
- protected TransportContainerAdapter(Container container, String type)
- {
- super(container, type);
- acceptorFactory = createAcceptorFactory();
- connectorFactory = createConnectorFactory();
- }
-
- @Override
- protected void onActivate() throws Exception
- {
- super.onActivate();
- getContainer().register(acceptorFactory);
- getContainer().register(connectorFactory);
- }
-
- @Override
- protected void onDeactivate() throws Exception
- {
- getContainer().deregister(connectorFactory);
- getContainer().deregister(acceptorFactory);
- super.onDeactivate();
- }
-
- protected abstract AcceptorFactory createAcceptorFactory();
-
- protected abstract ConnectorFactory createConnectorFactory();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/.package.html b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/.package.html
deleted file mode 100644
index ab7a22e..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/.package.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<title>Package Description</title>
-<!--
-
- 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
-
--->
-</head>
-<body bgcolor="white">
-
-The main package of the Net4j API. Contains sub packages for the different layers
-of Net4j as well as a collection of {@link org.eclipse.net4j.util utility} packages and a
-{@link org.eclipse.net4j.util.Net4jUtil factory} class for the creation various
-instances of the transport layer interfaces.
-<p>
-
-<!--
-
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
--->
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/Container.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/Container.java
deleted file mode 100644
index 0398da9..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/Container.java
+++ /dev/null
@@ -1,98 +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.container;
-
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.AcceptorFactory;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
-import org.eclipse.net4j.transport.ChannelID;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorFactory;
-import org.eclipse.net4j.transport.ProtocolFactory;
-import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import java.util.concurrent.ExecutorService;
-
-/**
- * @author Eike Stepper
- */
-public interface Container
-{
- public ExecutorService getExecutorService();
-
- public BufferProvider getBufferProvider();
-
- /*
- * ContainerAdapterFactory
- */
-
- public IRegistry<String, ContainerAdapterFactory> getAdapterFactoryRegistry();
-
- public void register(ContainerAdapterFactory factory);
-
- public void deregister(ContainerAdapterFactory factory);
-
- public ContainerAdapter getAdapter(String type);
-
- /*
- * AcceptorFactory
- */
-
- public IRegistry<String, AcceptorFactory> getAcceptorFactoryRegistry();
-
- public void register(AcceptorFactory factory);
-
- public void deregister(AcceptorFactory factory);
-
- /*
- * ConnectorFactory
- */
-
- public IRegistry<String, ConnectorFactory> getConnectorFactoryRegistry();
-
- public void register(ConnectorFactory factory);
-
- public void deregister(ConnectorFactory factory);
-
- /*
- * ProtocolFactory
- */
-
- public IRegistry<ProtocolFactoryID, ProtocolFactory> getProtocolFactoryRegistry();
-
- public void register(ProtocolFactory factory);
-
- public void deregister(ProtocolFactory factory);
-
- /*
- * Acceptor
- */
-
- public IRegistry<String, Acceptor> getAcceptorRegistry();
-
- public Acceptor getAcceptor(String description);
-
- /*
- * Connector
- */
-
- public IRegistry<String, Connector> getConnectorRegistry();
-
- public Connector getConnector(String description);
-
- /*
- * Channel
- */
-
- public IRegistry<ChannelID, Channel> getChannelRegistry();
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapter.java
deleted file mode 100644
index 2853a89..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapter.java
+++ /dev/null
@@ -1,28 +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.container;
-
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.Connector;
-
-/**
- * @author Eike Stepper
- */
-public interface ContainerAdapter
-{
- public Container getContainer();
-
- public String getType();
-
- public void initAcceptor(Acceptor acceptor);
-
- public void initConnector(Connector connector);
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapterFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapterFactory.java
deleted file mode 100644
index 7869f59..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerAdapterFactory.java
+++ /dev/null
@@ -1,21 +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.container;
-
-/**
- * @author Eike Stepper
- */
-public interface ContainerAdapterFactory
-{
- public String getType();
-
- public ContainerAdapter createAdapter(Container container);
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerUtil.java
deleted file mode 100644
index 92efc85..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/container/ContainerUtil.java
+++ /dev/null
@@ -1,253 +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.container;
-
-import org.eclipse.net4j.transport.BufferPool;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
-import org.eclipse.net4j.transport.ChannelID;
-import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.Protocol;
-import org.eclipse.net4j.transport.ProtocolFactory;
-import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import org.eclipse.internal.net4j.transport.BufferFactoryImpl;
-import org.eclipse.internal.net4j.transport.BufferPoolImpl;
-import org.eclipse.internal.net4j.transport.BufferUtil;
-import org.eclipse.internal.net4j.transport.ProtocolFactoryIDImpl;
-import org.eclipse.internal.net4j.transport.container.DefaultContainer;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public final class ContainerUtil
-{
- private ContainerUtil()
- {
- }
-
- public static ProtocolFactoryID createProtocolFactoryID(ConnectorLocation connectorLocation, String protocolID)
- {
- return new ProtocolFactoryIDImpl(connectorLocation, protocolID);
- }
-
- public static Container createContainer()
- {
- return new DefaultContainer();
- }
-
- public static Container createContainer(short bufferCapacity)
- {
- return new DefaultContainer(bufferCapacity);
- }
-
- public static Container createContainer(IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry)
- {
- return new DefaultContainer(adapterFactoryRegistry);
- }
-
- public static Container createContainer(IRegistry<String, ContainerAdapterFactory> adapterFactoryRegistry,
- short bufferCapacity)
- {
- return new DefaultContainer(adapterFactoryRegistry, bufferCapacity);
- }
-
- public static BufferProvider createBufferFactory(short bufferCapacity)
- {
- return new BufferFactoryImpl(bufferCapacity);
- }
-
- public static BufferProvider createBufferFactory()
- {
- return new BufferFactoryImpl(BufferUtil.DEFAULT_BUFFER_CAPACITY);
- }
-
- public static BufferPool createBufferPool(BufferProvider factory)
- {
- return new BufferPoolImpl(factory);
- }
-
- public static BufferPool createBufferPool(short bufferCapacity)
- {
- return createBufferPool(createBufferFactory(bufferCapacity));
- }
-
- public static BufferPool createBufferPool()
- {
- return createBufferPool(createBufferFactory());
- }
-
- // public static Connector createEmbeddedConnector(BufferProvider
- // bufferProvider)
- // {
- // ClientEmbeddedConnectorImpl connector = new ClientEmbeddedConnectorImpl();
- // connector.setBufferProvider(bufferProvider);
- // return connector;
- // }
- //
- // public static TCPAcceptor createTCPAcceptor(BufferProvider bufferProvider,
- // TCPSelector selector, String address,
- // int port)
- // {
- // TCPAcceptorImpl acceptor = new TCPAcceptorImpl();
- // acceptor.setBufferProvider(bufferProvider);
- // acceptor.setSelector(selector);
- // acceptor.setListenPort(port);
- // acceptor.setListenAddr(address);
- // return acceptor;
- // }
- //
- // public static TCPAcceptor createTCPAcceptor(BufferProvider bufferProvider,
- // TCPSelector selector)
- // {
- // return createTCPAcceptor(bufferProvider, selector,
- // TCPAcceptor.DEFAULT_ADDRESS, TCPAcceptor.DEFAULT_PORT);
- // }
- //
- // public static Connector createTCPConnector(BufferProvider bufferProvider,
- // TCPSelector selector, String host, int port)
- // {
- // ClientTCPConnectorImpl connector = new ClientTCPConnectorImpl();
- // connector.setBufferProvider(bufferProvider);
- // connector.setSelector(selector);
- // connector.setDescription(new TCPConnectorDescriptionImpl(host, port));
- // return connector;
- // }
- //
- // public static Connector createTCPConnector(BufferProvider bufferProvider,
- // TCPSelector selector, String host)
- // {
- // return createTCPConnector(bufferProvider, selector, host,
- // TCPConnectorDescription.DEFAULT_PORT);
- // }
- //
- // public static TCPSelector createTCPSelector()
- // {
- // return new TCPSelectorImpl();
- // }
-
- public static Collection<Channel> getChannels(Container container, String protocolID, Set<ConnectorLocation> locations)
- {
- if (locations == null)
- {
- locations = ProtocolFactory.SYMMETRIC;
- }
-
- IRegistry<ChannelID, Channel> channelRegistry = container.getChannelRegistry();
- if (channelRegistry == null)
- {
- return null;
- }
-
- Collection<Channel> channels = channelRegistry.values();
- Collection<Channel> result = new ArrayList(channels.size());
- for (Channel channel : channels)
- {
- if (locations.contains(channel.getConnector().getLocation()))
- {
- if (protocolID == null || protocolID.length() == 0)
- {
- result.add(channel);
- }
- else
- {
- if (channel.getReceiveHandler() instanceof Protocol)
- {
- Protocol protocol = (Protocol)channel.getReceiveHandler();
- if (protocolID.equals(protocol.getProtocolID()))
- {
- result.add(channel);
- }
- }
- }
- }
- }
-
- return result;
- }
-
- public static Collection<Channel> getChannels(Container container, String protocolID)
- {
- return getChannels(container, protocolID, null);
- }
-
- public static Collection<Channel> getChannels(Container container, Set<ConnectorLocation> locations)
- {
- return getChannels(container, null, locations);
- }
-
- // public static Map<Type, IRegistry<ProtocolFactoryID, ProtocolFactory>>
- // createProtocolFactoryRegistries(Set<Type> types)
- // {
- // Map<Type, IRegistry<ProtocolFactoryID, ProtocolFactory>> result = new
- // HashMap();
- // for (Type type : types)
- // {
- // result.put(type, new HashMapRegistry());
- // }
- //
- // return result;
- // }
- //
- // public static Set<Type> registerProtocolFactory(ProtocolFactory factory,
- // Map<Type, IRegistry<ProtocolFactoryID, ProtocolFactory>> registries)
- // {
- // Set<Type> result = new HashSet();
- // for (Entry<Type, IRegistry<ProtocolFactoryID, ProtocolFactory>> entry :
- // registries.entrySet())
- // {
- // Type type = entry.getKey();
- // IRegistry<ProtocolFactoryID, ProtocolFactory> registry = entry.getValue();
- // if (factory.getConnectorTypes().contains(type))
- // {
- // ProtocolFactoryID id = factory.createID(type);
- // if (!registry.containsKey(id))
- // {
- // registry.put(id, factory);
- // }
- // else
- // {
- // result.add(type);
- // }
- // }
- // }
- //
- // return result;
- // }
- //
- // public static Set<Type> deregisterProtocolFactory(ProtocolFactory factory,
- // Map<Type, IRegistry<ProtocolFactoryID, ProtocolFactory>> registries)
- // {
- // Set<Type> result = new HashSet();
- // for (Entry<Type, IRegistry<ProtocolFactoryID, ProtocolFactory>> entry :
- // registries.entrySet())
- // {
- // Type type = entry.getKey();
- // IRegistry<ProtocolFactoryID, ProtocolFactory> registry = entry.getValue();
- // if (factory.getConnectorTypes().contains(type))
- // {
- // ProtocolFactoryID id = factory.createID(type);
- // ProtocolFactory old = registry.remove(id);
- // if (old != null)
- // {
- // result.add(type);
- // }
- // }
- // }
- //
- // return result;
- // }
-}