summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-10-24 11:07:06 (EDT)
committerEike Stepper2006-10-24 11:07:06 (EDT)
commit09e08ffc0f76b6205c5f79048183e4277066f768 (patch)
tree51beb8900e1c445db33b51049a5383d6d68add96
parent96f26e8e3ce41e19f45994ec87a6a9cdcf744812 (diff)
downloadcdo-09e08ffc0f76b6205c5f79048183e4277066f768.zip
cdo-09e08ffc0f76b6205c5f79048183e4277066f768.tar.gz
cdo-09e08ffc0f76b6205c5f79048183e4277066f768.tar.bz2
Factory method for embedded connectors
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jFactory.java23
2 files changed, 20 insertions, 7 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java
index 7acc06d..824348e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java
@@ -15,6 +15,10 @@ package org.eclipse.internal.net4j.transport.embedded;
*/
public class ClientEmbeddedConnectorImpl extends AbstractEmbeddedConnector
{
+ public ClientEmbeddedConnectorImpl()
+ {
+ }
+
public Type getType()
{
return Type.CLIENT;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jFactory.java
index 1e5e635..3bbed80 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/Net4jFactory.java
@@ -10,7 +10,9 @@
**************************************************************************/
package org.eclipse.net4j;
+import org.eclipse.net4j.transport.BufferPool;
import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.Connector;
import org.eclipse.net4j.transport.tcp.TCPAcceptor;
import org.eclipse.net4j.transport.tcp.TCPConnector;
import org.eclipse.net4j.transport.tcp.TCPSelector;
@@ -18,6 +20,7 @@ import org.eclipse.net4j.transport.tcp.TCPSelector;
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.embedded.ClientEmbeddedConnectorImpl;
import org.eclipse.internal.net4j.transport.tcp.ClientTCPConnectorImpl;
import org.eclipse.internal.net4j.transport.tcp.TCPAcceptorImpl;
import org.eclipse.internal.net4j.transport.tcp.TCPSelectorImpl;
@@ -41,25 +44,26 @@ public final class Net4jFactory
return new BufferFactoryImpl(BufferUtil.DEFAULT_BUFFER_CAPACITY);
}
- public static BufferProvider createBufferPool(BufferProvider factory)
+ public static BufferPool createBufferPool(BufferProvider factory)
{
return new BufferPoolImpl(factory);
}
- public static BufferProvider createBufferPool(short bufferCapacity)
+ public static BufferPool createBufferPool(short bufferCapacity)
{
return createBufferPool(createBufferFactory(bufferCapacity));
}
- public static BufferProvider createBufferPool()
+ public static BufferPool createBufferPool()
{
- return createBufferPool(BufferUtil.DEFAULT_BUFFER_CAPACITY);
+ return createBufferPool(createBufferFactory());
}
- public static TCPSelector createTCPSelector()
+ public static Connector createEmbeddedConnector(BufferProvider bufferProvider)
{
- TCPSelectorImpl selector = new TCPSelectorImpl();
- return selector;
+ ClientEmbeddedConnectorImpl connector = new ClientEmbeddedConnectorImpl();
+ connector.setBufferProvider(bufferProvider);
+ return connector;
}
public static TCPAcceptor createTCPAcceptor(BufferProvider bufferProvider, TCPSelector selector,
@@ -95,4 +99,9 @@ public final class Net4jFactory
{
return createTCPConnector(bufferProvider, selector, host, TCPConnector.DEFAULT_PORT);
}
+
+ public static TCPSelector createTCPSelector()
+ {
+ return new TCPSelectorImpl();
+ }
}