summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-03-05 14:33:39 (EST)
committerEike Stepper2007-03-05 14:33:39 (EST)
commit0e5257c758ee36a15e4d0dd348d5eb2b6d2df407 (patch)
treee3c2814dc51d804f539d561a551b3feaee14259e
parent04a5120cb7b07cabf64a62ff3ab6dca5744c680d (diff)
downloadcdo-0e5257c758ee36a15e4d0dd348d5eb2b6d2df407.zip
cdo-0e5257c758ee36a15e4d0dd348d5eb2b6d2df407.tar.gz
cdo-0e5257c758ee36a15e4d0dd348d5eb2b6d2df407.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsItemProvider.java8
-rw-r--r--plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java15
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/AbstractJVMConnector.java24
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ClientJVMConnectorImpl.java10
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorImpl.java16
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorManagerImpl.java3
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/ServerJVMConnectorImpl.java2
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMAcceptor.java4
-rw-r--r--plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/jvm/JVMConnector.java4
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/AbstractTCPConnector.java45
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ClientTCPConnectorImpl.java4
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannelImpl.java18
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ServerTCPConnectorImpl.java4
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPAcceptorImpl.java16
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPConnectorFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/TCPSelectorImpl.java8
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPAcceptor.java4
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/tcp/TCPConnector.java4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTCPTest.java16
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java6
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java74
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TestProtocolFactory.java24
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request1.java4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request2.java4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java16
-rw-r--r--plugins/org.eclipse.net4j/.classpath2
-rw-r--r--plugins/org.eclipse.net4j/.cvsignore1
-rw-r--r--plugins/org.eclipse.net4j/.project6
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractAcceptor.java244
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java216
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java)22
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java)18
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPool.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java)26
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferProvider.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferProviderImpl.java)16
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferUtil.java8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java)88
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java)246
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorCredentials.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorCredentialsImpl.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java)27
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocolFactory.java)12
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryID.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ProtocolFactoryIDImpl.java)14
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerDelta.java34
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java90
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java70
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/Event.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/EventImpl.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/Notifier.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/NotifierImpl.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/Lifecycle.java132
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEvent.java42
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleImpl.java194
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/NotifyingLifecycleImpl.java49
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java53
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/DelegatingRegistry.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/AbstractDelegatingRegistry.java)8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapDelegatingRegistry.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapRegistry.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/AbstractRegistry.java)146
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/IMessageDeserializer.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/MessageDeserializer.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/IMessageSerializer.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/MessageSerializer.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/IServiceExporter.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/ServiceImporter.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/IServiceImporter.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/ServiceExporter.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java30
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java12
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java22
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelInputStream.java10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelOutputStream.java8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Acceptor.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorAcceptedEvent.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/AcceptorConnectorsEvent.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/AcceptorFactory.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Buffer.java)16
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferHandler.java)8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferPool.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferProvider.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java)16
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ChannelID.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java)44
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorCredentials.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorFactory.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorNegotiator.java)4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorStateEvent.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Protocol.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java)6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactoryID.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactoryID.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainer.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerDelta.java29
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java25
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEventVisitor.java29
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/EventUtil.java55
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/IEvent.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorChannelsEvent.java)14
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java34
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java26
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java5
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProduct.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java73
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java17
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEvent.java10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEventVisitor.java29
111 files changed, 1578 insertions, 1295 deletions
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 e9faa28..5f580e3 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,9 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.views;
-import static org.eclipse.net4j.util.registry.IRegistryDelta.Kind.DEREGISTERED;
-import static org.eclipse.net4j.util.registry.IRegistryDelta.Kind.REGISTERED;
-
import org.eclipse.emf.cdo.CDOAdapter;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.container.CDOContainerAdapter;
@@ -22,9 +19,6 @@ 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.IRegistryDelta;
-import org.eclipse.net4j.util.registry.IRegistryEvent;
-import org.eclipse.net4j.util.registry.IRegistryListener;
import org.eclipse.swt.graphics.Image;
@@ -75,7 +69,7 @@ public class CDOSessionsItemProvider extends ItemProvider<CDOContainerAdapter> i
IRegistryDelta[] deltas = event.getDeltas();
for (IRegistryDelta delta : deltas)
{
- Object element = delta.getValue();
+ Object element = delta.getElement();
if (element instanceof CDOSession)
{
CDOSession session = (CDOSession)element;
diff --git a/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java b/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java
index 3b86e3f..8055f6e 100644
--- a/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java
+++ b/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java
@@ -11,12 +11,11 @@
package org.eclipse.net4j.internal.debug;
import org.eclipse.net4j.internal.debug.views.RemoteTraceView;
-import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.om.trace.RemoteTraceServer;
import org.eclipse.net4j.util.om.trace.RemoteTraceServer.Event;
import org.eclipse.net4j.util.om.trace.RemoteTraceServer.Listener;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.List;
@@ -24,9 +23,9 @@ import java.util.List;
/**
* @author Eike Stepper
*/
-public class RemoteTraceManager extends LifecycleImpl implements Listener
+public class RemoteTraceManager extends Lifecycle implements Listener
{
- @Singleton
+ // @Singleton
public static final RemoteTraceManager INSTANCE = new RemoteTraceManager();
private RemoteTraceServer server;
@@ -54,18 +53,18 @@ public class RemoteTraceManager extends LifecycleImpl implements Listener
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
server = new RemoteTraceServer();
server.addListener(this);
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
server.removeListener(this);
server.close();
- super.onDeactivate();
+ super.doDeactivate();
}
}
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/AbstractJVMConnector.java
index 5b17b91..b263249 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/AbstractJVMConnector.java
@@ -10,12 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.internal.jvm;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.Channel;
import org.eclipse.net4j.transport.ConnectorException;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IChannel;
-import org.eclipse.internal.net4j.transport.AbstractConnector;
-import org.eclipse.internal.net4j.transport.ChannelImpl;
+import org.eclipse.internal.net4j.transport.Channel;
+import org.eclipse.internal.net4j.transport.Connector;
import org.eclipse.internal.net4j.transport.DescriptionUtil;
import java.util.Queue;
@@ -25,7 +25,7 @@ import java.util.Queue;
*
* @author Eike Stepper
*/
-public abstract class AbstractJVMConnector extends AbstractConnector
+public abstract class AbstractJVMConnector extends Connector
{
private AbstractJVMConnector peer;
@@ -55,7 +55,7 @@ public abstract class AbstractJVMConnector extends AbstractConnector
{
try
{
- ChannelImpl channel = getPeer().createChannel(channelIndex, protocolID, null);
+ Channel channel = getPeer().createChannel(channelIndex, protocolID, null);
if (channel == null)
{
throw new ConnectorException("Failed to register channel with peer"); //$NON-NLS-1$
@@ -73,25 +73,25 @@ public abstract class AbstractJVMConnector extends AbstractConnector
}
}
- public void multiplexBuffer(Channel localChannel)
+ public void multiplexBuffer(IChannel localChannel)
{
short channelIndex = localChannel.getChannelIndex();
- ChannelImpl peerChannel = peer.getChannel(channelIndex);
+ Channel peerChannel = peer.getChannel(channelIndex);
if (peerChannel == null)
{
throw new IllegalStateException("peerChannel == null"); //$NON-NLS-1$
}
- Queue<Buffer> localQueue = ((ChannelImpl)localChannel).getSendQueue();
- Buffer buffer = localQueue.poll();
+ Queue<IBuffer> localQueue = ((Channel)localChannel).getSendQueue();
+ IBuffer buffer = localQueue.poll();
buffer.flip();
peerChannel.handleBufferFromMultiplexer(buffer);
}
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
+ super.doBeforeActivate();
name = DescriptionUtil.getElement(getDescription(), 2);
if (name == 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/ClientJVMConnectorImpl.java
index 1b1a232..d9b2751 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/ClientJVMConnectorImpl.java
@@ -11,8 +11,6 @@
package org.eclipse.net4j.internal.jvm;
import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.util.lifecycle.LifecycleListener;
-import org.eclipse.net4j.util.lifecycle.LifecycleNotifier;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
/**
@@ -54,9 +52,9 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
}
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
+ super.doBeforeActivate();
acceptor = JVMAcceptorManagerImpl.INSTANCE.getAcceptor(getName());
if (acceptor == null)
{
@@ -67,7 +65,7 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
@Override
protected void onActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
AbstractJVMConnector peer = acceptor.handleAccept(this);
setPeer(peer);
}
@@ -76,7 +74,7 @@ public class ClientJVMConnectorImpl extends AbstractJVMConnector
protected void onDeactivate() throws Exception
{
LifecycleUtil.deactivateNoisy(getPeer());
- super.onDeactivate();
+ super.doDeactivate();
}
protected AbstractJVMConnector createServerPeer() throws Exception
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java
index 8b77272..1651f2b 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMAcceptorFactoryImpl.java
@@ -11,20 +11,20 @@
package org.eclipse.net4j.internal.jvm;
import org.eclipse.net4j.jvm.JVMConstants;
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.AcceptorFactory;
+import org.eclipse.net4j.transport.IAcceptor;
+import org.eclipse.net4j.transport.IAcceptorFactory;
/**
* @author Eike Stepper
*/
-public class JVMAcceptorFactoryImpl implements AcceptorFactory
+public class JVMAcceptorFactoryImpl implements IAcceptorFactory
{
public String getType()
{
return JVMConstants.TYPE;
}
- public Acceptor createAcceptor()
+ public IAcceptor createAcceptor()
{
return new JVMAcceptorImpl();
}
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
index 98506e9..4b4dbb9 100644
--- 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
@@ -14,7 +14,7 @@ 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.AbstractAcceptor;
+import org.eclipse.internal.net4j.transport.Acceptor;
import org.eclipse.internal.net4j.transport.DescriptionUtil;
import java.text.MessageFormat;
@@ -22,7 +22,7 @@ import java.text.MessageFormat;
/**
* @author Eike Stepper
*/
-public class JVMAcceptorImpl extends AbstractAcceptor implements JVMAcceptor
+public class JVMAcceptorImpl extends Acceptor implements JVMAcceptor
{
@SuppressWarnings("unused")
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, JVMAcceptorImpl.class);
@@ -54,9 +54,9 @@ public class JVMAcceptorImpl extends AbstractAcceptor implements JVMAcceptor
}
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
+ super.doBeforeActivate();
if (getDescription() == null)
{
throw new IllegalStateException("getDescription() == null"); //$NON-NLS-1$
@@ -68,16 +68,16 @@ public class JVMAcceptorImpl extends AbstractAcceptor implements JVMAcceptor
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
JVMAcceptorManagerImpl.INSTANCE.registerAcceptor(this);
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
JVMAcceptorManagerImpl.INSTANCE.deregisterAcceptor(this);
- super.onDeactivate();
+ 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/JVMAcceptorManagerImpl.java
index 8d057f3..fcc6e8c 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/JVMAcceptorManagerImpl.java
@@ -12,7 +12,6 @@ package org.eclipse.net4j.internal.jvm;
import org.eclipse.net4j.jvm.JVMAcceptor;
import org.eclipse.net4j.jvm.JVMAcceptorManager;
-import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
@@ -22,7 +21,7 @@ import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
*/
public class JVMAcceptorManagerImpl implements JVMAcceptorManager
{
- @Singleton
+ // @Singleton
public static final JVMAcceptorManagerImpl INSTANCE = new JVMAcceptorManagerImpl();
private IRegistry<String, JVMAcceptor> acceptorRegistry = new HashMapRegistry();
diff --git a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java
index 630def6..30c81ef 100644
--- a/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java
+++ b/plugins/org.eclipse.net4j.jvm/src/org/eclipse/net4j/internal/jvm/JVMConnectorFactoryImpl.java
@@ -11,20 +11,20 @@
package org.eclipse.net4j.internal.jvm;
import org.eclipse.net4j.jvm.JVMConstants;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorFactory;
+import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IConnectorFactory;
/**
* @author Eike Stepper
*/
-public class JVMConnectorFactoryImpl implements ConnectorFactory
+public class JVMConnectorFactoryImpl implements IConnectorFactory
{
public String getType()
{
return JVMConstants.TYPE;
}
- public Connector createConnector()
+ public IConnector createConnector()
{
return new ClientJVMConnectorImpl();
}
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/ServerJVMConnectorImpl.java
index 5bcfe4d..4ac6949 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/ServerJVMConnectorImpl.java
@@ -32,6 +32,6 @@ public class ServerJVMConnectorImpl extends AbstractJVMConnector
protected void onDeactivate() throws Exception
{
LifecycleUtil.deactivateNoisy(getPeer());
- super.onDeactivate();
+ super.doDeactivate();
}
}
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/JVMAcceptor.java
index 591f18f..ff0d4c1 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/JVMAcceptor.java
@@ -10,12 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.jvm;
-import org.eclipse.net4j.transport.Acceptor;
+import org.eclipse.net4j.transport.IAcceptor;
/**
* @author Eike Stepper
*/
-public interface JVMAcceptor extends Acceptor
+public interface JVMAcceptor extends IAcceptor
{
public String getName();
}
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/JVMConnector.java
index 402c9d2..3a27e3a 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/JVMConnector.java
@@ -10,12 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.jvm;
-import org.eclipse.net4j.transport.Connector;
+import org.eclipse.net4j.transport.IConnector;
/**
* @author Eike Stepper
*/
-public interface JVMConnector extends Connector
+public interface JVMConnector extends IConnector
{
public String getName();
}
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/AbstractTCPConnector.java
index 86cd5e2..ded8811 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/AbstractTCPConnector.java
@@ -13,15 +13,15 @@ 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.transport.Buffer;
-import org.eclipse.net4j.transport.Channel;
import org.eclipse.net4j.transport.ConnectorException;
import org.eclipse.net4j.transport.ConnectorState;
+import org.eclipse.net4j.transport.IBuffer;
+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.AbstractConnector;
-import org.eclipse.internal.net4j.transport.ChannelImpl;
+import org.eclipse.internal.net4j.transport.Channel;
+import org.eclipse.internal.net4j.transport.Connector;
import org.eclipse.internal.net4j.transport.DescriptionUtil;
import java.nio.ByteBuffer;
@@ -34,8 +34,7 @@ import java.util.Queue;
/**
* @author Eike Stepper
*/
-public abstract class AbstractTCPConnector extends AbstractConnector implements TCPConnector,
- TCPSelectorListener.Active
+public abstract class AbstractTCPConnector extends Connector implements TCPConnector, TCPSelectorListener.Active
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, AbstractTCPConnector.class);
@@ -45,7 +44,7 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
private SelectionKey selectionKey;
- private Buffer inputBuffer;
+ private IBuffer inputBuffer;
private ControlChannelImpl controlChannel;
@@ -91,11 +90,11 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
}
/**
- * Called by {@link ChannelImpl} each time a new buffer is available for
+ * Called by {@link Channel} each time a new buffer is available for
* multiplexing. This or another buffer can be dequeued from the outputQueue
- * of the {@link ChannelImpl}.
+ * of the {@link Channel}.
*/
- public void multiplexBuffer(Channel channel)
+ public void multiplexBuffer(IChannel channel)
{
checkSelectionKey();
selector.setWriteInterest(selectionKey, true);
@@ -150,7 +149,7 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
if (byteBuffer != null)
{
short channelIndex = inputBuffer.getChannelIndex();
- ChannelImpl channel = channelIndex == ControlChannelImpl.CONTROL_CHANNEL_ID ? controlChannel
+ Channel channel = channelIndex == ControlChannelImpl.CONTROL_CHANNEL_ID ? controlChannel
: getChannel(channelIndex);
if (channel != null)
{
@@ -185,9 +184,9 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
try
{
boolean moreToWrite = false;
- for (Queue<Buffer> bufferQueue : getChannelBufferQueues())
+ for (Queue<IBuffer> bufferQueue : getChannelBufferQueues())
{
- Buffer buffer = bufferQueue.peek();
+ IBuffer buffer = bufferQueue.peek();
if (buffer != null)
{
if (buffer.write(socketChannel))
@@ -230,10 +229,10 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
}
@Override
- protected List<Queue<Buffer>> getChannelBufferQueues()
+ protected List<Queue<IBuffer>> getChannelBufferQueues()
{
- List<Queue<Buffer>> queues = super.getChannelBufferQueues();
- Queue<Buffer> controlQueue = controlChannel.getSendQueue();
+ List<Queue<IBuffer>> queues = super.getChannelBufferQueues();
+ Queue<IBuffer> controlQueue = controlChannel.getSendQueue();
if (!controlQueue.isEmpty())
{
queues.add(controlQueue);
@@ -263,7 +262,7 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
}
@Override
- protected void removeChannel(ChannelImpl channel)
+ protected void removeChannel(Channel channel)
{
if (isConnected())
{
@@ -274,9 +273,9 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
}
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
+ super.doBeforeActivate();
if (socketChannel == null)
{
throw new IllegalStateException("socketChannel == null");
@@ -302,16 +301,16 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
controlChannel = new ControlChannelImpl(this);
controlChannel.activate();
selector.registerAsync(socketChannel, this);
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
Exception exception = null;
@@ -349,7 +348,7 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
try
{
- super.onDeactivate();
+ super.doDeactivate();
}
catch (Exception ex)
{
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/ClientTCPConnectorImpl.java
index 060ac6c..7a1291e 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/ClientTCPConnectorImpl.java
@@ -51,9 +51,9 @@ public class ClientTCPConnectorImpl extends AbstractTCPConnector
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
InetAddress addr = InetAddress.getByName(getHost());
InetSocketAddress sAddr = new InetSocketAddress(addr, getPort());
getSocketChannel().connect(sAddr);
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/ControlChannelImpl.java
index afbc06f..5b22de2 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/ControlChannelImpl.java
@@ -10,13 +10,13 @@
**************************************************************************/
package org.eclipse.net4j.internal.tcp;
-import org.eclipse.net4j.transport.Buffer;
+import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.util.concurrent.ISynchronizer;
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.ChannelImpl;
+import org.eclipse.internal.net4j.transport.Channel;
import org.eclipse.internal.net4j.util.concurrent.SynchronizingCorrelator;
import java.nio.ByteBuffer;
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
/**
* @author Eike Stepper
*/
-public final class ControlChannelImpl extends ChannelImpl
+public final class ControlChannelImpl extends Channel
{
public static final short CONTROL_CHANNEL_ID = -1;
@@ -62,7 +62,7 @@ public final class ControlChannelImpl extends ChannelImpl
assertValidChannelIndex(channelIndex);
ISynchronizer<Boolean> registration = registrations.correlate(channelIndex);
- Buffer buffer = provideBuffer();
+ IBuffer buffer = provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(CONTROL_CHANNEL_ID);
byteBuffer.put(OPCODE_REGISTRATION);
byteBuffer.putShort(channelIndex);
@@ -76,14 +76,14 @@ public final class ControlChannelImpl extends ChannelImpl
{
assertValidChannelIndex(channelIndex);
- Buffer buffer = provideBuffer();
+ IBuffer buffer = provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(CONTROL_CHANNEL_ID);
byteBuffer.put(OPCODE_DEREGISTRATION);
byteBuffer.putShort(channelIndex);
handleBuffer(buffer);
}
- public void handleBufferFromMultiplexer(Buffer buffer)
+ public void handleBufferFromMultiplexer(IBuffer buffer)
{
try
{
@@ -101,7 +101,7 @@ public final class ControlChannelImpl extends ChannelImpl
{
byte[] handlerFactoryUTF8 = BufferUtil.getByteArray(byteBuffer);
String protocolID = BufferUtil.fromUTF8(handlerFactoryUTF8);
- ChannelImpl channel = ((AbstractTCPConnector)getConnector()).createChannel(channelIndex, protocolID, null);
+ Channel channel = ((AbstractTCPConnector)getConnector()).createChannel(channelIndex, protocolID, null);
if (channel != null)
{
channel.activate();
@@ -136,7 +136,7 @@ public final class ControlChannelImpl extends ChannelImpl
try
{
- ChannelImpl channel = ((AbstractTCPConnector)getConnector()).getChannel(channelIndex);
+ Channel channel = ((AbstractTCPConnector)getConnector()).getChannel(channelIndex);
if (channel != null)
{
channel.deactivate();
@@ -170,7 +170,7 @@ public final class ControlChannelImpl extends ChannelImpl
private void sendStatus(byte opcode, short channelIndex, boolean status)
{
- Buffer buffer = provideBuffer();
+ IBuffer buffer = provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(CONTROL_CHANNEL_ID);
byteBuffer.put(opcode);
byteBuffer.putShort(channelIndex);
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/ServerTCPConnectorImpl.java
index 8bf1fca..3a7058c 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/ServerTCPConnectorImpl.java
@@ -45,8 +45,8 @@ public class ServerTCPConnectorImpl extends AbstractTCPConnector
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
- super.onDeactivate();
+ super.doDeactivate();
}
}
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 1077b4b..cc07dd9 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
@@ -11,20 +11,20 @@
package org.eclipse.net4j.internal.tcp;
import org.eclipse.net4j.tcp.TCPConstants;
-import org.eclipse.net4j.transport.Acceptor;
-import org.eclipse.net4j.transport.AcceptorFactory;
+import org.eclipse.net4j.transport.IAcceptor;
+import org.eclipse.net4j.transport.IAcceptorFactory;
/**
* @author Eike Stepper
*/
-public class TCPAcceptorFactoryImpl implements AcceptorFactory
+public class TCPAcceptorFactoryImpl implements IAcceptorFactory
{
public String getType()
{
return TCPConstants.TYPE;
}
- public Acceptor createAcceptor()
+ public IAcceptor createAcceptor()
{
return new TCPAcceptorImpl();
}
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/TCPAcceptorImpl.java
index df3ed9b..a0c5d17 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/TCPAcceptorImpl.java
@@ -17,7 +17,7 @@ import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.transport.AbstractAcceptor;
+import org.eclipse.internal.net4j.transport.Acceptor;
import org.eclipse.internal.net4j.transport.DescriptionUtil;
import java.net.InetAddress;
@@ -34,7 +34,7 @@ import java.util.concurrent.CountDownLatch;
/**
* @author Eike Stepper
*/
-public class TCPAcceptorImpl extends AbstractAcceptor implements TCPAcceptor, TCPSelectorListener.Passive
+public class TCPAcceptorImpl extends Acceptor implements TCPAcceptor, TCPSelectorListener.Passive
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, TCPAcceptorImpl.class);
@@ -155,9 +155,9 @@ public class TCPAcceptorImpl extends AbstractAcceptor implements TCPAcceptor, TC
}
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
+ super.doBeforeActivate();
if (getDescription() == null)
{
throw new IllegalStateException("description == null"); //$NON-NLS-1$
@@ -181,9 +181,9 @@ public class TCPAcceptorImpl extends AbstractAcceptor implements TCPAcceptor, TC
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
InetSocketAddress addr = null;
if (address != null)
{
@@ -225,10 +225,10 @@ public class TCPAcceptorImpl extends AbstractAcceptor implements TCPAcceptor, TC
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
serverSocketChannel.close();
- super.onDeactivate();
+ super.doDeactivate();
}
private String createConnectorDescription(SocketChannel socketChannel)
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 a0efe0e..27af606 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
@@ -11,20 +11,20 @@
package org.eclipse.net4j.internal.tcp;
import org.eclipse.net4j.tcp.TCPConstants;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorFactory;
+import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.transport.IConnectorFactory;
/**
* @author Eike Stepper
*/
-public class TCPConnectorFactoryImpl implements ConnectorFactory
+public class TCPConnectorFactoryImpl implements IConnectorFactory
{
public String getType()
{
return TCPConstants.TYPE;
}
- public Connector createConnector()
+ public IConnector createConnector()
{
return new ClientTCPConnectorImpl();
}
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/TCPSelectorImpl.java
index a17205d..aeaa54c 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/TCPSelectorImpl.java
@@ -17,7 +17,7 @@ import org.eclipse.net4j.tcp.TCPSelectorListener.Passive;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.io.IOException;
import java.nio.channels.CancelledKeyException;
@@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
/**
* @author Eike Stepper
*/
-public class TCPSelectorImpl extends LifecycleImpl implements TCPSelector, Runnable
+public class TCPSelectorImpl extends Lifecycle implements TCPSelector, Runnable
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SELECTOR, TCPSelectorImpl.class);
@@ -274,7 +274,7 @@ public class TCPSelectorImpl extends LifecycleImpl implements TCPSelector, Runna
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
selector = Selector.open();
thread = new Thread(this, "selector"); //$NON-NLS-1$
@@ -283,7 +283,7 @@ public class TCPSelectorImpl extends LifecycleImpl implements TCPSelector, Runna
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
selector.wakeup();
Exception exception = null;
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/TCPAcceptor.java
index 97931ff..b3a65f4 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/TCPAcceptor.java
@@ -10,12 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.tcp;
-import org.eclipse.net4j.transport.Acceptor;
+import org.eclipse.net4j.transport.IAcceptor;
/**
* @author Eike Stepper
*/
-public interface TCPAcceptor extends Acceptor
+public interface TCPAcceptor 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/TCPConnector.java
index 6fc00de..0ee76dc 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/TCPConnector.java
@@ -10,12 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.tcp;
-import org.eclipse.net4j.transport.Connector;
+import org.eclipse.net4j.transport.IConnector;
/**
* @author Eike Stepper
*/
-public interface TCPConnector extends Connector
+public interface TCPConnector extends IConnector
{
public String getHost();
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 e6dadac..47f58ab 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
@@ -16,8 +16,8 @@ import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.tcp.internal.container.TCPContainerAdapterFactoryImpl;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.internal.net4j.transport.AbstractAcceptor;
-import org.eclipse.internal.net4j.transport.AbstractConnector;
+import org.eclipse.internal.net4j.transport.Acceptor;
+import org.eclipse.internal.net4j.transport.Connector;
/**
* @author Eike Stepper
@@ -31,9 +31,9 @@ public abstract class AbstractTCPTest extends AbstractOMTest
protected Container container;
@SuppressWarnings("unused")
- private AbstractAcceptor acceptor;
+ private Acceptor acceptor;
- private AbstractConnector connector;
+ private Connector connector;
@Override
protected void setUp() throws Exception
@@ -81,21 +81,21 @@ public abstract class AbstractTCPTest extends AbstractOMTest
return container;
}
- protected AbstractAcceptor getAcceptor()
+ protected Acceptor getAcceptor()
{
if (acceptor == null)
{
- acceptor = (AbstractAcceptor)container.getAcceptor(ACCEPTOR_DESCRIPTION);
+ acceptor = (Acceptor)container.getAcceptor(ACCEPTOR_DESCRIPTION);
}
return acceptor;
}
- protected AbstractConnector getConnector()
+ protected Connector getConnector()
{
if (connector == null)
{
- connector = (AbstractConnector)container.getConnector(CONNECTOR_DESCRIPTION);
+ connector = (Connector)container.getConnector(CONNECTOR_DESCRIPTION);
}
return connector;
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 e5a6a61..b123ca4 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
@@ -14,7 +14,7 @@ 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.IChannel;
import java.util.Arrays;
@@ -34,7 +34,7 @@ public class SignalTest extends AbstractTCPTest
public void testInteger() throws Exception
{
startTransport();
- Channel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_ID);
+ IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_ID);
int data = 0x0a;
int result = new Request1(channel, data).send();
assertEquals(data, result);
@@ -43,7 +43,7 @@ public class SignalTest extends AbstractTCPTest
public void testArray() throws Exception
{
startTransport();
- Channel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_ID);
+ IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_ID);
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 f16871b..4907ebf 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
@@ -14,10 +14,10 @@ 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.AcceptorConnectorsEvent;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.Channel;
-import org.eclipse.net4j.transport.ConnectorChannelsEvent;
+import org.eclipse.net4j.transport.IAcceptorAcceptedEvent;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.net4j.transport.IConnectorChannelsEvent;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
@@ -45,7 +45,7 @@ public class TCPTransportTest extends AbstractTCPTest
return container;
}
- protected Buffer provideBuffer()
+ protected IBuffer provideBuffer()
{
return container.getBufferProvider().provideBuffer();
}
@@ -58,10 +58,10 @@ public class TCPTransportTest extends AbstractTCPTest
public void testSendBuffer() throws Exception
{
startTransport();
- Channel channel = getConnector().openChannel();
+ IChannel channel = getConnector().openChannel();
for (int i = 0; i < 3; i++)
{
- Buffer buffer = provideBuffer();
+ IBuffer buffer = provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(channel.getChannelIndex());
byteBuffer.putInt(1970);
channel.handleBuffer(buffer);
@@ -75,10 +75,10 @@ public class TCPTransportTest extends AbstractTCPTest
container.register(new TestProtocolFactory(counter));
startTransport();
- Channel channel = getConnector().openChannel(TestProtocolFactory.PROTOCOL_ID);
+ IChannel channel = getConnector().openChannel(TestProtocolFactory.PROTOCOL_ID);
for (int i = 0; i < COUNT; i++)
{
- Buffer buffer = provideBuffer();
+ IBuffer buffer = provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(channel.getChannelIndex());
byteBuffer.putInt(1970);
channel.handleBuffer(buffer);
@@ -153,17 +153,17 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof AcceptorConnectorsEvent)
+ if (event instanceof IAcceptorAcceptedEvent)
{
- AcceptorConnectorsEvent e = (AcceptorConnectorsEvent)event;
- e.getAcceptedConnector().addListener(new IListener()
+ IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
{
- if (event instanceof ConnectorChannelsEvent)
+ if (event instanceof IConnectorChannelsEvent)
{
- ConnectorChannelsEvent e = (ConnectorChannelsEvent)event;
- if (e.getType() == ConnectorChannelsEvent.Type.OPENED)
+ IConnectorChannelsEvent e = (IConnectorChannelsEvent)event;
+ if (e.getType() == ConnectorChaIConnectorChannelsEvent)
{
inputStream[0] = new ChannelInputStream(e.getChannel(), 2000);
counter.countDown();
@@ -175,7 +175,7 @@ public class TCPTransportTest extends AbstractTCPTest
}
});
- Channel channel = getConnector().openChannel();
+ IChannel channel = getConnector().openChannel();
assertTrue(counter.await(2, TimeUnit.SECONDS));
assertNotNull(inputStream[0]);
@@ -216,17 +216,17 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof AcceptorConnectorsEvent)
+ if (event instanceof IAcceptorAcceptedEvent)
{
- AcceptorConnectorsEvent e = (AcceptorConnectorsEvent)event;
- e.getAcceptedConnector().addListener(new IListener()
+ IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
{
- if (event instanceof ConnectorChannelsEvent)
+ if (event instanceof IConnectorChannelsEvent)
{
- ConnectorChannelsEvent e = (ConnectorChannelsEvent)event;
- if (e.getType() == ConnectorChannelsEvent.Type.OPENED)
+ IConnectorChannelsEvent e = (IConnectorChannelsEvent)event;
+ if (e.getType() == ConnectorChaIConnectorChannelsEvent)
{
inputStream[0] = new ChannelInputStream(e.getChannel(), 2000);
counter.countDown();
@@ -238,7 +238,7 @@ public class TCPTransportTest extends AbstractTCPTest
}
});
- Channel channel = getConnector().openChannel();
+ IChannel channel = getConnector().openChannel();
assertTrue(counter.await(2, TimeUnit.SECONDS));
assertNotNull(inputStream[0]);
@@ -282,17 +282,17 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof AcceptorConnectorsEvent)
+ if (event instanceof IAcceptorAcceptedEvent)
{
- AcceptorConnectorsEvent e = (AcceptorConnectorsEvent)event;
- e.getAcceptedConnector().addListener(new IListener()
+ IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
{
- if (event instanceof ConnectorChannelsEvent)
+ if (event instanceof IConnectorChannelsEvent)
{
- ConnectorChannelsEvent e = (ConnectorChannelsEvent)event;
- if (e.getType() == ConnectorChannelsEvent.Type.OPENED)
+ IConnectorChannelsEvent e = (IConnectorChannelsEvent)event;
+ if (e.getType() == ConnectorChaIConnectorChannelsEvent)
{
inputStream[0] = new ChannelInputStream(e.getChannel(), 2000);
counter.countDown();
@@ -304,7 +304,7 @@ public class TCPTransportTest extends AbstractTCPTest
}
});
- final Channel channel = getConnector().openChannel();
+ final IChannel channel = getConnector().openChannel();
assertTrue(counter.await(2, TimeUnit.SECONDS));
assertNotNull(inputStream[0]);
@@ -362,17 +362,17 @@ public class TCPTransportTest extends AbstractTCPTest
{
public void notifyEvent(IEvent event)
{
- if (event instanceof AcceptorConnectorsEvent)
+ if (event instanceof IAcceptorAcceptedEvent)
{
- AcceptorConnectorsEvent e = (AcceptorConnectorsEvent)event;
- e.getAcceptedConnector().addListener(new IListener()
+ IAcceptorAcceptedEvent e = (IAcceptorAcceptedEvent)event;
+ e.getConnector().addListener(new IListener()
{
public void notifyEvent(IEvent event)
{
- if (event instanceof ConnectorChannelsEvent)
+ if (event instanceof IConnectorChannelsEvent)
{
- ConnectorChannelsEvent e = (ConnectorChannelsEvent)event;
- if (e.getType() == ConnectorChannelsEvent.Type.OPENED)
+ IConnectorChannelsEvent e = (IConnectorChannelsEvent)event;
+ if (e.getType() == ConnectorChaIConnectorChannelsEvent)
{
inputStream[0] = new ChannelInputStream(e.getChannel(), 2000);
counter.countDown();
@@ -384,7 +384,7 @@ public class TCPTransportTest extends AbstractTCPTest
}
});
- Channel channel = getConnector().openChannel();
+ IChannel channel = getConnector().openChannel();
assertTrue(counter.await(2, TimeUnit.SECONDS));
ChannelOutputStream outputStream = new ChannelOutputStream(channel);
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 79cd120..042ebd9 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,14 +10,14 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.Channel;
import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.Protocol;
-import org.eclipse.net4j.transport.ProtocolFactory;
+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.internal.net4j.transport.AbstractProtocol;
-import org.eclipse.internal.net4j.transport.AbstractProtocolFactory;
+import org.eclipse.internal.net4j.transport.Protocol;
+import org.eclipse.internal.net4j.transport.ProtocolFactory;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
@@ -25,7 +25,7 @@ import java.util.concurrent.CountDownLatch;
/**
* @author Eike Stepper
*/
-public class TestProtocolFactory extends AbstractProtocolFactory implements ProtocolFactory
+public class TestProtocolFactory extends ProtocolFactory implements IProtocolFactory
{
public static final String PROTOCOL_ID = "test.protocol";
@@ -43,10 +43,10 @@ public class TestProtocolFactory extends AbstractProtocolFactory implements Prot
public Set<ConnectorLocation> getLocations()
{
- return ProtocolFactory.SYMMETRIC;
+ return IProtocolFactory.SYMMETRIC;
}
- public Protocol createProtocol(Channel channel, Object protocolData)
+ public IProtocol createProtocol(IChannel channel, Object protocolData)
{
return new TestProtocol(channel);
}
@@ -54,9 +54,9 @@ public class TestProtocolFactory extends AbstractProtocolFactory implements Prot
/**
* @author Eike Stepper
*/
- private final class TestProtocol extends AbstractProtocol
+ private final class TestProtocol extends Protocol
{
- public TestProtocol(Channel channel)
+ public TestProtocol(IChannel channel)
{
super(channel);
}
@@ -66,7 +66,7 @@ public class TestProtocolFactory extends AbstractProtocolFactory implements Prot
return PROTOCOL_ID;
}
- public void handleBuffer(Buffer buffer)
+ public void handleBuffer(IBuffer buffer)
{
System.out.println("BUFFER ARRIVED");
buffer.release();
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request1.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request1.java
index 6f2f0f5..a6135a3 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request1.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request1.java
@@ -11,7 +11,7 @@
package org.eclipse.net4j.tests.signal;
import org.eclipse.net4j.signal.RequestWithConfirmation;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
@@ -24,7 +24,7 @@ public class Request1 extends RequestWithConfirmation<Integer>
{
private int data;
- public Request1(Channel channel, int data)
+ public Request1(IChannel channel, int data)
{
super(channel);
this.data = data;
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request2.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request2.java
index 59d8a4c..3ab8aff 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request2.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/Request2.java
@@ -11,7 +11,7 @@
package org.eclipse.net4j.tests.signal;
import org.eclipse.net4j.signal.RequestWithConfirmation;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
@@ -24,7 +24,7 @@ public class Request2 extends RequestWithConfirmation<byte[]>
{
private byte[] data;
- public Request2(Channel channel, byte[] data)
+ public Request2(IChannel channel, byte[] data)
{
super(channel);
this.data = data;
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 cfd37c4..4b4d72b 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,12 +12,12 @@ package org.eclipse.net4j.tests.signal;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
-import org.eclipse.net4j.transport.Channel;
import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.Protocol;
-import org.eclipse.net4j.transport.ProtocolFactory;
+import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.net4j.transport.IProtocol;
+import org.eclipse.net4j.transport.IProtocolFactory;
-import org.eclipse.internal.net4j.transport.AbstractProtocolFactory;
+import org.eclipse.internal.net4j.transport.ProtocolFactory;
import java.util.Set;
@@ -36,7 +36,7 @@ public class TestSignalProtocol extends SignalProtocol
public static final short SIGNAL4 = 4;
- public TestSignalProtocol(Channel channel)
+ public TestSignalProtocol(IChannel channel)
{
super(channel);
}
@@ -63,7 +63,7 @@ public class TestSignalProtocol extends SignalProtocol
/**
* @author Eike Stepper
*/
- public static class Factory extends AbstractProtocolFactory
+ public static class Factory extends ProtocolFactory
{
public String getProtocolID()
{
@@ -72,10 +72,10 @@ public class TestSignalProtocol extends SignalProtocol
public Set<ConnectorLocation> getLocations()
{
- return ProtocolFactory.SYMMETRIC;
+ return IProtocolFactory.SYMMETRIC;
}
- public Protocol createProtocol(Channel channel, Object protocolData)
+ public IProtocol createProtocol(IChannel channel, Object protocolData)
{
return new TestSignalProtocol(channel);
}
diff --git a/plugins/org.eclipse.net4j/.classpath b/plugins/org.eclipse.net4j/.classpath
index 4ec76c8..3381f58 100644
--- a/plugins/org.eclipse.net4j/.classpath
+++ b/plugins/org.eclipse.net4j/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="org/eclipse/internal/net4j/component/InactiveException.java|org/eclipse/net4j/transport/ChannelMultiplexer.java|org/eclipse/net4j/util/registry/delegating/AbstractCachingRegistry.java|org/eclipse/net4j/util/registry/delegating/DelegatingRegistry.java|org/eclipse/net4j/util/registry/delegating/HashCacheRegistry.java|org/eclipse/net4j/transport/tcp/TCPConnector.java|org/eclipse/internal/net4j/transport/ClientProtocolFactoryRegistry.java|org/eclipse/internal/net4j/transport/ServerProtocolFactoryRegistry.java" kind="src" path="src"/>
+ <classpathentry excluding="org/eclipse/internal/net4j/component/InactiveException.java|org/eclipse/net4j/transport/ChannelMultiplexer.java|org/eclipse/net4j/util/registry/delegating/AbstractCachingRegistry.java|org/eclipse/net4j/util/registry/delegating/DelegatingRegistry.java|org/eclipse/net4j/util/registry/delegating/HashCacheRegistry.java|org/eclipse/net4j/transport/tcp/TCPConnector.java|org/eclipse/internal/net4j/transport/ClientProtocolFactoryRegistry.java|org/eclipse/internal/net4j/transport/ServerProtocolFactoryRegistry.java|org/eclipse/net4j/util/registry/IRegistryListener.java|org/eclipse/net4j/util/lifecycle/LifecycleListener.java|org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java|org/eclipse/net4j/util/lifecycle/LifecycleAdapter.java|org/eclipse/net4j/util/registry/IRegistryDelta.java|org/eclipse/net4j/util/registry/IRegistryEvent.java|org/eclipse/net4j/util/registry/IRegistryEventVisitor.java" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/plugins/org.eclipse.net4j/.cvsignore b/plugins/org.eclipse.net4j/.cvsignore
index 6938697..25b27ca 100644
--- a/plugins/org.eclipse.net4j/.cvsignore
+++ b/plugins/org.eclipse.net4j/.cvsignore
@@ -1,2 +1,3 @@
bin
doc
+.ispace
diff --git a/plugins/org.eclipse.net4j/.project b/plugins/org.eclipse.net4j/.project
index fd0305d..8146376 100644
--- a/plugins/org.eclipse.net4j/.project
+++ b/plugins/org.eclipse.net4j/.project
@@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>de.tud.st.ispace.builder.ISpaceBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>de.tud.st.ispace.builder.ISpaceNature</nature>
</natures>
</projectDescription>
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index de31793..b1cbfbc 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -15,9 +15,11 @@ Export-Package: org.eclipse.internal.net4j.bundle;version="0.8.0",
org.eclipse.internal.net4j.transport;version="0.8.0",
org.eclipse.internal.net4j.util;version="0.8.0",
org.eclipse.internal.net4j.util.concurrent;version="0.8.0",
+ org.eclipse.internal.net4j.util.container;version="0.8.0",
org.eclipse.internal.net4j.util.event;version="0.8.0",
org.eclipse.internal.net4j.util.lifecycle;version="0.8.0",
org.eclipse.internal.net4j.util.om;version="0.8.0",
+ org.eclipse.internal.net4j.util.product;version="0.8.0",
org.eclipse.internal.net4j.util.registry;version="0.8.0",
org.eclipse.net4j;version="0.8.0",
org.eclipse.net4j.message;version="0.8.0",
@@ -28,11 +30,13 @@ Export-Package: org.eclipse.internal.net4j.bundle;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",
+ org.eclipse.net4j.util.container;version="0.8.0",
org.eclipse.net4j.util.event;version="0.8.0",
org.eclipse.net4j.util.lifecycle;version="0.8.0",
org.eclipse.net4j.util.om;version="0.8.0",
org.eclipse.net4j.util.om.log;version="0.8.0",
org.eclipse.net4j.util.om.trace;version="0.8.0",
+ org.eclipse.net4j.util.product;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
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractAcceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractAcceptor.java
deleted file mode 100644
index 435ee25..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractAcceptor.java
+++ /dev/null
@@ -1,244 +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.Acceptor;
-import org.eclipse.net4j.transport.AcceptorConnectorsEvent;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ProtocolFactory;
-import org.eclipse.net4j.transport.ProtocolFactoryID;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.event.INotifier;
-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.om.trace.ContextTracer;
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.util.event.EventImpl;
-import org.eclipse.internal.net4j.util.event.NotifierImpl;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
-
-import java.nio.channels.Channel;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractAcceptor extends LifecycleImpl implements Acceptor, INotifier.Introspection
-{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, AbstractAcceptor.class);
-
- private String description;
-
- private BufferProvider bufferProvider;
-
- private IRegistry<ProtocolFactoryID, ProtocolFactory> protocolFactoryRegistry;
-
- /**
- * An optional executor to be used by the {@link Channel}s to process their
- * {@link ChannelImpl#receiveQueue} instead of the current thread. If not
- * <code>null</code> the calling thread of
- * {@link ChannelImpl#handleBufferFromMultiplexer(Buffer)} becomes decoupled.
- * <p>
- */
- private ExecutorService receiveExecutor;
-
- private NotifierImpl notifier = new NotifierImpl();
-
- private LifecycleListener connectorLifecycleListener = new LifecycleListener()
- {
- public void notifyLifecycleAboutToActivate(LifecycleNotifier notifier)
- {
- // Do nothing
- }
-
- public void notifyLifecycleActivated(LifecycleNotifier notifier)
- {
- // Do nothing
- }
-
- public void notifyLifecycleDeactivating(LifecycleNotifier notifier)
- {
- removeConnector((Connector)notifier);
- }
- };
-
- private Set<Connector> acceptedConnectors = new HashSet(0);
-
- public AbstractAcceptor()
- {
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- public BufferProvider getBufferProvider()
- {
- return bufferProvider;
- }
-
- public void setBufferProvider(BufferProvider bufferProvider)
- {
- this.bufferProvider = bufferProvider;
- }
-
- public ExecutorService getReceiveExecutor()
- {
- return receiveExecutor;
- }
-
- public void setReceiveExecutor(ExecutorService receiveExecutor)
- {
- this.receiveExecutor = receiveExecutor;
- }
-
- public IRegistry<ProtocolFactoryID, ProtocolFactory> getProtocolFactoryRegistry()
- {
- return protocolFactoryRegistry;
- }
-
- public void setProtocolFactoryRegistry(IRegistry<ProtocolFactoryID, ProtocolFactory> protocolFactoryRegistry)
- {
- this.protocolFactoryRegistry = protocolFactoryRegistry;
- }
-
- public void addListener(IListener listener)
- {
- notifier.addListener(listener);
- }
-
- public void removeListener(IListener listener)
- {
- notifier.removeListener(listener);
- }
-
- public IListener[] getListeners()
- {
- return notifier.getListeners();
- }
-
- public Connector[] getAcceptedConnectors()
- {
- synchronized (acceptedConnectors)
- {
- return acceptedConnectors.toArray(new Connector[acceptedConnectors.size()]);
- }
- }
-
- protected void addConnector(Connector connector)
- {
- try
- {
- LifecycleUtil.activate(connector);
- LifecycleUtil.addListener(connector, connectorLifecycleListener);
-
- synchronized (acceptedConnectors)
- {
- acceptedConnectors.add(connector);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Added connector " + connector); //$NON-NLS-1$
- }
-
- fireConnectorAccepted(connector);
- }
- catch (Exception ex)
- {
- Net4j.LOG.error(ex);
- }
- }
-
- protected void removeConnector(Connector connector)
- {
- LifecycleUtil.removeListener(connector, connectorLifecycleListener);
- synchronized (acceptedConnectors)
- {
- acceptedConnectors.remove(connector);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Removed connector " + connector); //$NON-NLS-1$
- }
- }
-
- protected void fireConnectorAccepted(Connector connector)
- {
- notifier.fireEvent(new AcceptorConnectorsEventImpl(this, connector));
- }
-
- @Override
- protected void onAboutToActivate() throws Exception
- {
- super.onAboutToActivate();
- if (bufferProvider == null)
- {
- throw new IllegalStateException("bufferProvider == null"); //$NON-NLS-1$
- }
-
- if (protocolFactoryRegistry == null && TRACER.isEnabled())
- {
- TRACER.trace("protocolFactoryRegistry == null"); //$NON-NLS-1$
- }
-
- if (receiveExecutor == null && TRACER.isEnabled())
- {
- TRACER.trace("receiveExecutor == null"); //$NON-NLS-1$
- }
- }
-
- @Override
- protected void onDeactivate() throws Exception
- {
- for (Connector connector : getAcceptedConnectors())
- {
- LifecycleUtil.deactivate(connector);
- }
-
- super.onDeactivate();
- }
-
- /**
- * @author Eike Stepper
- */
- private static class AcceptorConnectorsEventImpl extends EventImpl implements AcceptorConnectorsEvent
- {
- private static final long serialVersionUID = 1L;
-
- private Connector acceptedConnector;
-
- public AcceptorConnectorsEventImpl(INotifier notifier, Connector acceptedConnector)
- {
- super(notifier);
- this.acceptedConnector = acceptedConnector;
- }
-
- public Connector getAcceptedConnector()
- {
- return acceptedConnector;
- }
- }
-}
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
new file mode 100644
index 0000000..ff666f8
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Acceptor.java
@@ -0,0 +1,216 @@
+/***************************************************************************
+ * 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.IAcceptor;
+import org.eclipse.net4j.transport.IAcceptorAcceptedEvent;
+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.event.IListener;
+import org.eclipse.net4j.util.event.INotifier;
+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.product.IProduct;
+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.lifecycle.Lifecycle;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class Acceptor extends Lifecycle implements IAcceptor, IContainer<IConnector>, IProduct
+{
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, Acceptor.class);
+
+ private String description;
+
+ private IBufferProvider bufferProvider;
+
+ private IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry;
+
+ private ExecutorService receiveExecutor;
+
+ private transient IListener lifecycleEventConverter = new LifecycleEventConverter(this)
+ {
+ @Override
+ protected void removed(ILifecycleEvent e)
+ {
+ removeConnector((IConnector)e.getLifecycle());
+ super.removed(e);
+ }
+ };
+
+ private Set<IConnector> acceptedConnectors = new HashSet(0);
+
+ public Acceptor()
+ {
+ }
+
+ public String getProductGroupID()
+ {
+ return PRODUCT_GROUP_ID;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public IBufferProvider getBufferProvider()
+ {
+ return bufferProvider;
+ }
+
+ public void setBufferProvider(IBufferProvider bufferProvider)
+ {
+ this.bufferProvider = bufferProvider;
+ }
+
+ public ExecutorService getReceiveExecutor()
+ {
+ return receiveExecutor;
+ }
+
+ public void setReceiveExecutor(ExecutorService receiveExecutor)
+ {
+ this.receiveExecutor = receiveExecutor;
+ }
+
+ public IRegistry<IProtocolFactoryID, IProtocolFactory> getProtocolFactoryRegistry()
+ {
+ return protocolFactoryRegistry;
+ }
+
+ public void setProtocolFactoryRegistry(IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry)
+ {
+ this.protocolFactoryRegistry = protocolFactoryRegistry;
+ }
+
+ public IConnector[] getAcceptedConnectors()
+ {
+ synchronized (acceptedConnectors)
+ {
+ return acceptedConnectors.toArray(new IConnector[acceptedConnectors.size()]);
+ }
+ }
+
+ public IConnector[] getElements()
+ {
+ return getAcceptedConnectors();
+ }
+
+ protected void addConnector(Connector connector)
+ {
+ try
+ {
+ connector.activate();
+ connector.addListener(lifecycleEventConverter);
+
+ synchronized (acceptedConnectors)
+ {
+ acceptedConnectors.add(connector);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Added connector " + connector); //$NON-NLS-1$
+ }
+
+ fireEvent(new AcceptorAcceptedEventImpl(this, connector));
+ }
+ catch (Exception ex)
+ {
+ Net4j.LOG.error(ex);
+ }
+ }
+
+ protected void removeConnector(IConnector connector)
+ {
+ connector.removeListener(lifecycleEventConverter);
+ synchronized (acceptedConnectors)
+ {
+ acceptedConnectors.remove(connector);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Removed connector " + connector); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ if (bufferProvider == null)
+ {
+ throw new IllegalStateException("bufferProvider == null"); //$NON-NLS-1$
+ }
+
+ if (protocolFactoryRegistry == null && TRACER.isEnabled())
+ {
+ TRACER.trace("protocolFactoryRegistry == null"); //$NON-NLS-1$
+ }
+
+ if (receiveExecutor == null && TRACER.isEnabled())
+ {
+ TRACER.trace("receiveExecutor == null"); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (IConnector connector : getAcceptedConnectors())
+ {
+ LifecycleUtil.deactivate(connector);
+ }
+
+ super.doDeactivate();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static class AcceptorAcceptedEventImpl extends Event implements IAcceptorAcceptedEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private IConnector acceptedConnector;
+
+ public AcceptorAcceptedEventImpl(INotifier notifier, IConnector acceptedConnector)
+ {
+ super(notifier);
+ this.acceptedConnector = acceptedConnector;
+ }
+
+ public IConnector getConnector()
+ {
+ return acceptedConnector;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java
index e931d59..be7622c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Buffer.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.util.HexUtil;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -26,7 +26,7 @@ import java.nio.channels.SocketChannel;
/**
* @author Eike Stepper
*/
-public class BufferImpl implements Buffer
+public class Buffer implements IBuffer
{
public static final short HEADER_SIZE = 4;
@@ -34,11 +34,11 @@ public class BufferImpl implements Buffer
private static final int EOS_OFFSET = 1;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, Buffer.class);
private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
- private BufferProvider bufferProvider;
+ private IBufferProvider bufferProvider;
private short channelIndex;
@@ -48,7 +48,7 @@ public class BufferImpl implements Buffer
private ByteBuffer byteBuffer;
- public BufferImpl(BufferProvider provider, short capacity)
+ public Buffer(IBufferProvider provider, short capacity)
{
this.bufferProvider = provider;
byteBuffer = ByteBuffer.allocateDirect(capacity);
@@ -64,12 +64,12 @@ public class BufferImpl implements Buffer
this.eos = eos;
}
- public BufferProvider getBufferProvider()
+ public IBufferProvider getBufferProvider()
{
return bufferProvider;
}
- public void setBufferProvider(BufferProvider bufferProvider)
+ public void setBufferProvider(IBufferProvider bufferProvider)
{
this.bufferProvider = bufferProvider;
}
@@ -138,7 +138,7 @@ public class BufferImpl implements Buffer
if (state == State.INITIAL)
{
- byteBuffer.limit(BufferImpl.HEADER_SIZE);
+ byteBuffer.limit(Buffer.HEADER_SIZE);
state = State.READING_HEADER;
}
@@ -212,7 +212,7 @@ public class BufferImpl implements Buffer
this.channelIndex = channelIndex;
byteBuffer.clear();
- byteBuffer.position(BufferImpl.HEADER_SIZE);
+ byteBuffer.position(Buffer.HEADER_SIZE);
}
return byteBuffer;
@@ -232,7 +232,7 @@ public class BufferImpl implements Buffer
throw new IllegalStateException("channelIndex == NO_CHANNEL"); //$NON-NLS-1$
}
- int payloadSize = byteBuffer.position() - BufferImpl.HEADER_SIZE + EOS_OFFSET;
+ int payloadSize = byteBuffer.position() - Buffer.HEADER_SIZE + EOS_OFFSET;
if (eos)
{
payloadSize = -payloadSize;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactory.java
index a908592..7517f9c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactory.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
+import org.eclipse.net4j.transport.IBuffer;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
@@ -18,19 +18,19 @@ import org.eclipse.internal.net4j.bundle.Net4j;
/**
* @author Eike Stepper
*/
-public class BufferFactoryImpl extends BufferProviderImpl
+public class BufferFactory extends BufferProvider
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferFactoryImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferFactory.class);
- public BufferFactoryImpl(short bufferCapacity)
+ public BufferFactory(short bufferCapacity)
{
super(bufferCapacity);
}
@Override
- protected Buffer doProvideBuffer()
+ protected IBuffer doProvideBuffer()
{
- BufferImpl buffer = new BufferImpl(this, getBufferCapacity());
+ Buffer buffer = new Buffer(this, getBufferCapacity());
if (TRACER.isEnabled())
{
TRACER.trace("Created " + buffer); //$NON-NLS-1$
@@ -40,11 +40,11 @@ public class BufferFactoryImpl extends BufferProviderImpl
}
@Override
- protected void doRetainBuffer(Buffer buffer)
+ protected void doRetainBuffer(IBuffer buffer)
{
- if (buffer instanceof BufferImpl)
+ if (buffer instanceof Buffer)
{
- ((BufferImpl)buffer).dispose();
+ ((Buffer)buffer).dispose();
}
buffer = null;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPool.java
index 03660b2..748284d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPool.java
@@ -10,9 +10,9 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferPool;
-import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IBufferPool;
+import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
@@ -23,17 +23,17 @@ import java.util.concurrent.ConcurrentLinkedQueue;
/**
* @author Eike Stepper
*/
-public class BufferPoolImpl extends BufferProviderImpl implements BufferPool, BufferPool.Introspection
+public class BufferPool extends BufferProvider implements IBufferPool, IBufferPool.Introspection
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferPoolImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferPool.class);
- private final BufferProvider factory;
+ private final IBufferProvider factory;
- private final Queue<Buffer> queue = new ConcurrentLinkedQueue<Buffer>();
+ private final Queue<IBuffer> queue = new ConcurrentLinkedQueue<IBuffer>();
private int pooledBuffers;
- public BufferPoolImpl(BufferProvider factory)
+ public BufferPool(IBufferProvider factory)
{
super(factory.getBufferCapacity());
this.factory = factory;
@@ -46,7 +46,7 @@ public class BufferPoolImpl extends BufferProviderImpl implements BufferPool, Bu
public boolean evictOne()
{
- Buffer buffer = queue.poll();
+ IBuffer buffer = queue.poll();
if (buffer == null)
{
return false;
@@ -81,13 +81,13 @@ public class BufferPoolImpl extends BufferProviderImpl implements BufferPool, Bu
}
@Override
- protected Buffer doProvideBuffer()
+ protected IBuffer doProvideBuffer()
{
- Buffer buffer = queue.poll();
+ IBuffer buffer = queue.poll();
if (buffer == null)
{
buffer = factory.provideBuffer();
- ((BufferImpl)buffer).setBufferProvider(this);
+ ((Buffer)buffer).setBufferProvider(this);
}
buffer.clear();
@@ -100,7 +100,7 @@ public class BufferPoolImpl extends BufferProviderImpl implements BufferPool, Bu
}
@Override
- protected void doRetainBuffer(Buffer buffer)
+ protected void doRetainBuffer(IBuffer buffer)
{
if (buffer.getCapacity() != getBufferCapacity())
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferProviderImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferProvider.java
index ef89e5b..191bd4c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferProviderImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferProvider.java
@@ -10,13 +10,13 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IBufferProvider;
/**
* @author Eike Stepper
*/
-public abstract class BufferProviderImpl implements BufferProvider, BufferProvider.Introspection
+public abstract class BufferProvider implements IBufferProvider, IBufferProvider.Introspection
{
private short bufferCapacity;
@@ -24,7 +24,7 @@ public abstract class BufferProviderImpl implements BufferProvider, BufferProvid
private long retainedBuffers;
- public BufferProviderImpl(short bufferCapacity)
+ public BufferProvider(short bufferCapacity)
{
this.bufferCapacity = bufferCapacity;
}
@@ -44,13 +44,13 @@ public abstract class BufferProviderImpl implements BufferProvider, BufferProvid
return bufferCapacity;
}
- public final Buffer provideBuffer()
+ public final IBuffer provideBuffer()
{
++providedBuffers;
return doProvideBuffer();
}
- public final void retainBuffer(Buffer buffer)
+ public final void retainBuffer(IBuffer buffer)
{
++retainedBuffers;
doRetainBuffer(buffer);
@@ -62,7 +62,7 @@ public abstract class BufferProviderImpl implements BufferProvider, BufferProvid
return "BufferProvider[capacity=" + bufferCapacity + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
- protected abstract Buffer doProvideBuffer();
+ protected abstract IBuffer doProvideBuffer();
- protected abstract void doRetainBuffer(Buffer buffer);
+ protected abstract void doRetainBuffer(IBuffer buffer);
}
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 cacaf7b..ed4dde3 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
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.IBufferProvider;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -37,11 +37,11 @@ public final class BufferUtil
{
}
- public static BufferProvider getBufferProvider(Object object)
+ public static IBufferProvider getBufferProvider(Object object)
{
- if (object instanceof BufferProvider)
+ if (object instanceof IBufferProvider)
{
- return (BufferProvider)object;
+ return (IBufferProvider)object;
}
if (object == null)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
index b107650..cd96202 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Channel.java
@@ -10,23 +10,23 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferHandler;
-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.IBuffer;
+import org.eclipse.net4j.transport.IBufferHandler;
+import org.eclipse.net4j.transport.IBufferProvider;
+import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.net4j.transport.IChannelID;
+import org.eclipse.net4j.transport.IConnector;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.concurrent.IWorkSerializer;
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.transport.BufferImpl.State;
+import org.eclipse.internal.net4j.transport.Buffer.State;
import org.eclipse.internal.net4j.util.Value;
import org.eclipse.internal.net4j.util.concurrent.AsynchronousWorkSerializer;
import org.eclipse.internal.net4j.util.concurrent.SynchronousWorkSerializer;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -35,34 +35,34 @@ import java.util.concurrent.ExecutorService;
/**
* @author Eike Stepper
*/
-public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvider
+public class Channel extends Lifecycle implements IChannel, IBufferProvider
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL, ChannelImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL, Channel.class);
- private short channelIndex = BufferImpl.NO_CHANNEL;
+ private short channelIndex = Buffer.NO_CHANNEL;
- private AbstractConnector connector;
+ private Connector connector;
/**
* The external handler for buffers passed from the {@link #connector}.
* <p>
*/
- private BufferHandler receiveHandler;
+ private IBufferHandler receiveHandler;
private ExecutorService receiveExecutor;
private IWorkSerializer receiveSerializer;
- private Queue<Buffer> sendQueue;
+ private Queue<IBuffer> sendQueue;
- public IRegistry<ChannelID, Channel> channelRegistry;
+ public IRegistry<IChannelID, IChannel> channelRegistry;
- public ChannelImpl(ExecutorService receiveExecutor)
+ public Channel(ExecutorService receiveExecutor)
{
this.receiveExecutor = receiveExecutor;
}
- public ChannelID getID()
+ public IChannelID getID()
{
return new ChannelIDImpl();
}
@@ -74,7 +74,7 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
public void setChannelIndex(short channelIndex)
{
- if (channelIndex == BufferImpl.NO_CHANNEL)
+ if (channelIndex == Buffer.NO_CHANNEL)
{
throw new IllegalArgumentException("channelIndex == INVALID_CHANNEL_ID"); //$NON-NLS-1$
}
@@ -82,12 +82,12 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
this.channelIndex = channelIndex;
}
- public Connector getConnector()
+ public IConnector getConnector()
{
return connector;
}
- public void setConnector(AbstractConnector connector)
+ public void setConnector(Connector connector)
{
this.connector = connector;
}
@@ -97,37 +97,37 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
return connector.getBufferProvider().getBufferCapacity();
}
- public Buffer provideBuffer()
+ public IBuffer provideBuffer()
{
return connector.getBufferProvider().provideBuffer();
}
- public void retainBuffer(Buffer buffer)
+ public void retainBuffer(IBuffer buffer)
{
connector.getBufferProvider().retainBuffer(buffer);
}
- public Queue<Buffer> getSendQueue()
+ public Queue<IBuffer> getSendQueue()
{
return sendQueue;
}
- public IRegistry<ChannelID, Channel> getChannelRegistry()
+ public IRegistry<IChannelID, IChannel> getChannelRegistry()
{
return channelRegistry;
}
- public void setChannelRegistry(IRegistry<ChannelID, Channel> channelRegistry)
+ public void setChannelRegistry(IRegistry<IChannelID, IChannel> channelRegistry)
{
this.channelRegistry = channelRegistry;
}
- public BufferHandler getReceiveHandler()
+ public IBufferHandler getReceiveHandler()
{
return receiveHandler;
}
- public void setReceiveHandler(BufferHandler receiveHandler)
+ public void setReceiveHandler(IBufferHandler receiveHandler)
{
this.receiveHandler = receiveHandler;
}
@@ -147,14 +147,14 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
deactivate();
}
- public void sendBuffer(Buffer buffer)
+ public void sendBuffer(IBuffer buffer)
{
handleBuffer(buffer);
}
- public void handleBuffer(Buffer buffer)
+ public void handleBuffer(IBuffer buffer)
{
- State state = ((BufferImpl)buffer).getState();
+ State state = ((Buffer)buffer).getState();
if (state != State.PUTTING)
{
Net4j.LOG.warn("Ignoring buffer in state == " + state + ": " + this); //$NON-NLS-1$ //$NON-NLS-2$
@@ -175,7 +175,7 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
connector.multiplexBuffer(this);
}
- public void handleBufferFromMultiplexer(final Buffer buffer)
+ public void handleBufferFromMultiplexer(final IBuffer buffer)
{
if (receiveHandler == null)
{
@@ -199,10 +199,10 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
}
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
- if (channelIndex == BufferImpl.NO_CHANNEL)
+ super.doBeforeActivate();
+ if (channelIndex == Buffer.NO_CHANNEL)
{
throw new IllegalStateException("channelIndex == INVALID_CHANNEL_ID"); //$NON-NLS-1$
}
@@ -214,9 +214,9 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
sendQueue = new ConcurrentLinkedQueue();
if (receiveExecutor == null)
{
@@ -235,7 +235,7 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
if (!isInternal() && channelRegistry != null)
{
@@ -250,13 +250,13 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
sendQueue = null;
}
- super.onDeactivate();
+ super.doDeactivate();
}
/**
* @author Eike Stepper
*/
- private final class ChannelIDImpl extends Value implements ChannelID
+ private final class ChannelIDImpl extends Value implements IChannelID
{
private static final long serialVersionUID = 1L;
@@ -264,7 +264,7 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
{
}
- public Connector getConnector()
+ public IConnector getConnector()
{
return connector;
}
@@ -283,9 +283,9 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
@Override
public boolean equals(Object obj)
{
- if (obj instanceof ChannelID)
+ if (obj instanceof IChannelID)
{
- ChannelID that = (ChannelID)obj;
+ IChannelID that = (IChannelID)obj;
return channelIndex == that.getChannelIndex() && ObjectUtil.equals(connector, that.getConnector());
}
@@ -310,9 +310,9 @@ public class ChannelImpl extends LifecycleImpl implements Channel, BufferProvide
*/
private final class ReceiverWork implements Runnable
{
- private final Buffer buffer;
+ private final IBuffer buffer;
- private ReceiverWork(Buffer buffer)
+ private ReceiverWork(IBuffer buffer)
{
this.buffer = buffer;
}
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/Connector.java
index dbdf265..b083da5 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/Connector.java
@@ -10,31 +10,30 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
-import org.eclipse.net4j.transport.Connector;
-import org.eclipse.net4j.transport.ConnectorChannelsEvent;
-import org.eclipse.net4j.transport.ConnectorCredentials;
import org.eclipse.net4j.transport.ConnectorException;
import org.eclipse.net4j.transport.ConnectorLocation;
import org.eclipse.net4j.transport.ConnectorState;
-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.IBuffer;
+import org.eclipse.net4j.transport.IBufferProvider;
+import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.net4j.transport.IConnector;
+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.event.IListener;
import org.eclipse.net4j.util.event.INotifier;
-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.om.trace.ContextTracer;
+import org.eclipse.net4j.util.product.IProduct;
import org.eclipse.net4j.util.registry.IRegistry;
import org.eclipse.internal.net4j.bundle.Net4j;
-import org.eclipse.internal.net4j.util.event.EventImpl;
-import org.eclipse.internal.net4j.util.event.NotifierImpl;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
+import org.eclipse.internal.net4j.util.container.LifecycleEventConverter;
+import org.eclipse.internal.net4j.util.event.Event;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.List;
@@ -46,11 +45,11 @@ import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
*/
-public abstract class AbstractConnector extends LifecycleImpl implements Connector, INotifier.Introspection
+public abstract class Connector extends Lifecycle implements IConnector, IContainer<IChannel>, IProduct
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, AbstractConnector.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, Connector.class);
- private static final ChannelImpl NULL_CHANNEL = new NullChannel();
+ private static final Channel NULL_CHANNEL = new NullChannel();
private static final int MIN_CONNECTOR_ID = 1;
@@ -64,15 +63,15 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
private String description;
- private ConnectorCredentials credentials;
+ private IConnectorCredentials credentials;
- private IRegistry<ProtocolFactoryID, ProtocolFactory> protocolFactoryRegistry;
+ private IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry;
- private BufferProvider bufferProvider;
+ private IBufferProvider bufferProvider;
/**
- * An optional executor to be used by the {@link Channel}s to process their
- * {@link ChannelImpl#receiveQueue} instead of the current thread. If not
+ * An optional executor to be used by the {@link IChannel}s to process their
+ * {@link Channel#receiveQueue} instead of the current thread. If not
* <code>null</code> the sender and the receiver peers become decoupled.
* <p>
*/
@@ -81,23 +80,21 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
/**
* TODO synchronize on channels?
*/
- private List<ChannelImpl> channels = new ArrayList(0);
+ private List<Channel> channels = new ArrayList(0);
private ConnectorState connectorState = ConnectorState.DISCONNECTED;
- private transient NotifierImpl notifier = new NotifierImpl();
-
/**
- * Is registered with each {@link Channel} of this {@link Connector}.
+ * Is registered with each {@link IChannel} of this {@link IConnector}.
* <p>
*/
- private transient LifecycleListener channelLifecycleListener = new ChannelLifecycleListener();
+ private transient IListener lifecycleEventConverter = new LifecycleEventConverter(this);
private transient CountDownLatch finishedConnecting;
private transient CountDownLatch finishedNegotiating;
- public AbstractConnector()
+ public Connector()
{
}
@@ -106,22 +103,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return connectorID;
}
- public abstract void multiplexBuffer(Channel channel);
-
- public void addListener(IListener listener)
- {
- notifier.addListener(listener);
- }
-
- public void removeListener(IListener listener)
- {
- notifier.removeListener(listener);
- }
-
- public IListener[] getListeners()
- {
- return notifier.getListeners();
- }
+ public abstract void multiplexBuffer(IChannel channel);
public ExecutorService getReceiveExecutor()
{
@@ -133,22 +115,22 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
this.receiveExecutor = receiveExecutor;
}
- public IRegistry<ProtocolFactoryID, ProtocolFactory> getProtocolFactoryRegistry()
+ public IRegistry<IProtocolFactoryID, IProtocolFactory> getProtocolFactoryRegistry()
{
return protocolFactoryRegistry;
}
- public void setProtocolFactoryRegistry(IRegistry<ProtocolFactoryID, ProtocolFactory> protocolFactoryRegistry)
+ public void setProtocolFactoryRegistry(IRegistry<IProtocolFactoryID, IProtocolFactory> protocolFactoryRegistry)
{
this.protocolFactoryRegistry = protocolFactoryRegistry;
}
- public BufferProvider getBufferProvider()
+ public IBufferProvider getBufferProvider()
{
return bufferProvider;
}
- public void setBufferProvider(BufferProvider bufferProvider)
+ public void setBufferProvider(IBufferProvider bufferProvider)
{
this.bufferProvider = bufferProvider;
}
@@ -168,6 +150,16 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return userID;
}
+ public String getProductGroupID()
+ {
+ return PRODUCT_GROUP_ID;
+ }
+
+ public ConnectorLocation getLocation()
+ {
+ return null;
+ }
+
public String getDescription()
{
return description;
@@ -178,12 +170,12 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
this.description = description;
}
- public ConnectorCredentials getCredentials()
+ public IConnectorCredentials getCredentials()
{
return credentials;
}
- public void setCredentials(ConnectorCredentials credentials)
+ public void setCredentials(IConnectorCredentials credentials)
{
this.credentials = credentials;
}
@@ -205,7 +197,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
connectorState = newState;
- fireStateChanged(oldState, newState);
+ fireEvent(new ConnectorStateEventImpl(this, oldState, newState));
switch (newState)
{
case DISCONNECTED:
@@ -311,12 +303,12 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return new ConnectorException(ex);
}
- public Channel[] getChannels()
+ public IChannel[] getChannels()
{
- final List<Channel> result = new ArrayList(channels.size());
+ final List<IChannel> result = new ArrayList(channels.size());
synchronized (channels)
{
- for (final ChannelImpl channel : channels)
+ for (final Channel channel : channels)
{
if (channel != NULL_CHANNEL)
{
@@ -325,24 +317,29 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
}
- return result.toArray(new Channel[result.size()]);
+ return result.toArray(new IChannel[result.size()]);
}
- public Channel openChannel() throws ConnectorException
+ public IChannel[] getElements()
+ {
+ return getChannels();
+ }
+
+ public IChannel openChannel() throws ConnectorException
{
return openChannel(null);
}
- public Channel openChannel(String protocolID) throws ConnectorException
+ public IChannel openChannel(String protocolID) throws ConnectorException
{
return openChannel(protocolID, null);
}
- public Channel openChannel(String protocolID, Object protocolData) throws ConnectorException
+ public IChannel openChannel(String protocolID, Object protocolData) throws ConnectorException
{
waitForConnection(Long.MAX_VALUE);
short channelIndex = findFreeChannelIndex();
- ChannelImpl channel = createChannel(channelIndex, protocolID, protocolData);
+ Channel channel = createChannel(channelIndex, protocolID, protocolData);
registerChannelWithPeer(channelIndex, protocolID);
try
@@ -361,10 +358,10 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return channel;
}
- public ChannelImpl createChannel(short channelIndex, String protocolID, Object protocolData)
+ public Channel createChannel(short channelIndex, String protocolID, Object protocolData)
{
- ChannelImpl channel = new ChannelImpl(receiveExecutor);
- Protocol protocol = createProtocol(protocolID, channel, protocolData);
+ Channel channel = new Channel(receiveExecutor);
+ IProtocol protocol = createProtocol(protocolID, channel, protocolData);
if (TRACER.isEnabled())
{
TRACER.trace("Opening channel " + channelIndex //$NON-NLS-1$
@@ -374,16 +371,16 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
channel.setChannelIndex(channelIndex);
channel.setConnector(this);
channel.setReceiveHandler(protocol);
- channel.addLifecycleListener(channelLifecycleListener);
+ channel.addListener(lifecycleEventConverter);
addChannel(channel);
return channel;
}
- public ChannelImpl getChannel(short channelIndex)
+ public Channel getChannel(short channelIndex)
{
try
{
- ChannelImpl channel = channels.get(channelIndex);
+ Channel channel = channels.get(channelIndex);
if (channel == NULL_CHANNEL)
{
channel = null;
@@ -402,16 +399,16 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
}
- protected List<Queue<Buffer>> getChannelBufferQueues()
+ protected List<Queue<IBuffer>> getChannelBufferQueues()
{
- final List<Queue<Buffer>> result = new ArrayList(channels.size());
+ final List<Queue<IBuffer>> result = new ArrayList(channels.size());
synchronized (channels)
{
- for (final ChannelImpl channel : channels)
+ for (final Channel channel : channels)
{
if (channel != NULL_CHANNEL && channel.isActive())
{
- Queue<Buffer> bufferQueue = channel.getSendQueue();
+ Queue<IBuffer> bufferQueue = channel.getSendQueue();
result.add(bufferQueue);
}
}
@@ -437,7 +434,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
}
- protected void addChannel(ChannelImpl channel)
+ protected void addChannel(Channel channel)
{
short channelIndex = channel.getChannelIndex();
while (channelIndex >= channels.size())
@@ -448,9 +445,9 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
channels.set(channelIndex, channel);
}
- protected void removeChannel(ChannelImpl channel)
+ protected void removeChannel(Channel channel)
{
- channel.removeLifecycleListener(channelLifecycleListener);
+ channel.removeListener(lifecycleEventConverter);
int channelIndex = channel.getChannelIndex();
if (TRACER.isEnabled())
{
@@ -460,15 +457,15 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
channels.set(channelIndex, NULL_CHANNEL);
}
- protected Protocol createProtocol(String protocolID, Channel channel, Object protocolData)
+ protected IProtocol createProtocol(String protocolID, IChannel channel, Object protocolData)
{
if (protocolID == null || protocolID.length() == 0 || protocolFactoryRegistry == null)
{
return null;
}
- ProtocolFactoryID protocolFactoryID = ProtocolFactoryIDImpl.create(getLocation(), protocolID);
- ProtocolFactory factory = protocolFactoryRegistry.get(protocolFactoryID);
+ IProtocolFactoryID protocolFactoryID = ProtocolFactoryID.create(getLocation(), protocolID);
+ IProtocolFactory factory = protocolFactoryRegistry.get(protocolFactoryID);
if (factory == null)
{
@@ -483,30 +480,10 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return factory.createProtocol(channel, protocolData);
}
- protected void fireStateChanged(ConnectorState oldState, ConnectorState newState)
- {
- notifier.fireEvent(new ConnectorStateEventImpl(this, oldState, newState));
- }
-
- protected void fireChannelAboutToOpen(Channel channel)
- {
- notifier.fireEvent(new ConnectorChannelsEventImpl(this, channel, ConnectorChannelsEvent.Type.ABOUT_TO_OPEN));
- }
-
- protected void fireChannelOpened(Channel channel)
- {
- notifier.fireEvent(new ConnectorChannelsEventImpl(this, channel, ConnectorChannelsEvent.Type.OPENED));
- }
-
- protected void fireChannelClosing(Channel channel)
- {
- notifier.fireEvent(new ConnectorChannelsEventImpl(this, channel, ConnectorChannelsEvent.Type.CLOSING));
- }
-
@Override
- protected void onAboutToActivate() throws Exception
+ protected void doBeforeActivate() throws Exception
{
- super.onAboutToActivate();
+ super.doBeforeActivate();
if (description == null)
{
throw new IllegalStateException("description == null"); //$NON-NLS-1$
@@ -524,7 +501,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
if (protocolFactoryRegistry == null && TRACER.isEnabled())
{
// Just a reminder during development
- TRACER.trace("No receive protocolFactoryRegistry!"); //$NON-NLS-1$
+ TRACER.trace("No protocolFactoryRegistry!"); //$NON-NLS-1$
}
if (receiveExecutor == null && TRACER.isEnabled())
@@ -535,19 +512,19 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
@Override
- protected void onActivate() throws Exception
+ protected void doActivate() throws Exception
{
- super.onActivate();
+ super.doActivate();
setState(ConnectorState.CONNECTING);
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
setState(ConnectorState.DISCONNECTED);
for (short i = 0; i < channels.size(); i++)
{
- ChannelImpl channel = channels.get(i);
+ Channel channel = channels.get(i);
if (channel != null)
{
LifecycleUtil.deactivate(channel);
@@ -555,7 +532,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
channels.clear();
- super.onDeactivate();
+ super.doDeactivate();
}
protected abstract void registerChannelWithPeer(short channelIndex, String protocolID) throws ConnectorException;
@@ -583,7 +560,7 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
/**
* @author Eike Stepper
*/
- private static final class NullChannel extends ChannelImpl
+ private static final class NullChannel extends Channel
{
private NullChannel()
{
@@ -604,37 +581,9 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
}
/**
- * Is registered with each {@link Channel} of this {@link Connector}.
- * <p>
- *
- * @author Eike Stepper
- */
- private final class ChannelLifecycleListener implements LifecycleListener
- {
- public void notifyLifecycleAboutToActivate(LifecycleNotifier notifier)
- {
- ChannelImpl channel = (ChannelImpl)notifier;
- fireChannelAboutToOpen(channel);
- }
-
- public void notifyLifecycleActivated(LifecycleNotifier notifier)
- {
- ChannelImpl channel = (ChannelImpl)notifier;
- fireChannelOpened(channel);
- }
-
- public void notifyLifecycleDeactivating(LifecycleNotifier notifier)
- {
- ChannelImpl channel = (ChannelImpl)notifier;
- fireChannelClosing(channel);
- removeChannel(channel);
- }
- }
-
- /**
* @author Eike Stepper
*/
- private static class ConnectorStateEventImpl extends EventImpl implements ConnectorStateEvent
+ private static class ConnectorStateEventImpl extends Event implements IConnectorStateEvent
{
private static final long serialVersionUID = 1L;
@@ -659,33 +608,4 @@ public abstract class AbstractConnector extends LifecycleImpl implements Connect
return newState;
}
}
-
- /**
- * @author Eike Stepper
- */
- private static class ConnectorChannelsEventImpl extends EventImpl implements ConnectorChannelsEvent
- {
- private static final long serialVersionUID = 1L;
-
- private Channel channel;
-
- private ConnectorChannelsEvent.Type type;
-
- public ConnectorChannelsEventImpl(INotifier notifier, Channel channel, Type type)
- {
- super(notifier);
- this.channel = channel;
- this.type = type;
- }
-
- public Channel getChannel()
- {
- return channel;
- }
-
- public ConnectorChannelsEvent.Type getType()
- {
- return type;
- }
- }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorCredentialsImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorCredentials.java
index d693993..7dca39f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorCredentialsImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ConnectorCredentials.java
@@ -10,16 +10,16 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.ConnectorCredentials;
+import org.eclipse.net4j.transport.IConnectorCredentials;
/**
* @author Eike Stepper
*/
-public class ConnectorCredentialsImpl implements ConnectorCredentials
+public class ConnectorCredentials implements IConnectorCredentials
{
private String userID;
- public ConnectorCredentialsImpl(String userID)
+ public ConnectorCredentials(String userID)
{
this.userID = userID;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java
index e9abd08..40bb3d0 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Protocol.java
@@ -10,26 +10,27 @@
**************************************************************************/
package org.eclipse.internal.net4j.transport;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
-import org.eclipse.net4j.transport.Protocol;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IBufferProvider;
+import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.net4j.transport.IProtocol;
+import org.eclipse.net4j.util.product.IProduct;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
/**
* @author Eike Stepper
*/
-public abstract class AbstractProtocol extends LifecycleImpl implements Protocol, BufferProvider
+public abstract class Protocol extends Lifecycle implements IProtocol, IBufferProvider, IProduct
{
- private Channel channel;
+ private IChannel channel;
- public AbstractProtocol(Channel channel)
+ public Protocol(IChannel channel)
{
this.channel = channel;
}
- public Channel getChannel()
+ public IChannel getChannel()
{
return channel;
}
@@ -39,20 +40,20 @@ public abstract class AbstractProtocol extends LifecycleImpl implements Protocol
return BufferUtil.getBufferProvider(channel).getBufferCapacity();
}
- public Buffer provideBuffer()
+ public IBuffer provideBuffer()
{
return BufferUtil.getBufferProvider(channel).provideBuffer();
}
- public void retainBuffer(Buffer buffer)
+ public void retainBuffer(IBuffer buffer)
{
BufferUtil.getBufferProvider(channel).retainBuffer(buffer);
}
@Override
- protected void onDeactivate() throws Exception
+ protected void doDeactivate() throws Exception
{
channel = null;
- super.onDeactivate();
+ super.doDeactivate();
}
}
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/ProtocolFactory.java
index 748be5d..25ae987 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/ProtocolFactory.java
@@ -11,17 +11,17 @@
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.IProtocolFactory;
+import org.eclipse.net4j.transport.IProtocolFactoryID;
import java.text.MessageFormat;
/**
* @author Eike Stepper
*/
-public abstract class AbstractProtocolFactory implements ProtocolFactory
+public abstract class ProtocolFactory implements IProtocolFactory
{
- public AbstractProtocolFactory()
+ public ProtocolFactory()
{
}
@@ -40,9 +40,9 @@ public abstract class AbstractProtocolFactory implements ProtocolFactory
return isForClients() && isForServers();
}
- public ProtocolFactoryID getID(ConnectorLocation location)
+ public IProtocolFactoryID getID(ConnectorLocation location)
{
- return ProtocolFactoryIDImpl.create(location, getProtocolID());
+ return ProtocolFactoryID.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/ProtocolFactoryID.java
index d7c0413..7eedfac 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/ProtocolFactoryID.java
@@ -11,7 +11,7 @@
package org.eclipse.internal.net4j.transport;
import org.eclipse.net4j.transport.ConnectorLocation;
-import org.eclipse.net4j.transport.ProtocolFactoryID;
+import org.eclipse.net4j.transport.IProtocolFactoryID;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.internal.net4j.util.Value;
@@ -21,7 +21,7 @@ import java.text.MessageFormat;
/**
* @author Eike Stepper
*/
-public class ProtocolFactoryIDImpl extends Value implements ProtocolFactoryID
+public class ProtocolFactoryID extends Value implements IProtocolFactoryID
{
private static final long serialVersionUID = 1L;
@@ -29,7 +29,7 @@ public class ProtocolFactoryIDImpl extends Value implements ProtocolFactoryID
private String protocolID;
- public ProtocolFactoryIDImpl(ConnectorLocation location, String protocolID)
+ public ProtocolFactoryID(ConnectorLocation location, String protocolID)
{
this.location = location;
this.protocolID = protocolID;
@@ -54,9 +54,9 @@ public class ProtocolFactoryIDImpl extends Value implements ProtocolFactoryID
@Override
public boolean equals(Object obj)
{
- if (obj instanceof ProtocolFactoryID)
+ if (obj instanceof IProtocolFactoryID)
{
- ProtocolFactoryID that = (ProtocolFactoryID)obj;
+ IProtocolFactoryID that = (IProtocolFactoryID)obj;
return this.location == that.getLocation() && ObjectUtil.equals(this.protocolID, that.getProtocolID());
}
@@ -75,8 +75,8 @@ public class ProtocolFactoryIDImpl extends Value implements ProtocolFactoryID
return MessageFormat.format("{0}[{1}]", location, protocolID);
}
- public static ProtocolFactoryID create(ConnectorLocation location, String protocolID)
+ public static IProtocolFactoryID create(ConnectorLocation location, String protocolID)
{
- return new ProtocolFactoryIDImpl(location, protocolID);
+ return new ProtocolFactoryID(location, protocolID);
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerDelta.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerDelta.java
new file mode 100644
index 0000000..46d18b2
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerDelta.java
@@ -0,0 +1,34 @@
+package org.eclipse.internal.net4j.util.container;
+
+import org.eclipse.net4j.util.container.IContainerDelta;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerDelta<E> implements IContainerDelta<E>
+{
+ private E element;
+
+ private Kind kind;
+
+ public ContainerDelta(E element, Kind kind)
+ {
+ this.element = element;
+ this.kind = kind;
+ }
+
+ public E getElement()
+ {
+ return element;
+ }
+
+ public E setValue(E value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Kind getKind()
+ {
+ return kind;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
new file mode 100644
index 0000000..6e8c360
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
@@ -0,0 +1,90 @@
+package org.eclipse.internal.net4j.util.container;
+
+import static org.eclipse.net4j.util.container.IContainerDelta.Kind.ADDED;
+import static org.eclipse.net4j.util.container.IContainerDelta.Kind.REMOVED;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.container.IContainerEventVisitor;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
+import org.eclipse.net4j.util.container.IContainerEventVisitor.Filtered;
+
+import org.eclipse.internal.net4j.util.event.Event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerEvent<E> extends Event implements IContainerEvent<E>
+{
+ private static final long serialVersionUID = 1L;
+
+ private List<IContainerDelta<E>> deltas;
+
+ public ContainerEvent(IContainer<E> registry)
+ {
+ super(registry);
+ deltas = new ArrayList();
+ }
+
+ public ContainerEvent(IContainer<E> registry, List<IContainerDelta<E>> deltas)
+ {
+ super(registry);
+ this.deltas = deltas;
+ }
+
+ public IContainer<E> getContainer()
+ {
+ return (IContainer<E>)getSource();
+ }
+
+ public IContainerDelta<E>[] getDeltas()
+ {
+ return deltas.toArray(new IContainerDelta[deltas.size()]);
+ }
+
+ public boolean isEmpty()
+ {
+ return deltas.isEmpty();
+ }
+
+ public void addDelta(E element, Kind kind)
+ {
+ addDelta(new ContainerDelta(element, kind));
+ }
+
+ public void addDelta(IContainerDelta<E> delta)
+ {
+ deltas.add(delta);
+ }
+
+ public void accept(IContainerEventVisitor<E> visitor)
+ {
+ for (IContainerDelta<E> delta : deltas)
+ {
+ E element = delta.getElement();
+
+ boolean filtered = true;
+ if (visitor instanceof Filtered)
+ {
+ filtered = ((Filtered)visitor).filter(element);
+ }
+
+ if (filtered)
+ {
+ switch (delta.getKind())
+ {
+ case ADDED:
+ visitor.added(element);
+ break;
+ case REMOVED:
+ visitor.removed(element);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java
new file mode 100644
index 0000000..7d809ef
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/LifecycleEventConverter.java
@@ -0,0 +1,70 @@
+package org.eclipse.internal.net4j.util.container;
+
+import org.eclipse.net4j.transport.IChannel;
+import org.eclipse.net4j.transport.IConnector;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+
+import org.eclipse.internal.net4j.util.event.Notifier;
+
+/**
+ * Is registered with each {@link IChannel} of this {@link IConnector}.
+ * <p>
+ *
+ * @author Eike Stepper
+ */
+public class LifecycleEventConverter<E> implements IListener
+{
+ private Notifier owner;
+
+ public LifecycleEventConverter(Notifier owner)
+ {
+ this.owner = owner;
+ }
+
+ public INotifier getOwner()
+ {
+ return owner;
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof ILifecycleEvent)
+ {
+ ILifecycleEvent e = (ILifecycleEvent)event;
+ switch (e.getKind())
+ {
+ case ACTIVATED:
+ added(e);
+ fireContainerEvent(e, IContainerDelta.Kind.ADDED);
+ return;
+
+ case DEACTIVATED:
+ removed(e);
+ fireContainerEvent(e, IContainerDelta.Kind.REMOVED);
+ return;
+ }
+ }
+
+ owner.fireEvent(event);
+ }
+
+ protected void added(ILifecycleEvent e)
+ {
+ }
+
+ protected void removed(ILifecycleEvent e)
+ {
+ }
+
+ private void fireContainerEvent(ILifecycleEvent e, IContainerDelta.Kind kind)
+ {
+ ContainerEvent<E> containerEvent = new ContainerEvent<E>((IContainer<E>)owner);
+ containerEvent.addDelta(new ContainerDelta<E>((E)e.getLifecycle(), kind));
+ owner.fireEvent(containerEvent);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/EventImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/Event.java
index 87531c3..b945a53 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/EventImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/Event.java
@@ -18,16 +18,16 @@ import java.util.EventObject;
/**
* @author Eike Stepper
*/
-public class EventImpl extends EventObject implements IEvent
+public class Event extends EventObject implements IEvent
{
private static final long serialVersionUID = 1L;
- public EventImpl(INotifier notifier)
+ public Event(INotifier notifier)
{
super(notifier);
}
- public INotifier getNotifier()
+ public INotifier getSource()
{
return (INotifier)source;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/NotifierImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/Notifier.java
index 5965663..44dad12 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/NotifierImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/event/Notifier.java
@@ -22,11 +22,11 @@ import java.util.List;
/**
* @author Eike Stepper
*/
-public class NotifierImpl implements INotifier
+public class Notifier implements INotifier.Introspection
{
private List<IListener> listeners = new ArrayList(0);
- public NotifierImpl()
+ public Notifier()
{
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/Lifecycle.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/Lifecycle.java
new file mode 100644
index 0000000..fac0ed4
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/Lifecycle.java
@@ -0,0 +1,132 @@
+/***************************************************************************
+ * 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.util.lifecycle;
+
+import org.eclipse.net4j.util.ReflectUtil;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.event.Notifier;
+
+/**
+ * @author Eike Stepper
+ */
+public class Lifecycle extends Notifier implements ILifecycle
+{
+ public static boolean USE_LABEL = true;
+
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_LIFECYCLE, Lifecycle.class);
+
+ private static final ContextTracer DUMPER = new ContextTracer(Net4j.DEBUG_LIFECYCLE_DUMP, Lifecycle.class);
+
+ private boolean active;
+
+ protected Lifecycle()
+ {
+ }
+
+ public final synchronized void activate() throws Exception
+ {
+ if (!active)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Activating " + this);//$NON-NLS-1$
+ }
+
+ doBeforeActivate();
+ fireEvent(new LifecycleEvent(this, ILifecycleEvent.Kind.ABOUT_TO_ACTIVATE));
+ dump();
+
+ doActivate();
+ active = true;
+ fireEvent(new LifecycleEvent(this, ILifecycleEvent.Kind.ACTIVATED));
+ }
+ }
+
+ public final synchronized Exception deactivate()
+ {
+ if (active)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Deactivating " + this);//$NON-NLS-1$
+ }
+
+ try
+ {
+ doBeforeDeactivate();
+ fireEvent(new LifecycleEvent(this, ILifecycleEvent.Kind.ABOUT_TO_DEACTIVATE));
+ doDeactivate();
+ fireEvent(new LifecycleEvent(this, ILifecycleEvent.Kind.DEACTIVATED));
+ }
+ catch (Exception ex)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(ex);
+ }
+
+ return ex;
+ }
+ finally
+ {
+ active = false;
+ }
+ }
+
+ return null;
+ }
+
+ public final boolean isActive()
+ {
+ return active;
+ }
+
+ public void dump()
+ {
+ if (DUMPER.isEnabled())
+ {
+ DUMPER.trace("DUMP" + ReflectUtil.toString(this)); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ if (USE_LABEL)
+ {
+ return ReflectUtil.getLabel(this);
+ }
+ else
+ {
+ return super.toString();
+ }
+ }
+
+ protected void doBeforeActivate() throws Exception
+ {
+ }
+
+ protected void doActivate() throws Exception
+ {
+ }
+
+ protected void doBeforeDeactivate() throws Exception
+ {
+ }
+
+ protected void doDeactivate() throws Exception
+ {
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEvent.java
new file mode 100644
index 0000000..a59d808
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEvent.java
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * 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.util.lifecycle;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+
+import org.eclipse.internal.net4j.util.event.Event;
+
+/**
+ * @author Eike Stepper
+ */
+public class LifecycleEvent extends Event implements ILifecycleEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private Kind kind;
+
+ public LifecycleEvent(Lifecycle lifecycle, Kind kind)
+ {
+ super(lifecycle);
+ this.kind = kind;
+ }
+
+ public ILifecycle getLifecycle()
+ {
+ return (ILifecycle)getSource();
+ }
+
+ public Kind getKind()
+ {
+ return kind;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleImpl.java
deleted file mode 100644
index 0d490e4..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleImpl.java
+++ /dev/null
@@ -1,194 +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.util.lifecycle;
-
-import org.eclipse.net4j.util.ReflectUtil;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleListener;
-import org.eclipse.net4j.util.lifecycle.LifecycleNotifier;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.internal.net4j.bundle.Net4j;
-
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-/**
- * @author Eike Stepper
- */
-public class LifecycleImpl implements Lifecycle, LifecycleNotifier
-{
- public static boolean USE_LABEL = true;
-
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_LIFECYCLE, LifecycleImpl.class);
-
- private static final ContextTracer DUMPER = new ContextTracer(Net4j.DEBUG_LIFECYCLE_DUMP, LifecycleImpl.class);
-
- private boolean active;
-
- /**
- * Don't initialize lazily to circumvent synchronization!
- */
- private Queue<LifecycleListener> listeners = new ConcurrentLinkedQueue();
-
- protected LifecycleImpl()
- {
- }
-
- public final void addLifecycleListener(LifecycleListener listener)
- {
- listeners.add(listener);
- }
-
- public final void removeLifecycleListener(LifecycleListener listener)
- {
- listeners.remove(listener);
- }
-
- public final synchronized void activate() throws Exception
- {
- if (!active)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Activating " + this);//$NON-NLS-1$
- }
-
- onAboutToActivate();
- fireLifecycleAboutToActivate();
- if (DUMPER.isEnabled())
- {
- DUMPER.trace("DUMP" + ReflectUtil.toString(this)); //$NON-NLS-1$
- }
-
- onActivate();
- active = true;
- fireLifecycleActivated();
- }
- }
-
- public final synchronized Exception deactivate()
- {
- if (active)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Deactivating " + this);//$NON-NLS-1$
- }
-
- fireLifecycleDeactivating();
-
- try
- {
- onDeactivate();
- }
- catch (Exception ex)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace(ex);
- }
-
- return ex;
- }
- finally
- {
- active = false;
- }
- }
-
- return null;
- }
-
- public final boolean isActive()
- {
- return active;
- }
-
- @Override
- public String toString()
- {
- if (USE_LABEL)
- {
- return ReflectUtil.getLabel(this);
- }
- else
- {
- return super.toString();
- }
- }
-
- protected void fireLifecycleAboutToActivate()
- {
- for (LifecycleListener listener : listeners)
- {
- try
- {
- listener.notifyLifecycleAboutToActivate(this);
- }
- catch (Exception ex)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace(ex);
- }
- }
- }
- }
-
- protected void fireLifecycleActivated()
- {
- for (LifecycleListener listener : listeners)
- {
- try
- {
- listener.notifyLifecycleActivated(this);
- }
- catch (Exception ex)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace(ex);
- }
- }
- }
- }
-
- protected void fireLifecycleDeactivating()
- {
- for (LifecycleListener listener : listeners)
- {
- try
- {
- listener.notifyLifecycleDeactivating(this);
- }
- catch (Exception ex)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace(ex);
- }
- }
- }
- }
-
- protected void onAboutToActivate() throws Exception
- {
- }
-
- protected void onActivate() throws Exception
- {
- }
-
- protected void onDeactivate() throws Exception
- {
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/NotifyingLifecycleImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/NotifyingLifecycleImpl.java
deleted file mode 100644
index b55b7f9..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/NotifyingLifecycleImpl.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.util.lifecycle;
-
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.event.INotifier;
-
-import org.eclipse.internal.net4j.util.event.NotifierImpl;
-
-/**
- * @author Eike Stepper
- */
-public class NotifyingLifecycleImpl extends LifecycleImpl implements INotifier.Introspection
-{
- private NotifierImpl notifier;
-
- public NotifyingLifecycleImpl()
- {
- }
-
- public void addListener(IListener listener)
- {
- notifier.addListener(listener);
- }
-
- public void removeListener(IListener listener)
- {
- notifier.removeListener(listener);
- }
-
- public IListener[] getListeners()
- {
- return notifier.getListeners();
- }
-
- protected void fireEvent(IEvent event)
- {
- notifier.fireEvent(event);
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java
new file mode 100644
index 0000000..716e85a
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * 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.util.product;
+
+import org.eclipse.net4j.util.product.IFactory;
+import org.eclipse.net4j.util.product.IProduct;
+import org.eclipse.net4j.util.product.IProductGroup;
+import org.eclipse.net4j.util.registry.IRegistry;
+
+import org.eclipse.internal.net4j.util.registry.HashMapRegistry;
+
+/**
+ * @author Eike Stepper
+ */
+public class ProductGroup<PRODUCT extends IProduct> implements IProductGroup<PRODUCT>
+{
+ private String id;
+
+ private IRegistry<String, IFactory<PRODUCT>> factoryRegistry = new HashMapRegistry();
+
+ public ProductGroup(String id)
+ {
+ this.id = id;
+ }
+
+ public String getID()
+ {
+ return id;
+ }
+
+ public IRegistry<String, IFactory<PRODUCT>> getFactoryRegistry()
+ {
+ return factoryRegistry;
+ }
+
+ public void addFactory(IFactory<PRODUCT> factory)
+ {
+ factoryRegistry.put(factory.getType(), factory);
+ }
+
+ public void removeFactory(IFactory<PRODUCT> factory)
+ {
+ factoryRegistry.remove(factory.getType());
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/AbstractDelegatingRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/DelegatingRegistry.java
index 37b5dfc..7942241 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/AbstractDelegatingRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/DelegatingRegistry.java
@@ -30,16 +30,16 @@ import java.util.Set;
*
* @author Eike Stepper
*/
-public abstract class AbstractDelegatingRegistry<K, V> extends AbstractRegistry<K, V>
+public abstract class DelegatingRegistry<K, V> extends Registry<K, V>
{
private IRegistry<K, V> delegate;
- public AbstractDelegatingRegistry(IRegistry<K, V> delegate)
+ public DelegatingRegistry(IRegistry<K, V> delegate)
{
this.delegate = delegate;
}
- public AbstractDelegatingRegistry(IRegistry<K, V> delegate, boolean autoCommit)
+ public DelegatingRegistry(IRegistry<K, V> delegate, boolean autoCommit)
{
super(autoCommit);
this.delegate = delegate;
@@ -106,7 +106,7 @@ public abstract class AbstractDelegatingRegistry<K, V> extends AbstractRegistry<
V old = getMap().remove(key);
if (old != null)
{
- getTransaction().rememberDeregistered(key, old);
+ getTransaction().rememberDeregistered((K)key, old);
if (delegated != null)
{
// Hidden delegated element now becomes unhidden
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapDelegatingRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapDelegatingRegistry.java
index 816393e..8ed5eb3 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapDelegatingRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapDelegatingRegistry.java
@@ -18,7 +18,7 @@ import java.util.Map;
/**
* @author Eike Stepper
*/
-public class HashMapDelegatingRegistry<K, V> extends AbstractDelegatingRegistry<K, V>
+public class HashMapDelegatingRegistry<K, V> extends DelegatingRegistry<K, V>
{
private Map<K, V> map;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapRegistry.java
index 04d797b..ee05361 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/HashMapRegistry.java
@@ -16,7 +16,7 @@ import java.util.Map;
/**
* @author Eike Stepper
*/
-public class HashMapRegistry<K, V> extends AbstractRegistry<K, V>
+public class HashMapRegistry<K, V> extends Registry<K, V>
{
private Map<K, V> map;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/AbstractRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java
index e909265..b3dbc1e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/AbstractRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/Registry.java
@@ -10,61 +10,37 @@
**************************************************************************/
package org.eclipse.internal.net4j.util.registry;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.container.IContainerDelta;
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.net4j.util.registry.IRegistryDelta.Kind;
import org.eclipse.internal.net4j.bundle.Net4j;
+import org.eclipse.internal.net4j.util.container.ContainerEvent;
+import org.eclipse.internal.net4j.util.event.Notifier;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import java.util.Queue;
import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedQueue;
/**
* @author Eike Stepper
*/
-public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
+public abstract class Registry<K, V> extends Notifier implements IRegistry<K, V>
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_REGISTRY, AbstractRegistry.class);
-
- /**
- * Don't initialize lazily to circumvent synchronization!
- */
- private Queue<IRegistryListener> listeners = new ConcurrentLinkedQueue();
-
private boolean autoCommit;
private Transaction transaction;
- protected AbstractRegistry(boolean autoCommit)
+ protected Registry(boolean autoCommit)
{
this.autoCommit = autoCommit;
}
- protected AbstractRegistry()
+ protected Registry()
{
this(true);
}
- public void addRegistryListener(IRegistryListener<K, V> listener)
- {
- listeners.add(listener);
- }
-
- public void removeRegistryListener(IRegistryListener<K, V> listener)
- {
- listeners.remove(listener);
- }
-
public boolean isEmpty()
{
return keySet().isEmpty();
@@ -164,6 +140,11 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
}
}
+ public Entry<K, V>[] getElements()
+ {
+ return entrySet().toArray(new Entry[size()]);
+ }
+
public boolean isAutoCommit()
{
return autoCommit;
@@ -194,11 +175,6 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
commit(true);
}
- public synchronized void dispose()
- {
- listeners.clear();
- }
-
@Override
public String toString()
{
@@ -223,7 +199,7 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
V value = getMap().remove(key);
if (value != null)
{
- getTransaction().rememberDeregistered(key, value);
+ getTransaction().rememberDeregistered((K)key, value);
}
return value;
@@ -256,42 +232,6 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
}
}
- protected void fireRegistryEvent(IRegistryDelta<K, V> delta)
- {
- fireRegistryEvent(Collections.singletonList(delta));
- }
-
- protected void fireRegistryEvent(List<IRegistryDelta<K, V>> deltas)
- {
- fireRegistryEvent(new RegistryEvent<K, V>(AbstractRegistry.this, deltas));
- }
-
- protected void fireRegistryEvent(IRegistryEvent<K, V> event)
- {
- if (TRACER.isEnabled())
- {
- for (IRegistryDelta<K, V> delta : event.getDeltas())
- {
- K key = delta.getKey();
- V value = delta.getValue();
- Kind kind = delta.getKind();
- TRACER.trace("Registry delta " + key + " = " + value + " (" + kind + ")");
- }
- }
-
- for (IRegistryListener listener : listeners)
- {
- try
- {
- listener.notifyRegistryEvent(event);
- }
- catch (Exception ex)
- {
- Net4j.LOG.error(ex);
- }
- }
- }
-
protected void autoCommit()
{
if (autoCommit)
@@ -309,13 +249,19 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
{
private int nesting = 1;
- private List<IRegistryDelta<K, V>> deltas = new ArrayList();
+ private ContainerEvent<Map.Entry<K, V>> event;
private Thread owner;
public Transaction()
{
owner = Thread.currentThread();
+ initEvent();
+ }
+
+ private void initEvent()
+ {
+ event = new ContainerEvent(Registry.this);
}
public boolean isOwned()
@@ -332,68 +278,39 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
{
if (--nesting == 0)
{
- if (notifications && !deltas.isEmpty())
+ if (notifications && !event.isEmpty())
{
- fireRegistryEvent(deltas);
+ fireEvent(event);
}
- deltas = null;
+ initEvent();
}
}
public void rememberRegistered(K key, V value)
{
- deltas.add(new RegistryDelta(key, value, Kind.REGISTERED));
- }
-
- public void rememberDeregistered(Object key, V value)
- {
- deltas.add(new RegistryDelta(key, value, Kind.DEREGISTERED));
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static class RegistryEvent<K, V> implements IRegistryEvent<K, V>
- {
- private IRegistry<K, V> registry;
-
- private List<IRegistryDelta<K, V>> deltas;
-
- public RegistryEvent(IRegistry<K, V> registry, List<IRegistryDelta<K, V>> deltas)
- {
- this.registry = registry;
- this.deltas = deltas;
+ event.addDelta(new Element<K, V>(key, value), IContainerDelta.Kind.ADDED);
}
- public IRegistry<K, V> getRegistry()
+ public void rememberDeregistered(K key, V value)
{
- return registry;
- }
-
- public IRegistryDelta<K, V>[] getDeltas()
- {
- return deltas.toArray(new IRegistryDelta[deltas.size()]);
+ event.addDelta(new Element<K, V>(key, value), IContainerDelta.Kind.REMOVED);
}
}
/**
* @author Eike Stepper
*/
- public static class RegistryDelta<K, V> implements IRegistryDelta<K, V>
+ private static final class Element<K, V> implements Map.Entry<K, V>
{
- private K key;
-
- private V value;
+ private final K key;
- private Kind kind;
+ private final V value;
- public RegistryDelta(K key, V value, Kind kind)
+ private Element(K key, V value)
{
this.key = key;
this.value = value;
- this.kind = kind;
}
public K getKey()
@@ -410,10 +327,5 @@ public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
{
throw new UnsupportedOperationException();
}
-
- public Kind getKind()
- {
- return kind;
- }
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/MessageDeserializer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/IMessageDeserializer.java
index 6609bed..12ab457 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/MessageDeserializer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/IMessageDeserializer.java
@@ -13,6 +13,6 @@ package org.eclipse.net4j.message;
/**
* @author Eike Stepper
*/
-public interface MessageDeserializer
+public interface IMessageDeserializer
{
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/MessageSerializer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/IMessageSerializer.java
index 83d519e..4156412 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/MessageSerializer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/message/IMessageSerializer.java
@@ -13,6 +13,6 @@ package org.eclipse.net4j.message;
/**
* @author Eike Stepper
*/
-public interface MessageSerializer
+public interface IMessageSerializer
{
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/ServiceImporter.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/IServiceExporter.java
index 932849e..d0b18e2 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/ServiceImporter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/IServiceExporter.java
@@ -13,6 +13,6 @@ package org.eclipse.net4j.remote;
/**
* @author Eike Stepper
*/
-public interface ServiceImporter
+public interface IServiceExporter
{
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/ServiceExporter.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/IServiceImporter.java
index cdf0cb5..8af7c7c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/ServiceExporter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/remote/IServiceImporter.java
@@ -13,6 +13,6 @@ package org.eclipse.net4j.remote;
/**
* @author Eike Stepper
*/
-public interface ServiceExporter
+public interface IServiceImporter
{
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java
index 6fafbb5..dafeb45 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java
@@ -12,7 +12,7 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.stream.BufferInputStream;
import org.eclipse.net4j.stream.BufferOutputStream;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
@@ -28,7 +28,7 @@ public abstract class Request extends SignalActor
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL, Request.class);
- protected Request(Channel channel)
+ protected Request(IChannel channel)
{
super(channel);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java
index a1928b7..5ebf159 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java
@@ -12,7 +12,7 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.stream.BufferInputStream;
import org.eclipse.net4j.stream.BufferOutputStream;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
@@ -29,7 +29,7 @@ public abstract class RequestWithConfirmation<RESULT> extends SignalActor<RESULT
{
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL, RequestWithConfirmation.class);
- protected RequestWithConfirmation(Channel channel)
+ protected RequestWithConfirmation(IChannel channel)
{
super(channel);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java
index 66a7edf..74f7750 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java
@@ -11,8 +11,8 @@
package org.eclipse.net4j.signal;
import org.eclipse.net4j.stream.BufferInputStream;
-import org.eclipse.net4j.transport.BufferHandler;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IBufferHandler;
+import org.eclipse.net4j.transport.IChannel;
import org.eclipse.net4j.util.ReflectUtil;
/**
@@ -26,7 +26,7 @@ public abstract class SignalActor<RESULT> extends Signal
private RESULT result;
- protected SignalActor(Channel channel)
+ protected SignalActor(IChannel channel)
{
SignalProtocol protocol = extractSignalProtocol(channel);
setProtocol(protocol);
@@ -62,9 +62,9 @@ public abstract class SignalActor<RESULT> extends Signal
this.result = result;
}
- private static SignalProtocol extractSignalProtocol(Channel channel)
+ private static SignalProtocol extractSignalProtocol(IChannel channel)
{
- BufferHandler receiveHandler = channel.getReceiveHandler();
+ IBufferHandler receiveHandler = channel.getReceiveHandler();
if (receiveHandler == null)
{
throw new IllegalArgumentException("Channel has no protocol"); //$NON-NLS-1$
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 1dd79f0..53e6842 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
@@ -12,15 +12,15 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.stream.BufferInputStream;
import org.eclipse.net4j.stream.ChannelOutputStream;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
+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.AbstractProtocol;
import org.eclipse.internal.net4j.transport.BufferUtil;
-import org.eclipse.internal.net4j.transport.ChannelImpl;
+import org.eclipse.internal.net4j.transport.Channel;
+import org.eclipse.internal.net4j.transport.Protocol;
import java.nio.ByteBuffer;
import java.util.Map;
@@ -30,7 +30,7 @@ import java.util.concurrent.ExecutorService;
/**
* @author Eike Stepper
*/
-public abstract class SignalProtocol extends AbstractProtocol
+public abstract class SignalProtocol extends Protocol
{
public static final long NO_TIMEOUT = BufferInputStream.NO_TIMEOUT;
@@ -49,7 +49,7 @@ public abstract class SignalProtocol extends AbstractProtocol
private int nextCorrelationID = MIN_CORRELATION_ID;
- protected SignalProtocol(Channel channel, ExecutorService executorService)
+ protected SignalProtocol(IChannel channel, ExecutorService executorService)
{
super(channel);
@@ -61,9 +61,9 @@ public abstract class SignalProtocol extends AbstractProtocol
this.executorService = executorService;
}
- protected SignalProtocol(Channel channel)
+ protected SignalProtocol(IChannel channel)
{
- this(channel, ((ChannelImpl)channel).getReceiveExecutor());
+ this(channel, ((Channel)channel).getReceiveExecutor());
}
public boolean waitForSignals(long timeout)
@@ -86,7 +86,7 @@ public abstract class SignalProtocol extends AbstractProtocol
return true;
}
- public void handleBuffer(Buffer buffer)
+ public void handleBuffer(IBuffer buffer)
{
ByteBuffer byteBuffer = buffer.getByteBuffer();
int correlationID = byteBuffer.getInt();
@@ -221,9 +221,9 @@ public abstract class SignalProtocol extends AbstractProtocol
{
public SignalOutputStream(final int correlationID, final short signalID, final boolean addSignalID)
{
- super(getChannel(), new BufferProvider()
+ super(getChannel(), new IBufferProvider()
{
- private BufferProvider delegate = BufferUtil.getBufferProvider(getChannel());
+ private IBufferProvider delegate = BufferUtil.getBufferProvider(getChannel());
private boolean firstBuffer = addSignalID;
@@ -232,9 +232,9 @@ public abstract class SignalProtocol extends AbstractProtocol
return delegate.getBufferCapacity();
}
- public Buffer provideBuffer()
+ public IBuffer provideBuffer()
{
- Buffer buffer = delegate.provideBuffer();
+ IBuffer buffer = delegate.provideBuffer();
ByteBuffer byteBuffer = buffer.startPutting(getChannel().getChannelIndex());
if (STREAM_TRACER.isEnabled())
{
@@ -256,7 +256,7 @@ public abstract class SignalProtocol extends AbstractProtocol
return buffer;
}
- public void retainBuffer(Buffer buffer)
+ public void retainBuffer(IBuffer buffer)
{
delegate.retainBuffer(buffer);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
index 6a1848c..3210e6e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.stream;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferHandler;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IBufferHandler;
import org.eclipse.net4j.util.HexUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
*/
-public class BufferInputStream extends InputStream implements BufferHandler
+public class BufferInputStream extends InputStream implements IBufferHandler
{
public static final long NO_TIMEOUT = -1;
@@ -36,9 +36,9 @@ public class BufferInputStream extends InputStream implements BufferHandler
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM, BufferInputStream.class);
- private BlockingQueue<Buffer> buffers = new LinkedBlockingQueue();
+ private BlockingQueue<IBuffer> buffers = new LinkedBlockingQueue();
- private Buffer currentBuffer;
+ private IBuffer currentBuffer;
private boolean eos;
@@ -46,7 +46,7 @@ public class BufferInputStream extends InputStream implements BufferHandler
{
}
- public void handleBuffer(Buffer buffer)
+ public void handleBuffer(IBuffer buffer)
{
buffers.add(buffer);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java
index 445c393..4c97c36 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java
@@ -10,9 +10,9 @@
**************************************************************************/
package org.eclipse.net4j.stream;
-import org.eclipse.net4j.transport.Buffer;
-import org.eclipse.net4j.transport.BufferHandler;
-import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.IBuffer;
+import org.eclipse.net4j.transport.IBufferHandler;
+import org.eclipse.net4j.transport.IBufferProvider;
import org.eclipse.net4j.util.HexUtil;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -32,15 +32,15 @@ public class BufferOutputStream extends OutputStream
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM, BufferOutputStream.class);
- private BufferHandler bufferHandler;
+ private IBufferHandler bufferHandler;
- private BufferProvider bufferProvider;
+ private IBufferProvider bufferProvider;
- private Buffer currentBuffer;
+ private IBuffer currentBuffer;
private short channelIndex;
- public BufferOutputStream(BufferHandler bufferHandler, BufferProvider bufferProvider, short channelIndex)
+ public BufferOutputStream(IBufferHandler bufferHandler, IBufferProvider bufferProvider, short channelIndex)
{
if (bufferHandler == null)
{
@@ -57,7 +57,7 @@ public class BufferOutputStream extends OutputStream
this.channelIndex = channelIndex;
}
- public BufferOutputStream(BufferHandler bufferHandler, short channelIndex)
+ public BufferOutputStream(IBufferHandler bufferHandler, short channelIndex)
{
this(bufferHandler, extractBufferProvider(bufferHandler), channelIndex);
}
@@ -137,11 +137,11 @@ public class BufferOutputStream extends OutputStream
return DEFAULT_PROPAGATE_CLOSE;
}
- private static BufferProvider extractBufferProvider(BufferHandler bufferHandler)
+ private static IBufferProvider extractBufferProvider(IBufferHandler bufferHandler)
{
- if (bufferHandler instanceof BufferProvider)
+ if (bufferHandler instanceof IBufferProvider)
{
- return (BufferProvider)bufferHandler;
+ return (IBufferProvider)bufferHandler;
}
throw new IllegalArgumentException("Buffer handler unable to provide buffers"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelInputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelInputStream.java
index 7f65832..7baaeaa 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelInputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelInputStream.java
@@ -10,25 +10,25 @@
**************************************************************************/
package org.eclipse.net4j.stream;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IChannel;
/**
* @author Eike Stepper
*/
public class ChannelInputStream extends BufferInputStream
{
- private Channel channel;
+ private IChannel channel;
private long millisBeforeTimeout = DEFAULT_MILLIS_BEFORE_TIMEOUT;
private long millisInterruptCheck = DEFAULT_MILLIS_INTERRUPT_CHECK;
- public ChannelInputStream(Channel channel)
+ public ChannelInputStream(IChannel channel)
{
this(channel, DEFAULT_MILLIS_BEFORE_TIMEOUT);
}
- public ChannelInputStream(Channel channel, long millisBeforeTimeout)
+ public ChannelInputStream(IChannel channel, long millisBeforeTimeout)
{
this.channel = channel;
channel.setReceiveHandler(this);
@@ -36,7 +36,7 @@ public class ChannelInputStream extends BufferInputStream
millisInterruptCheck = DEFAULT_MILLIS_INTERRUPT_CHECK;
}
- public Channel getChannel()
+ public IChannel getChannel()
{
return channel;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelOutputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelOutputStream.java
index 986b027..1083788 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelOutputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/ChannelOutputStream.java
@@ -10,20 +10,20 @@
**************************************************************************/
package org.eclipse.net4j.stream;
-import org.eclipse.net4j.transport.BufferProvider;
-import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.IBufferProvider;
+import org.eclipse.net4j.transport.IChannel;
/**
* @author Eike Stepper
*/
public class ChannelOutputStream extends BufferOutputStream
{
- public ChannelOutputStream(Channel channel)
+ public ChannelOutputStream(IChannel channel)
{
super(channel, channel.getChannelIndex());
}
- public ChannelOutputStream(Channel channel, BufferProvider bufferProvider)
+ public ChannelOutputStream(IChannel channel, IBufferProvider bufferProvider)
{
super(channel, bufferProvider, channel.getChannelIndex());
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Acceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
index 2b1d881..0b858c3 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Acceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptor.java
@@ -15,9 +15,11 @@ import org.eclipse.net4j.util.event.INotifier;
/**
* @author Eike Stepper
*/
-public interface Acceptor extends INotifier
+public interface IAcceptor extends INotifier
{
+ public static final String PRODUCT_GROUP_ID = "org.eclipse.net4j.acceptor";
+
public String getDescription();
- public Connector[] getAcceptedConnectors();
+ public IConnector[] getAcceptedConnectors();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/AcceptorConnectorsEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorAcceptedEvent.java
index 2e76ac6..5022b3d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/AcceptorConnectorsEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorAcceptedEvent.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.util.event.IEvent;
/**
* @author Eike Stepper
*/
-public interface AcceptorConnectorsEvent extends IEvent
+public interface IAcceptorAcceptedEvent extends IEvent
{
- public Connector getAcceptedConnector();
+ public IConnector getConnector();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/AcceptorFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorFactory.java
index 127d60c..9985c9a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/AcceptorFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IAcceptorFactory.java
@@ -13,9 +13,9 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface AcceptorFactory
+public interface IAcceptorFactory
{
public String getType();
- public Acceptor createAcceptor();
+ public IAcceptor createAcceptor();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Buffer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
index d5793d4..5ab782a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Buffer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
@@ -16,11 +16,11 @@ import java.nio.channels.SocketChannel;
/**
* Basic <b>unit of transport</b> in Net4j. A buffer is well prepared for the
- * usage with asynchronous {@link Channel}s but can also be used with pure
+ * usage with asynchronous {@link IChannel}s but can also be used with pure
* {@link SocketChannel}s. All methods of <code>Buffer</code> are
* non-blocking.
* <p>
- * Usually buffers are obtained from a {@link BufferProvider}. Buffers can be
+ * Usually buffers are obtained from a {@link IBufferProvider}. Buffers can be
* acessed, passed around and finally {@link #release() released} to their
* original provider. The capacity of a buffer is determined by its provider.
* <p>
@@ -72,15 +72,15 @@ import java.nio.channels.SocketChannel;
* buffer.release();
* </pre>
*
- * @see BufferProvider
- * @see Channel#sendBuffer(Buffer)
- * @see Channel#setReceiveHandler(BufferHandler)
- * @see BufferHandler#handleBuffer(Buffer)
+ * @see IBufferProvider
+ * @see IChannel#sendBuffer(Buffer)
+ * @see IChannel#setReceiveHandler(IBufferHandler)
+ * @see IBufferHandler#handleBuffer(Buffer)
* @author Eike Stepper
*/
-public interface Buffer
+public interface IBuffer
{
- public BufferProvider getBufferProvider();
+ public IBufferProvider getBufferProvider();
public short getChannelIndex();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferHandler.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java
index dd29583..3450460 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferHandler.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferHandler.java
@@ -13,14 +13,14 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface BufferHandler
+public interface IBufferHandler
{
/**
- * Handles a {@link Buffer} and optionally releases it. The implementor of
+ * Handles a {@link IBuffer} and optionally releases it. The implementor of
* this method takes over the ownership of the buffer. Care must be taken to
- * properly {@link Buffer#release() release} the buffer if the ownership is
+ * properly {@link IBuffer#release() release} the buffer if the ownership is
* not explicitely passed to some further party.
* <p>
*/
- public void handleBuffer(Buffer buffer);
+ public void handleBuffer(IBuffer buffer);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferPool.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java
index b3cad59..a5765cf 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferPool.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferPool.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface BufferPool extends BufferProvider
+public interface IBufferPool extends IBufferProvider
{
public boolean evictOne();
@@ -22,7 +22,7 @@ public interface BufferPool extends BufferProvider
/**
* @author Eike Stepper
*/
- public interface Introspection extends BufferProvider.Introspection
+ public interface Introspection extends IBufferProvider.Introspection
{
public int getPooledBuffers();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferProvider.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java
index f3cbd02..e3d9b20 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/BufferProvider.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBufferProvider.java
@@ -13,13 +13,13 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface BufferProvider
+public interface IBufferProvider
{
public short getBufferCapacity();
- public Buffer provideBuffer();
+ public IBuffer provideBuffer();
- public void retainBuffer(Buffer buffer);
+ public void retainBuffer(IBuffer buffer);
/**
* @author Eike Stepper
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java
index 36c57a8..aeed370 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannel.java
@@ -12,29 +12,29 @@ package org.eclipse.net4j.transport;
/**
* A bidirectional communications channel for the asynchronous exchange of
- * {@link Buffer}s. A channel is lightweight and virtual in the sense that it
+ * {@link IBuffer}s. A channel is lightweight and virtual in the sense that it
* does not necessarily represent a single physical connection like a TCP socket
* connection. The underlying physical connection is represented by a
- * {@link Connector}.
+ * {@link IConnector}.
* <p>
* This interface is <b>not</b> intended to be implemented by clients.
* <p>
*
* @author Eike Stepper
*/
-public interface Channel extends BufferHandler
+public interface IChannel extends IBufferHandler
{
- public ChannelID getID();
+ public IChannelID getID();
public short getChannelIndex();
- public Connector getConnector();
+ public IConnector getConnector();
- public void sendBuffer(Buffer buffer);
+ public void sendBuffer(IBuffer buffer);
- public BufferHandler getReceiveHandler();
+ public IBufferHandler getReceiveHandler();
- public void setReceiveHandler(BufferHandler receiveHandler);
+ public void setReceiveHandler(IBufferHandler receiveHandler);
public void close();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ChannelID.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java
index f8f5bd1..6be8306 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ChannelID.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IChannelID.java
@@ -13,9 +13,9 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface ChannelID
+public interface IChannelID
{
- public Connector getConnector();
+ public IConnector getConnector();
public short getChannelIndex();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
index ab8cb85..1a9d15d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnector.java
@@ -12,28 +12,29 @@ package org.eclipse.net4j.transport;
import org.eclipse.net4j.util.event.INotifier;
-import org.eclipse.internal.net4j.transport.AbstractConnector;
-import org.eclipse.internal.net4j.transport.ChannelImpl;
+import org.eclipse.internal.net4j.transport.Channel;
+import org.eclipse.internal.net4j.transport.Connector;
/**
* One endpoint of a physical connection of arbitrary nature between two
- * communicating parties. A {@link Connector} encapsulates the process of
+ * communicating parties. A {@link IConnector} encapsulates the process of
* establishing and closing such connections and has a {@link ConnectorLocation}
* of {@link ConnectorLocation#CLIENT} or {@link ConnectorLocation#SERVER} with
* respect to this process. Once a connection is established either party can
- * use its connector to open multiple {@link Channel}s to asynchronously
- * exchange {@link Buffer}s.
+ * use its connector to open multiple {@link IChannel}s to asynchronously
+ * exchange {@link IBuffer}s.
* <p>
* This interface is <b>not</b> intended to be implemented by clients.
* Providers of connectors for new physical connection types have to subclass
- * {@link AbstractConnector} (see
- * {@link ChannelImpl#setConnector(AbstractConnector)}.
+ * {@link Connector} (see {@link Channel#setConnector(Connector)}.
* <p>
*
* @author Eike Stepper
*/
-public interface Connector extends INotifier.Introspection
+public interface IConnector extends INotifier
{
+ public static final String PRODUCT_GROUP_ID = "org.eclipse.net4j.connector";
+
public Integer getID();
public ConnectorLocation getLocation();
@@ -46,7 +47,7 @@ public interface Connector extends INotifier.Introspection
public String getUserID();
- public ConnectorCredentials getCredentials();
+ public IConnectorCredentials getCredentials();
public ConnectorState getState();
@@ -58,7 +59,7 @@ public interface Connector extends INotifier.Introspection
public boolean isConnected();
/**
- * Asynchronous connect. May leave this {@link Connector} in a state where
+ * Asynchronous connect. May leave this {@link IConnector} in a state where
* <code>{@link #isConnected()} == false</code>.
* <p>
*/
@@ -83,29 +84,30 @@ public interface Connector extends INotifier.Introspection
public ConnectorException disconnect();
- public Channel[] getChannels();
+ public IChannel[] getChannels();
/**
- * Synchronous request to open a new {@link Channel} with an undefined channel
- * protocol. Since the peer connector can't lookup a {@link ProtocolFactory}
- * without a protocol identifier the {@link BufferHandler} of the peer
- * {@link Channel} can only be provided by external {@link ChannelListener}s.
+ * Synchronous request to open a new {@link IChannel} with an undefined
+ * channel protocol. Since the peer connector can't lookup a
+ * {@link IProtocolFactory} without a protocol identifier the
+ * {@link IBufferHandler} of the peer {@link IChannel} can only be provided by
+ * external {@link ChannelListener}s.
* <p>
*
* @see #openChannel(String)
*/
- public Channel openChannel() throws ConnectorException;
+ public IChannel openChannel() throws ConnectorException;
/**
- * Synchronous request to open a new {@link Channel} with a channel protocol
+ * Synchronous request to open a new {@link IChannel} with a channel protocol
* defined by a given protocol identifier. The peer connector will lookup a
- * {@link ProtocolFactory} with the protocol identifier, create a
- * {@link BufferHandler} and inject it into the peer {@link Channel}.
+ * {@link IProtocolFactory} with the protocol identifier, create a
+ * {@link IBufferHandler} and inject it into the peer {@link IChannel}.
* <p>
*
* @see #openChannel()
*/
- public Channel openChannel(String protocolID) throws ConnectorException;
+ public IChannel openChannel(String protocolID) throws ConnectorException;
- public Channel openChannel(String protocolID, Object protocolData) 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
new file mode 100644
index 0000000..fcff07f
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorChannelsEvent.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * 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 org.eclipse.net4j.util.container.IContainerEvent;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IConnectorChannelsEvent extends IContainerEvent<IChannel>
+{
+ public IChannel getChannel();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorCredentials.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java
index 7ca31ba..53cb91e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorCredentials.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorCredentials.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface ConnectorCredentials
+public interface IConnectorCredentials
{
public String getUserID();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorFactory.java
index 4655760..705b5e0 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorFactory.java
@@ -13,9 +13,9 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface ConnectorFactory
+public interface IConnectorFactory
{
public String getType();
- public Connector createConnector();
+ public IConnector createConnector();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorNegotiator.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java
index 4ea01ca..8c27f13 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorNegotiator.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorNegotiator.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface ConnectorNegotiator
+public interface IConnectorNegotiator
{
/**
* Executes a negotitation phase between two connectors.
@@ -24,5 +24,5 @@ public interface ConnectorNegotiator
* @return <code>true</code> if the negotiation succeeded,
* <code>false</code> otherwise.
*/
- public boolean negotiate(Connector connector);
+ public boolean negotiate(IConnector connector);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorStateEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java
index 4fb5503..2d2568b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorStateEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IConnectorStateEvent.java
@@ -15,7 +15,7 @@ import org.eclipse.net4j.util.event.IEvent;
/**
* @author Eike Stepper
*/
-public interface ConnectorStateEvent extends IEvent
+public interface IConnectorStateEvent extends IEvent
{
public ConnectorState getOldState();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Protocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
index c2eeb4b..87e1758 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Protocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocol.java
@@ -13,9 +13,11 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface Protocol extends BufferHandler
+public interface IProtocol extends IBufferHandler
{
+ public static final String PRODUCT_GROUP_ID = "org.eclipse.net4j.protocol";
+
public String getProtocolID();
- public Channel getChannel();
+ public IChannel getChannel();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java
index 5eff20c..047d471 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactory.java
@@ -18,7 +18,7 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public interface ProtocolFactory
+public interface IProtocolFactory
{
public static final Set<ConnectorLocation> FOR_CLIENTS = Collections.singleton(ConnectorLocation.CLIENT);
@@ -37,7 +37,7 @@ public interface ProtocolFactory
public boolean isSymmetric();
- public ProtocolFactoryID getID(ConnectorLocation location);
+ public IProtocolFactoryID getID(ConnectorLocation location);
- public Protocol createProtocol(Channel channel, Object protocolData);
+ 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/ProtocolFactoryID.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactoryID.java
index 16f9d71..e5e1256 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactoryID.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IProtocolFactoryID.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.transport;
/**
* @author Eike Stepper
*/
-public interface ProtocolFactoryID
+public interface IProtocolFactoryID
{
public ConnectorLocation getLocation();
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 95c45c7..fdc7ab2 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
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.util;
-import org.eclipse.internal.net4j.util.lifecycle.LifecycleImpl;
+import org.eclipse.internal.net4j.util.lifecycle.Lifecycle;
import java.io.PrintStream;
import java.lang.reflect.Field;
@@ -174,7 +174,7 @@ public final class ReflectUtil
private static void toString(Class<? extends Object> segment, Object object, String prefix, StringBuilder builder)
{
- if (segment == ROOT_CLASS || segment == LifecycleImpl.class)
+ if (segment == ROOT_CLASS || segment == Lifecycle.class)
{
return;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainer.java
new file mode 100644
index 0000000..3a04e68
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainer.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * 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.util.container;
+
+import org.eclipse.net4j.util.event.INotifier;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainer<E> extends INotifier
+{
+ public E[] getElements();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerDelta.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerDelta.java
new file mode 100644
index 0000000..672ac79
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerDelta.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.net4j.util.container;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerDelta<E>
+{
+ public E getElement();
+
+ public Kind getKind();
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Kind
+ {
+ ADDED, REMOVED
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java
new file mode 100644
index 0000000..aa52c11
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * 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.util.container;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerEvent<E> extends IEvent
+{
+ public IContainer<E> getContainer();
+
+ public IContainerDelta<E>[] getDeltas();
+
+ public void accept(IContainerEventVisitor<E> visitor);
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEventVisitor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEventVisitor.java
new file mode 100644
index 0000000..a147215
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEventVisitor.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.net4j.util.container;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IContainerEventVisitor<E>
+{
+ public void added(E element);
+
+ public void removed(E element);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface Filtered<E> extends IContainerEventVisitor<E>
+ {
+ public boolean filter(E element);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/EventUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/EventUtil.java
new file mode 100644
index 0000000..13e5d0e
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/EventUtil.java
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * 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.util.event;
+
+/**
+ * @author Eike Stepper
+ */
+public final class EventUtil
+{
+ private static final IListener[] NO_LISTENERS = new IListener[0];
+
+ private EventUtil()
+ {
+ }
+
+ public static boolean addListener(Object notifier, IListener listener)
+ {
+ if (notifier instanceof INotifier)
+ {
+ ((INotifier)notifier).addListener(listener);
+ return true;
+ }
+
+ return false;
+ }
+
+ public static boolean removeListener(Object notifier, IListener listener)
+ {
+ if (notifier instanceof INotifier)
+ {
+ ((INotifier)notifier).removeListener(listener);
+ return true;
+ }
+
+ return false;
+ }
+
+ public static IListener[] getListeners(Object notifier)
+ {
+ if (notifier instanceof INotifier.Introspection)
+ {
+ return ((INotifier.Introspection)notifier).getListeners();
+ }
+
+ return NO_LISTENERS;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/IEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/IEvent.java
index c627f6b..661e344 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/IEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/event/IEvent.java
@@ -15,5 +15,5 @@ package org.eclipse.net4j.util.event;
*/
public interface IEvent
{
- public INotifier getNotifier();
+ public INotifier getSource();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
index ca22795..a03dfd6 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.util.lifecycle;
/**
* @author Eike Stepper
*/
-public interface Lifecycle
+public interface ILifecycle
{
public void activate() throws Exception;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorChannelsEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java
index 5f52015..0305603 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ConnectorChannelsEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java
@@ -8,24 +8,24 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.transport;
+package org.eclipse.net4j.util.lifecycle;
import org.eclipse.net4j.util.event.IEvent;
/**
* @author Eike Stepper
*/
-public interface ConnectorChannelsEvent extends IEvent
+public interface ILifecycleEvent extends IEvent
{
- public Channel getChannel();
+ public ILifecycle getLifecycle();
- public Type getType();
+ public Kind getKind();
/**
* @author Eike Stepper
*/
- public enum Type
+ public enum Kind
{
- ABOUT_TO_OPEN, OPENED, CLOSING
+ ABOUT_TO_ACTIVATE, ACTIVATED, ABOUT_TO_DEACTIVATE, DEACTIVATED
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java
index ed5bb07..60c592f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.util.lifecycle;
/**
* @author Eike Stepper
*/
-public interface LifecycleNotifier extends Lifecycle.Introspection
+public interface LifecycleNotifier extends ILifecycle.Introspection
{
public void addLifecycleListener(LifecycleListener listener);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
index 140dfb2..c55c821 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
@@ -28,33 +28,11 @@ public final class LifecycleUtil
{
}
- public static boolean addListener(Object notifier, LifecycleListener listener)
- {
- if (notifier instanceof LifecycleNotifier)
- {
- ((LifecycleNotifier)notifier).addLifecycleListener(listener);
- return true;
- }
-
- return false;
- }
-
- public static boolean removeListener(Object notifier, LifecycleListener listener)
- {
- if (notifier instanceof LifecycleNotifier)
- {
- ((LifecycleNotifier)notifier).removeLifecycleListener(listener);
- return true;
- }
-
- return false;
- }
-
public static boolean isActive(Object object)
{
- if (object instanceof Lifecycle.Introspection)
+ if (object instanceof ILifecycle.Introspection)
{
- return ((Lifecycle.Introspection)object).isActive();
+ return ((ILifecycle.Introspection)object).isActive();
}
return true;
@@ -72,11 +50,11 @@ public final class LifecycleUtil
*/
public static void activate(Object object, boolean useAnnotation)
{
- if (object instanceof Lifecycle)
+ if (object instanceof ILifecycle)
{
try
{
- ((Lifecycle)object).activate();
+ ((ILifecycle)object).activate();
}
catch (RuntimeException ex)
{
@@ -124,9 +102,9 @@ public final class LifecycleUtil
*/
public static Exception deactivate(Object object, boolean useAnnotation)
{
- if (object instanceof Lifecycle)
+ if (object instanceof ILifecycle)
{
- return ((Lifecycle)object).deactivate();
+ return ((ILifecycle)object).deactivate();
}
else if (object != null && useAnnotation)
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java
deleted file mode 100644
index 94c63e6..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java
+++ /dev/null
@@ -1,26 +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.util.lifecycle;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Eike Stepper
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.FIELD)
-public @interface Singleton
-{
- boolean stateful() default false;
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java
index 599a21a..f887062 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java
@@ -10,8 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.util.om;
-import org.eclipse.net4j.util.lifecycle.Singleton;
-
import org.eclipse.internal.net4j.bundle.AbstractOMPlatform;
/**
@@ -19,7 +17,7 @@ import org.eclipse.internal.net4j.bundle.AbstractOMPlatform;
*/
public interface OMPlatform
{
- @Singleton
+ // @Singleton
public static final OMPlatform INSTANCE = AbstractOMPlatform.createPlatform();
public OMBundle bundle(String bundleID, Class accessor);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java
index b8cff48..d65c2d9 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.util.om.log;
-import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.om.OMLogHandler;
import org.eclipse.net4j.util.om.OMLogger;
import org.eclipse.net4j.util.om.OMLogger.Level;
@@ -28,7 +27,9 @@ import org.eclipse.internal.net4j.bundle.OSGiBundle;
*/
public class EclipseLoggingBridge implements OMLogHandler
{
- @Singleton
+ /**
+ * @Singleton
+ */
public static final EclipseLoggingBridge INSTANCE = new EclipseLoggingBridge();
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_OM, EclipseLoggingBridge.class);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
index cb71ca1..e539a00 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.util.om.log;
-import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.om.OMLogHandler;
import org.eclipse.net4j.util.om.OMLogger;
import org.eclipse.net4j.util.om.OMLogger.Level;
@@ -28,7 +27,7 @@ import org.osgi.service.log.LogService;
*/
public class OSGiLoggingBridge implements OMLogHandler
{
- @Singleton
+ // @Singleton
public static final OSGiLoggingBridge INSTANCE = new OSGiLoggingBridge();
private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_OM, OSGiLoggingBridge.class);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java
new file mode 100644
index 0000000..22bc4ea
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * 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.util.product;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IFactory<PRODUCT extends IProduct>
+{
+ public String getProductGroupID();
+
+ public String getType();
+
+ public PRODUCT create(String description);
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProduct.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProduct.java
new file mode 100644
index 0000000..c28fac5
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProduct.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * 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.util.product;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IProduct
+{
+ public String getProductGroupID();
+
+ public String getFactoryType();
+
+ public String getDescription();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java
new file mode 100644
index 0000000..f7a3e30
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * 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.util.product;
+
+import org.eclipse.net4j.util.registry.IRegistry;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IProductGroup<PRODUCT extends IProduct>
+{
+ public String getID();
+
+ public IRegistry<String, IFactory<PRODUCT>> getFactoryRegistry();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java
new file mode 100644
index 0000000..f4f8d1e
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * 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.util.product;
+
+import org.eclipse.net4j.util.registry.IRegistry;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ProductUtil
+{
+ private ProductUtil()
+ {
+ }
+
+ public static String getProductGroupID(Object product)
+ {
+ if (product instanceof IProduct)
+ {
+ return ((IProduct)product).getProductGroupID();
+ }
+
+ return null;
+ }
+
+ public static String getFactoryType(Object product)
+ {
+ if (product instanceof IProduct)
+ {
+ return ((IProduct)product).getFactoryType();
+ }
+
+ return null;
+ }
+
+ public static String getDescription(Object product)
+ {
+ if (product instanceof IProduct)
+ {
+ return ((IProduct)product).getDescription();
+ }
+
+ return null;
+ }
+
+ public static IProduct create(IRegistry<String, IProductGroup> productGroupRegistry, String productGroupID,
+ String factoryType, String description)
+ {
+ IProductGroup productGroup = productGroupRegistry.get(productGroupID);
+ if (productGroup == null)
+ {
+ return null;
+ }
+
+ IRegistry<String, IFactory> factoryRegistry = productGroup.getFactoryRegistry();
+ IFactory factory = factoryRegistry.get(factoryType);
+ if (factory == null)
+ {
+ return null;
+ }
+
+ IProduct product = factory.create(description);
+ return product;
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java
index 31538d0..9f7371f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java
@@ -10,17 +10,15 @@
**************************************************************************/
package org.eclipse.net4j.util.registry;
+import org.eclipse.net4j.util.container.IContainer;
+
import java.util.Map;
/**
* @author Eike Stepper
*/
-public interface IRegistry<K, V> extends Map<K, V>
+public interface IRegistry<K, V> extends Map<K, V>, IContainer<Map.Entry<K, V>>
{
- public void addRegistryListener(IRegistryListener<K, V> listener);
-
- public void removeRegistryListener(IRegistryListener<K, V> listener);
-
public boolean isAutoCommit();
public void setAutoCommit(boolean on);
@@ -28,13 +26,4 @@ public interface IRegistry<K, V> extends Map<K, V>
public void commit(boolean notifications);
public void commit();
-
- public void dispose();
-
- /**
- * @author Eike Stepper
- */
- public interface Unmodifiable<K, V> extends IRegistry<K, V>
- {
- }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEvent.java
index 73d6f94..99d4389 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEvent.java
@@ -10,12 +10,16 @@
**************************************************************************/
package org.eclipse.net4j.util.registry;
+import org.eclipse.net4j.util.event.IEvent;
+
/**
* @author Eike Stepper
*/
-public interface IRegistryEvent<ID, E>
+public interface IRegistryEvent<K, V> extends IEvent
{
- public IRegistry<ID, E> getRegistry();
+ public IRegistry<K, V> getRegistry();
+
+ public IRegistryDelta<K, V>[] getDeltas();
- public IRegistryDelta<ID, E>[] getDeltas();
+ public void accept(IRegistryEventVisitor<K, V> visitor);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEventVisitor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEventVisitor.java
new file mode 100644
index 0000000..b85d71c
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryEventVisitor.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.net4j.util.registry;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IRegistryEventVisitor<K, V>
+{
+ public void registered(K id, V element);
+
+ public void deregistered(K id, V element);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface Filtered<K, V> extends IRegistryEventVisitor<K, V>
+ {
+ public boolean filter(K id, V element);
+ }
+}