summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-10-23 15:29:34 (EDT)
committerEike Stepper2006-10-23 15:29:34 (EDT)
commit23c06b895f9b472914055e7ad751163203d7a272 (patch)
tree68b27a6166727406707801bdd2deedd559597d11
parentbb8c3765a13a93cb90777b8a59d660bb75d0372e (diff)
downloadcdo-23c06b895f9b472914055e7ad751163203d7a272.zip
cdo-23c06b895f9b472914055e7ad751163203d7a272.tar.gz
cdo-23c06b895f9b472914055e7ad751163203d7a272.tar.bz2
Net4jFactory
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java11
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SynchronizingCorrelatorTest.java1
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java11
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferUtil.java25
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPUtil.java48
8 files changed, 15 insertions, 88 deletions
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 8ff9db4..ab10ecd 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,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.tests;
+import org.eclipse.net4j.Net4jFactory;
import org.eclipse.net4j.tests.signal.Request1;
import org.eclipse.net4j.tests.signal.Request2;
import org.eclipse.net4j.tests.signal.TestSignalProtocol;
@@ -24,11 +25,9 @@ import org.eclipse.net4j.util.stream.BufferInputStream;
import org.eclipse.net4j.util.stream.BufferOutputStream;
import org.eclipse.internal.net4j.transport.BufferImpl;
-import org.eclipse.internal.net4j.transport.BufferUtil;
import org.eclipse.internal.net4j.transport.tcp.AbstractTCPConnector;
import org.eclipse.internal.net4j.transport.tcp.TCPAcceptorImpl;
import org.eclipse.internal.net4j.transport.tcp.TCPSelectorImpl;
-import org.eclipse.internal.net4j.transport.tcp.TCPUtil;
import java.util.Arrays;
import java.util.concurrent.ExecutorService;
@@ -62,16 +61,16 @@ public class SignalTest extends TestCase
System.out.print(getName());
System.out.println(" =================================");
- bufferPool = BufferUtil.createBufferPool((short)64);
+ bufferPool = Net4jFactory.createBufferPool((short)64);
LifecycleUtil.activate(bufferPool);
assertTrue(LifecycleUtil.isActive(bufferPool));
- selector = (TCPSelectorImpl)TCPUtil.createTCPSelector();
+ selector = (TCPSelectorImpl)Net4jFactory.createTCPSelector();
selector.activate();
assertTrue(selector.isActive());
- acceptor = (TCPAcceptorImpl)TCPUtil.createTCPAcceptor(bufferPool, selector);
- connector = (AbstractTCPConnector)TCPUtil.createTCPConnector(bufferPool, selector, "localhost");
+ acceptor = (TCPAcceptorImpl)Net4jFactory.createTCPAcceptor(bufferPool, selector);
+ connector = (AbstractTCPConnector)Net4jFactory.createTCPConnector(bufferPool, selector, "localhost");
}
@Override
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SynchronizingCorrelatorTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SynchronizingCorrelatorTest.java
index 905a547..0a2c4a4 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SynchronizingCorrelatorTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SynchronizingCorrelatorTest.java
@@ -13,7 +13,6 @@ package org.eclipse.net4j.tests;
import org.eclipse.net4j.util.concurrent.Synchronizer;
import org.eclipse.net4j.util.concurrent.SynchronizingCorrelator;
-
import junit.framework.TestCase;
/**
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 0d34b3c..a7f62b3 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.Net4jFactory;
import org.eclipse.net4j.transport.Buffer;
import org.eclipse.net4j.transport.BufferProvider;
import org.eclipse.net4j.transport.Channel;
@@ -25,11 +26,9 @@ import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.net4j.util.stream.ChannelInputStream;
import org.eclipse.net4j.util.stream.ChannelOutputStream;
-import org.eclipse.internal.net4j.transport.BufferUtil;
import org.eclipse.internal.net4j.transport.tcp.AbstractTCPConnector;
import org.eclipse.internal.net4j.transport.tcp.TCPAcceptorImpl;
import org.eclipse.internal.net4j.transport.tcp.TCPSelectorImpl;
-import org.eclipse.internal.net4j.transport.tcp.TCPUtil;
import java.io.BufferedReader;
import java.io.DataInputStream;
@@ -66,16 +65,16 @@ public class TCPTransportTest extends TestCase
System.out.print(getName());
System.out.println(" =================================");
- bufferPool = BufferUtil.createBufferPool();
+ bufferPool = Net4jFactory.createBufferPool();
LifecycleUtil.activate(bufferPool);
assertTrue(LifecycleUtil.isActive(bufferPool));
- selector = (TCPSelectorImpl)TCPUtil.createTCPSelector();
+ selector = (TCPSelectorImpl)Net4jFactory.createTCPSelector();
selector.activate();
assertTrue(selector.isActive());
- acceptor = (TCPAcceptorImpl)TCPUtil.createTCPAcceptor(bufferPool, selector);
- connector = (AbstractTCPConnector)TCPUtil.createTCPConnector(bufferPool, selector, "localhost");
+ acceptor = (TCPAcceptorImpl)Net4jFactory.createTCPAcceptor(bufferPool, selector);
+ connector = (AbstractTCPConnector)Net4jFactory.createTCPConnector(bufferPool, selector, "localhost");
}
@Override
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index da8d7fa..746ebe4 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: org.eclipse.internal.net4j.transport;version="0.8.0",
org.eclipse.internal.net4j.transport.embedded;version="0.8.0",
org.eclipse.internal.net4j.transport.tcp;version="0.8.0",
+ org.eclipse.net4j;version="0.8.0",
org.eclipse.net4j.message;version="0.8.0",
org.eclipse.net4j.remote;version="0.8.0",
org.eclipse.net4j.signal;version="0.8.0",
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferUtil.java
index b8847df..143b47d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferUtil.java
@@ -28,31 +28,6 @@ public final class BufferUtil
{
}
- public static BufferProvider createBufferFactory(short bufferCapacity)
- {
- return new BufferFactoryImpl(bufferCapacity);
- }
-
- public static BufferProvider createBufferFactory()
- {
- return new BufferFactoryImpl(DEFAULT_BUFFER_CAPACITY);
- }
-
- public static BufferProvider createBufferPool(BufferProvider factory)
- {
- return new BufferPoolImpl(factory);
- }
-
- public static BufferProvider createBufferPool(short bufferCapacity)
- {
- return createBufferPool(createBufferFactory(bufferCapacity));
- }
-
- public static BufferProvider createBufferPool()
- {
- return createBufferPool(DEFAULT_BUFFER_CAPACITY);
- }
-
public static BufferProvider getBufferProvider(Object object)
{
if (object instanceof BufferProvider)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java
index 3724e00..016fa43 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport.tcp;
+import org.eclipse.net4j.Net4jFactory;
import org.eclipse.net4j.transport.Buffer;
import org.eclipse.net4j.transport.Channel;
import org.eclipse.net4j.transport.ConnectorException;
@@ -260,7 +261,7 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
super.onAccessBeforeActivate();
if (selector == null)
{
- selector = TCPUtil.createTCPSelector();
+ selector = Net4jFactory.createTCPSelector();
LifecycleUtil.activate(selector);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
index 801c281..2a7e2bc 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport.tcp;
+import org.eclipse.net4j.Net4jFactory;
import org.eclipse.net4j.transport.Buffer;
import org.eclipse.net4j.transport.BufferProvider;
import org.eclipse.net4j.transport.ProtocolFactory;
@@ -295,7 +296,7 @@ public class TCPAcceptorImpl extends AbstractLifecycle implements TCPAcceptor, B
if (selector == null)
{
- selector = TCPUtil.createTCPSelector();
+ selector = Net4jFactory.createTCPSelector();
LifecycleUtil.activate(selector);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPUtil.java
index 634ca43..4bc7693 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPUtil.java
@@ -10,11 +10,6 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport.tcp;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.tcp.TCPAcceptor;
-import org.eclipse.net4j.transport.tcp.TCPConnector;
-import org.eclipse.net4j.transport.tcp.TCPSelector;
-
import java.nio.channels.SelectionKey;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
@@ -28,58 +23,15 @@ public final class TCPUtil
{
}
- public static TCPSelector createTCPSelector()
- {
- TCPSelectorImpl selector = new TCPSelectorImpl();
- return selector;
- }
-
- 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 TCPConnector createTCPConnector(BufferProvider bufferProvider,
- TCPSelector selector, String host, int port)
- {
- ClientTCPConnectorImpl connector = new ClientTCPConnectorImpl();
- connector.setBufferProvider(bufferProvider);
- connector.setSelector(selector);
- connector.setHost(host);
- connector.setPort(port);
- return connector;
- }
-
- public static TCPConnector createTCPConnector(BufferProvider bufferProvider,
- TCPSelector selector, String host)
- {
- return createTCPConnector(bufferProvider, selector, host, TCPConnector.DEFAULT_PORT);
- }
-
public static String toString(ServerSocketChannel channel)
{
return channel.toString();
- // return "ServerSocketChannel[" + channel.socket().getLocalSocketAddress()
// + "]";
}
public static String toString(SocketChannel channel)
{
return channel.toString();
- // return "SocketChannel[" + channel.socket().getRemoteSocketAddress() +
- // "]";
}
public static String formatInterestOps(int newOps)