Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-08-13 10:35:52 +0000
committerEike Stepper2008-08-13 10:35:52 +0000
commitd892a8ea1dd81927c1b51908fc5ab5252825b2e3 (patch)
tree4ae18ba0d75e759840f6e8abd7e4f4712742b81b /plugins
parent4edaf98c74c62bf5c53203572b68da6c7cf4ab25 (diff)
downloadcdo-d892a8ea1dd81927c1b51908fc5ab5252825b2e3.tar.gz
cdo-d892a8ea1dd81927c1b51908fc5ab5252825b2e3.tar.xz
cdo-d892a8ea1dd81927c1b51908fc5ab5252825b2e3.zip
[243987] Decouple Signal from IChannel
https://bugs.eclipse.org/bugs/show_bug.cgi?id=243987
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitNotificationRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java3
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java7
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java4
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java6
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java6
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java6
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/plugin.xml2
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java14
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java27
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddiesServerProtocol.java (renamed from plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java)27
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyAddedNotification.java8
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyRemovedNotification.java8
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java10
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/FacilityInstalledNotification.java8
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InstallFacilityIndication.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java9
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocolFactory.java37
-rw-r--r--plugins/org.eclipse.net4j.buddies/build.properties1
-rw-r--r--plugins/org.eclipse.net4j.buddies/plugin.xml28
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java7
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/IBuddySession.java3
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java18
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java23
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java4
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddiesClientProtocol.java (renamed from plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocol.java)6
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyAddedIndication.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyRemovedIndication.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientBuddyStateIndication.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocolFactory.java37
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InitiateCollaborationRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InstallFacilityRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InviteBuddiesNotification.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/LoadAccountRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/OpenSessionRequest.java7
-rw-r--r--plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClient.java9
-rw-r--r--plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClientProtocol.java22
-rw-r--r--plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoRequest.java9
-rw-r--r--plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java9
-rw-r--r--plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/admin/JMSAdminUtil.java7
-rw-r--r--plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/JMSAdmin.java12
-rw-r--r--plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocol.java4
-rw-r--r--plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocolFactory.java38
-rw-r--r--plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSCreateDestinationRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerConsumer.java8
-rw-r--r--plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/protocol/JMSServerMessageRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/server/IServerConsumer.java4
-rw-r--r--plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSSeparatedTest.java3
-rw-r--r--plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSTest.java3
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/ConnectionImpl.java30
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/SessionImpl.java14
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSAcknowledgeRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientMessageRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocol.java7
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocolFactory.java38
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCloseSessionRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCommitRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSDeregisterConsumerRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogoffRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogonRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSOpenSessionRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRecoverRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRegisterConsumerRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRollbackRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSSyncRequest.java8
-rw-r--r--plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/jms/JMSUtil.java6
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/plugin.xml6
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java2
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java30
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java85
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java7
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla241463_Test.java12
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/ArrayRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/AsyncRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntFailRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/StringRequest.java5
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalClientProtocolFactory.java32
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalProtocol.java26
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java32
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/channel/Channel.java15
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java16
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/channel/IChannelMultiplexer.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java25
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java32
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java3
94 files changed, 481 insertions, 592 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitNotificationRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitNotificationRequest.java
index e4c59a42d0..342af6648d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitNotificationRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitNotificationRequest.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -45,7 +46,7 @@ public class CommitNotificationRequest extends Request
public CommitNotificationRequest(IChannel channel, CDOIDProvider provider, long timeStamp,
List<CDOIDAndVersion> dirtyIDs, List<CDORevisionDelta> deltas)
{
- super(channel);
+ super((SignalProtocol)channel.getReceiveHandler());
this.provider = provider;
this.timeStamp = timeStamp;
this.dirtyIDs = dirtyIDs;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java
index c48ce26244..dad3e7c5a6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.internal.cdo.CDOSessionImpl;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
+import org.eclipse.net4j.signal.SignalProtocol;
/**
* @author Eike Stepper
@@ -24,7 +25,7 @@ public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<R
{
public CDOClientRequest(IChannel channel)
{
- super(channel);
+ super((SignalProtocol)channel.getReceiveHandler());
}
protected CDORevisionResolverImpl getRevisionManager()
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java
index 7ea88df5df..231466697a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.net4j.util.io.IOUtil;
@@ -39,7 +40,7 @@ public class LoadLibrariesRequest extends RequestWithConfirmation<Integer>
public LoadLibrariesRequest(IChannel channel, Collection<String> libraryNames, File cacheFolder)
{
- super(channel);
+ super((SignalProtocol)channel.getReceiveHandler());
this.libraryNames = libraryNames;
this.cacheFolder = cacheFolder;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
index e9ea05abaa..b70b4b7a41 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -44,7 +45,7 @@ public class OpenSessionRequest extends RequestWithConfirmation<OpenSessionResul
public OpenSessionRequest(IChannel channel, String repositoryName, boolean legacySupportEnabled,
boolean passiveUpdateEnabled)
{
- super(channel);
+ super((SignalProtocol)channel.getReceiveHandler());
this.repositoryName = repositoryName;
this.legacySupportEnabled = legacySupportEnabled;
this.passiveUpdateEnabled = passiveUpdateEnabled;
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java
index 05673f3a95..e10c4292e4 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.buddies.common;
-import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.event.INotifier;
import org.eclipse.core.runtime.IAdaptable;
@@ -20,7 +20,10 @@ import org.eclipse.core.runtime.IAdaptable;
*/
public interface ISession extends INotifier, IAdaptable
{
- public IChannel getChannel();
+ /**
+ * @since 2.0
+ */
+ public SignalProtocol getProtocol();
public IBuddy getSelf();
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
index 4f53e4516e..b4b02b62ae 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
@@ -18,6 +18,7 @@ import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.common.IMessage;
import org.eclipse.net4j.buddies.internal.common.bundle.OM;
import org.eclipse.net4j.buddies.internal.common.protocol.MessageNotification;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
@@ -166,7 +167,8 @@ public class Collaboration extends MembershipContainer implements ICollaboration
{
try
{
- new MessageNotification(receiver.getSession().getChannel(), collaborationID, facilityType, message).send();
+ SignalProtocol protocol = receiver.getSession().getProtocol();
+ new MessageNotification(protocol, collaborationID, facilityType, message).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java
index 2d755ae66b..4065f7e244 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java
@@ -11,8 +11,8 @@
package org.eclipse.net4j.buddies.internal.common.protocol;
import org.eclipse.net4j.buddies.common.IBuddy.State;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
@@ -26,9 +26,9 @@ public class BuddyStateNotification extends Request
private State state;
- public BuddyStateNotification(IChannel channel, String userID, State state)
+ public BuddyStateNotification(SignalProtocol protocol, String userID, State state)
{
- super(channel);
+ super(protocol);
this.userID = userID;
this.state = state;
}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java
index 5a70267057..67cf2c2cd2 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.buddies.internal.common.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
@@ -25,9 +25,9 @@ public class CollaborationLeftNotification extends Request
private String userID;
- public CollaborationLeftNotification(IChannel channel, long collaborationID, String userID)
+ public CollaborationLeftNotification(SignalProtocol protocol, long collaborationID, String userID)
{
- super(channel);
+ super(protocol);
this.collaborationID = collaborationID;
this.userID = userID;
}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java
index 7de369b755..2182ae2dae 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java
@@ -11,8 +11,8 @@
package org.eclipse.net4j.buddies.internal.common.protocol;
import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
@@ -28,9 +28,9 @@ public class MessageNotification extends Request
private IMessage message;
- public MessageNotification(IChannel channel, long collaborationID, String facilityType, IMessage message)
+ public MessageNotification(SignalProtocol protocol, long collaborationID, String facilityType, IMessage message)
{
- super(channel);
+ super(protocol);
this.collaborationID = collaborationID;
this.facilityType = facilityType;
this.message = message;
diff --git a/plugins/org.eclipse.net4j.buddies.server/plugin.xml b/plugins/org.eclipse.net4j.buddies.server/plugin.xml
index ee196a9dee..e0a322968e 100644
--- a/plugins/org.eclipse.net4j.buddies.server/plugin.xml
+++ b/plugins/org.eclipse.net4j.buddies.server/plugin.xml
@@ -20,7 +20,7 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
- class="org.eclipse.net4j.buddies.internal.server.protocol.ServerProtocolFactory"
+ class="org.eclipse.net4j.buddies.internal.server.protocol.BuddiesServerProtocol$Factory"
productGroup="org.eclipse.net4j.serverProtocols"
type="buddies"/>
</extension>
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
index 4a24c4bdd3..4fc6fd898d 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
@@ -22,6 +22,7 @@ import org.eclipse.net4j.buddies.internal.common.CollaborationContainer;
import org.eclipse.net4j.buddies.internal.common.Membership;
import org.eclipse.net4j.buddies.internal.common.protocol.BuddyStateNotification;
import org.eclipse.net4j.buddies.internal.server.bundle.OM;
+import org.eclipse.net4j.buddies.internal.server.protocol.BuddiesServerProtocol;
import org.eclipse.net4j.buddies.internal.server.protocol.BuddyRemovedNotification;
import org.eclipse.net4j.buddies.internal.server.protocol.CollaborationInitiatedNotification;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
@@ -131,7 +132,8 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
buddy.activate();
buddy.addListener(this);
- ServerSession session = new ServerSession(channel, buddy);
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)channel.getReceiveHandler();
+ ServerSession session = new ServerSession(protocol, buddy);
((IProtocol)channel.getReceiveHandler()).setInfraStructure(session);
session.addListener(this);
buddy.setSession(session);
@@ -179,8 +181,8 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
try
{
invitations.remove(buddy);
- IChannel channel = buddy.getSession().getChannel();
- new CollaborationInitiatedNotification(channel, collaborationID, invitations, null).send();
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)buddy.getSession().getProtocol();
+ new CollaborationInitiatedNotification(protocol, collaborationID, invitations, null).send();
}
catch (Exception ex)
{
@@ -217,7 +219,8 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
{
try
{
- new BuddyRemovedNotification(session.getChannel(), userID).send();
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)session.getProtocol();
+ new BuddyRemovedNotification(protocol, userID).send();
}
catch (Exception ex)
{
@@ -242,7 +245,8 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
{
if (!ObjectUtil.equals(session.getSelf(), e.getBuddy()))
{
- new BuddyStateNotification(session.getChannel(), e.getBuddy().getUserID(), e.getNewState()).send();
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)session.getProtocol();
+ new BuddyStateNotification(protocol, e.getBuddy().getUserID(), e.getNewState()).send();
}
}
catch (Exception ex)
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
index 88220d7f68..026c818842 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
@@ -12,7 +12,7 @@ package org.eclipse.net4j.buddies.internal.server;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.common.ISession;
-import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.buddies.internal.server.protocol.BuddiesServerProtocol;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
@@ -26,19 +26,25 @@ import org.eclipse.core.runtime.PlatformObject;
*/
public class ServerSession extends Lifecycle implements ISession, IListener
{
- private IChannel channel;
+ private BuddiesServerProtocol protocol;
private IBuddy self;
- public ServerSession(IChannel channel, IBuddy self)
+ /**
+ * @since 2.0
+ */
+ public ServerSession(BuddiesServerProtocol protocol, IBuddy self)
{
- this.channel = channel;
+ this.protocol = protocol;
this.self = self;
}
- public IChannel getChannel()
+ /**
+ * @since 2.0
+ */
+ public BuddiesServerProtocol getProtocol()
{
- return channel;
+ return protocol;
}
public IBuddy getSelf()
@@ -48,7 +54,8 @@ public class ServerSession extends Lifecycle implements ISession, IListener
public void close()
{
- channel.close();
+ protocol.close();
+ protocol = null;
deactivate();
}
@@ -63,7 +70,7 @@ public class ServerSession extends Lifecycle implements ISession, IListener
public void notifyEvent(IEvent event)
{
- if (event.getSource() == channel)
+ if (event.getSource() == protocol)
{
if (event instanceof ILifecycleEvent)
{
@@ -79,7 +86,7 @@ public class ServerSession extends Lifecycle implements ISession, IListener
protected void doActivate() throws Exception
{
super.doActivate();
- channel.addListener(this);
+ protocol.addListener(this);
self.getAccount().touch();
}
@@ -87,7 +94,7 @@ public class ServerSession extends Lifecycle implements ISession, IListener
protected void doDeactivate() throws Exception
{
self.getAccount().touch();
- channel.removeListener(this);
+ protocol.removeListener(this);
super.doDeactivate();
}
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddiesServerProtocol.java
index 3f695769bb..9152f01b03 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddiesServerProtocol.java
@@ -15,13 +15,15 @@ import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
+import org.eclipse.net4j.util.container.IManagedContainer;
/**
* @author Eike Stepper
+ * @since 2.0
*/
-public class ServerProtocol extends SignalProtocol
+public class BuddiesServerProtocol extends SignalProtocol
{
- public ServerProtocol()
+ public BuddiesServerProtocol()
{
}
@@ -59,4 +61,25 @@ public class ServerProtocol extends SignalProtocol
return null;
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Factory extends org.eclipse.net4j.protocol.ServerProtocolFactory
+ {
+ public Factory()
+ {
+ super(ProtocolConstants.PROTOCOL_NAME);
+ }
+
+ public BuddiesServerProtocol create(String description)
+ {
+ return new BuddiesServerProtocol();
+ }
+
+ public static BuddiesServerProtocol get(IManagedContainer container, String description)
+ {
+ return (BuddiesServerProtocol)container.getElement(PRODUCT_GROUP, ProtocolConstants.PROTOCOL_NAME, description);
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyAddedNotification.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyAddedNotification.java
index 63da3d9e3a..bd6de9eafa 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyAddedNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyAddedNotification.java
@@ -11,7 +11,6 @@
package org.eclipse.net4j.buddies.internal.server.protocol;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,12 @@ public class BuddyAddedNotification extends Request
{
private String buddy;
- public BuddyAddedNotification(IChannel channel, String buddy)
+ /**
+ * @since 2.0
+ */
+ public BuddyAddedNotification(BuddiesServerProtocol protocol, String buddy)
{
- super(channel);
+ super(protocol);
this.buddy = buddy;
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyRemovedNotification.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyRemovedNotification.java
index 3577d39d26..5fdf1ed671 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyRemovedNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/BuddyRemovedNotification.java
@@ -11,7 +11,6 @@
package org.eclipse.net4j.buddies.internal.server.protocol;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,12 @@ public class BuddyRemovedNotification extends Request
{
private String buddy;
- public BuddyRemovedNotification(IChannel channel, String buddy)
+ /**
+ * @since 2.0
+ */
+ public BuddyRemovedNotification(BuddiesServerProtocol protocol, String buddy)
{
- super(channel);
+ super(protocol);
this.buddy = buddy;
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java
index 9ba1eb68b2..4c5430bbe5 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java
@@ -13,7 +13,6 @@ package org.eclipse.net4j.buddies.internal.server.protocol;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -31,10 +30,13 @@ public class CollaborationInitiatedNotification extends Request
private String[] facilityTypes;
- public CollaborationInitiatedNotification(IChannel channel, long collaborationID, Collection<IBuddy> buddies,
- String[] facilityTypes)
+ /**
+ * @since 2.0
+ */
+ public CollaborationInitiatedNotification(BuddiesServerProtocol protocol, long collaborationID,
+ Collection<IBuddy> buddies, String[] facilityTypes)
{
- super(channel);
+ super(protocol);
this.collaborationID = collaborationID;
this.buddies = buddies;
this.facilityTypes = facilityTypes;
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/FacilityInstalledNotification.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/FacilityInstalledNotification.java
index 32b8493494..b10576606a 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/FacilityInstalledNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/FacilityInstalledNotification.java
@@ -11,7 +11,6 @@
package org.eclipse.net4j.buddies.internal.server.protocol;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -26,9 +25,12 @@ public class FacilityInstalledNotification extends Request
private String facilityType;
- public FacilityInstalledNotification(IChannel channel, long collaborationID, String facilityType)
+ /**
+ * @since 2.0
+ */
+ public FacilityInstalledNotification(BuddiesServerProtocol protocol, long collaborationID, String facilityType)
{
- super(channel);
+ super(protocol);
this.collaborationID = collaborationID;
this.facilityType = facilityType;
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InstallFacilityIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InstallFacilityIndication.java
index 28afa4f49f..8bbcb9ac7f 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InstallFacilityIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InstallFacilityIndication.java
@@ -18,7 +18,6 @@ import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.server.BuddyAdmin;
import org.eclipse.net4j.buddies.internal.server.bundle.OM;
import org.eclipse.net4j.buddies.spi.common.ServerFacilityFactory;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.IndicationWithResponse;
import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -71,8 +70,8 @@ public class InstallFacilityIndication extends IndicationWithResponse
{
try
{
- IChannel channel = buddy.getSession().getChannel();
- new FacilityInstalledNotification(channel, collaborationID, facilityType).send();
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)buddy.getSession().getProtocol();
+ new FacilityInstalledNotification(protocol, collaborationID, facilityType).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java
index ce1cbf61e4..029c15cc2c 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java
@@ -16,7 +16,6 @@ import org.eclipse.net4j.buddies.internal.common.Membership;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
import org.eclipse.net4j.buddies.internal.server.BuddyAdmin;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Indication;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -65,7 +64,6 @@ public class InviteBuddiesIndication extends Indication
List<IBuddy> buddies = Arrays.asList(collaboration.getBuddies());
for (IBuddy buddy : buddies)
{
- IChannel channel = buddy.getSession().getChannel();
String[] facilityTypes = null;
Set<IBuddy> set = new HashSet<IBuddy>();
if (added.contains(buddy))
@@ -83,7 +81,8 @@ public class InviteBuddiesIndication extends Indication
{
try
{
- new CollaborationInitiatedNotification(channel, collaborationID, set, facilityTypes).send();
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)buddy.getSession().getProtocol();
+ new CollaborationInitiatedNotification(protocol, collaborationID, set, facilityTypes).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java
index 8583d51fdb..cddf28c57e 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java
@@ -17,7 +17,6 @@ import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
import org.eclipse.net4j.buddies.internal.server.bundle.OM;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.IndicationWithResponse;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -78,7 +77,7 @@ public class OpenSessionIndication extends IndicationWithResponse
ProtocolUtil.writeAccount(out, account);
if (account != null)
{
- List<IChannel> channels = new ArrayList<IChannel>();
+ List<BuddiesServerProtocol> protocols = new ArrayList<BuddiesServerProtocol>();
out.writeInt(buddies.length);
for (IBuddy buddy : buddies)
{
@@ -86,15 +85,15 @@ public class OpenSessionIndication extends IndicationWithResponse
ISession buddySession = IBuddyAdmin.INSTANCE.getSession(buddy);
if (buddySession != null)
{
- channels.add(buddySession.getChannel());
+ protocols.add((BuddiesServerProtocol)buddySession.getProtocol());
}
}
- for (IChannel channel : channels)
+ for (BuddiesServerProtocol protocol : protocols)
{
try
{
- new BuddyAddedNotification(channel, account.getUserID()).send();
+ new BuddyAddedNotification(protocol, account.getUserID()).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java
index 2925d78b6b..46cef3764d 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java
@@ -18,7 +18,6 @@ import org.eclipse.net4j.buddies.internal.common.protocol.CollaborationLeftIndic
import org.eclipse.net4j.buddies.internal.common.protocol.CollaborationLeftNotification;
import org.eclipse.net4j.buddies.internal.server.BuddyAdmin;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.util.WrappedException;
/**
@@ -41,8 +40,8 @@ public class ServerCollaborationLeftIndication extends CollaborationLeftIndicati
{
try
{
- IChannel channel = member.getSession().getChannel();
- new CollaborationLeftNotification(channel, collaboration.getID(), buddy.getUserID()).send();
+ BuddiesServerProtocol protocol = (BuddiesServerProtocol)buddy.getSession().getProtocol();
+ new CollaborationLeftNotification(protocol, collaboration.getID(), buddy.getUserID()).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocolFactory.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocolFactory.java
deleted file mode 100644
index 4f79fa28c4..0000000000
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocolFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 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.buddies.internal.server.protocol;
-
-import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-/**
- * @author Eike Stepper
- */
-public class ServerProtocolFactory extends org.eclipse.net4j.protocol.ServerProtocolFactory
-{
- public static final String TYPE = ProtocolConstants.PROTOCOL_NAME;
-
- public ServerProtocolFactory()
- {
- super(TYPE);
- }
-
- public ServerProtocol create(String description)
- {
- return new ServerProtocol();
- }
-
- public static ServerProtocol get(IManagedContainer container, String description)
- {
- return (ServerProtocol)container.getElement(PRODUCT_GROUP, TYPE, description);
- }
-}
diff --git a/plugins/org.eclipse.net4j.buddies/build.properties b/plugins/org.eclipse.net4j.buddies/build.properties
index 9309926198..e4893b81d8 100644
--- a/plugins/org.eclipse.net4j.buddies/build.properties
+++ b/plugins/org.eclipse.net4j.buddies/build.properties
@@ -17,7 +17,6 @@ bin.includes = .,\
copyright.txt,\
epl-v10.html,\
license.html,\
- plugin.xml,\
about.ini,\
about.mappings,\
about.properties,\
diff --git a/plugins/org.eclipse.net4j.buddies/plugin.xml b/plugins/org.eclipse.net4j.buddies/plugin.xml
deleted file mode 100644
index 6b9364d081..0000000000
--- a/plugins/org.eclipse.net4j.buddies/plugin.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.3"?>
-<!--
- <copyright>
-
- Copyright (c) 2004 - 2008 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
-
- </copyright>
--->
-
-<plugin>
-
- <extension
- point="org.eclipse.net4j.util.factories">
- <factory
- class="org.eclipse.net4j.internal.buddies.protocol.ClientProtocolFactory"
- productGroup="org.eclipse.net4j.clientProtocols"
- type="buddies"/>
- </extension>
-
-</plugin>
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java
index ccd971305d..1b74a92e22 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java
@@ -10,10 +10,9 @@
**************************************************************************/
package org.eclipse.net4j.buddies;
-import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.spi.common.ClientFacilityFactory;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.internal.buddies.protocol.BuddiesClientProtocol;
import org.eclipse.net4j.internal.buddies.protocol.OpenSessionRequest;
import org.eclipse.net4j.signal.SignalActor;
import org.eclipse.net4j.util.WrappedException;
@@ -39,8 +38,8 @@ public final class BuddiesUtil
{
try
{
- IChannel channel = connector.openChannel(ProtocolConstants.PROTOCOL_NAME, null);
- OpenSessionRequest request = new OpenSessionRequest(channel, userID, password, getFacilityTypes());
+ BuddiesClientProtocol protocol = new BuddiesClientProtocol(connector);
+ OpenSessionRequest request = new OpenSessionRequest(protocol, userID, password, getFacilityTypes());
return request.send(timeout);
}
catch (Exception ex)
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/IBuddySession.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/IBuddySession.java
index 69e53ff0d3..5e6096bbce 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/IBuddySession.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/IBuddySession.java
@@ -13,15 +13,12 @@ package org.eclipse.net4j.buddies;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.common.IBuddyContainer;
import org.eclipse.net4j.buddies.common.ISession;
-import org.eclipse.net4j.channel.IChannel;
/**
* @author Eike Stepper
*/
public interface IBuddySession extends ISession, IBuddyContainer
{
- public IChannel getChannel();
-
public IBuddy getSelf();
public void close();
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java
index 52524c6959..59bf9a9322 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java
@@ -21,7 +21,7 @@ import org.eclipse.net4j.buddies.internal.common.protocol.MessageNotification;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.spi.common.ClientFacilityFactory;
import org.eclipse.net4j.buddies.spi.common.Message;
-import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.internal.buddies.protocol.BuddiesClientProtocol;
import org.eclipse.net4j.internal.buddies.protocol.InstallFacilityRequest;
import org.eclipse.net4j.internal.buddies.protocol.InviteBuddiesNotification;
import org.eclipse.net4j.util.WrappedException;
@@ -62,8 +62,8 @@ public class BuddyCollaboration extends Collaboration implements IBuddyCollabora
{
try
{
- IChannel channel = session.getChannel();
- boolean success = new InstallFacilityRequest(channel, getID(), type).send(ProtocolConstants.TIMEOUT);
+ BuddiesClientProtocol protocol = (BuddiesClientProtocol)session.getProtocol();
+ boolean success = new InstallFacilityRequest(protocol, getID(), type).send(ProtocolConstants.TIMEOUT);
if (!success)
{
return null;
@@ -96,8 +96,8 @@ public class BuddyCollaboration extends Collaboration implements IBuddyCollabora
try
{
- IChannel channel = session.getChannel();
- new MessageNotification(channel, collaborationID, facilityType, message).send();
+ BuddiesClientProtocol protocol = (BuddiesClientProtocol)session.getProtocol();
+ new MessageNotification(protocol, collaborationID, facilityType, message).send();
}
catch (Exception ex)
{
@@ -134,8 +134,8 @@ public class BuddyCollaboration extends Collaboration implements IBuddyCollabora
{
try
{
- IChannel channel = session.getChannel();
- new InviteBuddiesNotification(channel, getID(), invitations).send();
+ BuddiesClientProtocol protocol = (BuddiesClientProtocol)session.getProtocol();
+ new InviteBuddiesNotification(protocol, getID(), invitations).send();
}
catch (Exception ex)
{
@@ -148,8 +148,8 @@ public class BuddyCollaboration extends Collaboration implements IBuddyCollabora
{
try
{
- IChannel channel = session.getChannel();
- new CollaborationLeftNotification(channel, getID(), session.getSelf().getUserID()).send();
+ BuddiesClientProtocol protocol = (BuddiesClientProtocol)session.getProtocol();
+ new CollaborationLeftNotification(protocol, getID(), session.getSelf().getUserID()).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
index 02ee9890ac..0ca3a32001 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
@@ -18,8 +18,8 @@ import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.internal.common.BuddyContainer;
import org.eclipse.net4j.buddies.internal.common.Collaboration;
import org.eclipse.net4j.buddies.internal.common.protocol.BuddyStateNotification;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.buddies.bundle.OM;
+import org.eclipse.net4j.internal.buddies.protocol.BuddiesClientProtocol;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
@@ -35,18 +35,18 @@ import java.util.Set;
*/
public class ClientSession extends BuddyContainer implements IBuddySession, IListener
{
- private IChannel channel;
+ private BuddiesClientProtocol protocol;
private Self self;
- public ClientSession(IChannel channel)
+ public ClientSession(BuddiesClientProtocol protocol)
{
- this.channel = channel;
+ this.protocol = protocol;
}
- public IChannel getChannel()
+ public BuddiesClientProtocol getProtocol()
{
- return channel;
+ return protocol;
}
public Self getSelf()
@@ -63,7 +63,8 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
public void close()
{
- channel.close();
+ protocol.close();
+ protocol = null;
deactivate();
}
@@ -79,7 +80,7 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
@Override
public void notifyEvent(IEvent event)
{
- if (event.getSource() == channel)
+ if (event.getSource() == protocol)
{
if (event instanceof ILifecycleEvent)
{
@@ -95,7 +96,7 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
{
try
{
- new BuddyStateNotification(channel, self.getUserID(), ((IBuddyStateEvent)event).getNewState()).send();
+ new BuddyStateNotification(protocol, self.getUserID(), ((IBuddyStateEvent)event).getNewState()).send();
}
catch (Exception ex)
{
@@ -131,13 +132,13 @@ public class ClientSession extends BuddyContainer implements IBuddySession, ILis
protected void doActivate() throws Exception
{
super.doActivate();
- channel.addListener(this);
+ protocol.addListener(this);
}
@Override
protected void doDeactivate() throws Exception
{
- channel.removeListener(this);
+ protocol.removeListener(this);
LifecycleUtil.deactivate(self);
super.doDeactivate();
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
index eba0c18e1c..a31376042d 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/Self.java
@@ -16,7 +16,6 @@ import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.internal.common.Buddy;
import org.eclipse.net4j.buddies.internal.common.Membership;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.buddies.protocol.InitiateCollaborationRequest;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -60,8 +59,7 @@ public class Self extends Buddy
try
{
ClientSession session = getSession();
- IChannel channel = session.getChannel();
- long id = new InitiateCollaborationRequest(channel, buddies).send(ProtocolConstants.TIMEOUT);
+ long id = new InitiateCollaborationRequest(session.getProtocol(), buddies).send(ProtocolConstants.TIMEOUT);
BuddyCollaboration collaboration = new BuddyCollaboration(session, id);
collaboration.activate();
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocol.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddiesClientProtocol.java
index d69820092f..23c0b2882a 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocol.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddiesClientProtocol.java
@@ -13,6 +13,7 @@ package org.eclipse.net4j.internal.buddies.protocol;
import org.eclipse.net4j.buddies.common.ISession;
import org.eclipse.net4j.buddies.internal.common.protocol.MessageIndication;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.internal.buddies.ClientSession;
import org.eclipse.net4j.internal.buddies.Self;
import org.eclipse.net4j.signal.SignalProtocol;
@@ -22,14 +23,15 @@ import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
/**
* @author Eike Stepper
*/
-public class ClientProtocol extends SignalProtocol
+public class BuddiesClientProtocol extends SignalProtocol
{
private static final long GET_SESSION_TIMEOUT = 20000;
private static final int GET_SESSION_INTERVAL = 100;
- public ClientProtocol()
+ public BuddiesClientProtocol(IConnector connector)
{
+ super(connector);
}
public String getType()
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyAddedIndication.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyAddedIndication.java
index a607e5d049..0c8b1fc5c7 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyAddedIndication.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyAddedIndication.java
@@ -36,7 +36,7 @@ public class BuddyAddedIndication extends Indication
protected void indicating(ExtendedDataInputStream in) throws IOException
{
String buddy = in.readString();
- ClientSession session = ((ClientProtocol)getProtocol()).getSession();
+ ClientSession session = ((BuddiesClientProtocol)getProtocol()).getSession();
session.buddyAdded(buddy);
}
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyRemovedIndication.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyRemovedIndication.java
index a4c509f27f..318c14ec57 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyRemovedIndication.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/BuddyRemovedIndication.java
@@ -36,7 +36,7 @@ public class BuddyRemovedIndication extends Indication
protected void indicating(ExtendedDataInputStream in) throws IOException
{
String buddy = in.readString();
- ClientSession session = ((ClientProtocol)getProtocol()).getSession();
+ ClientSession session = ((BuddiesClientProtocol)getProtocol()).getSession();
session.buddyRemoved(buddy);
}
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientBuddyStateIndication.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientBuddyStateIndication.java
index 50cb4e17b8..bcb947d29c 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientBuddyStateIndication.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientBuddyStateIndication.java
@@ -27,7 +27,7 @@ public class ClientBuddyStateIndication extends BuddyStateIndication
@Override
protected void stateChanged(final String userID, final State state)
{
- ClientSession session = ((ClientProtocol)getProtocol()).getSession();
+ ClientSession session = ((BuddiesClientProtocol)getProtocol()).getSession();
ClientBuddy buddy = (ClientBuddy)session.getBuddy(userID);
if (buddy != null)
{
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocolFactory.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocolFactory.java
deleted file mode 100644
index 41e65aad62..0000000000
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/ClientProtocolFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.buddies.protocol;
-
-import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-/**
- * @author Eike Stepper
- */
-public final class ClientProtocolFactory extends org.eclipse.net4j.protocol.ClientProtocolFactory
-{
- public static final String TYPE = ProtocolConstants.PROTOCOL_NAME;
-
- public ClientProtocolFactory()
- {
- super(TYPE);
- }
-
- public ClientProtocol create(String description)
- {
- return new ClientProtocol();
- }
-
- public static ClientProtocol get(IManagedContainer container, String description)
- {
- return (ClientProtocol)container.getElement(PRODUCT_GROUP, TYPE, description);
- }
-}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InitiateCollaborationRequest.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InitiateCollaborationRequest.java
index c8f6e911c0..73baf6e277 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InitiateCollaborationRequest.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InitiateCollaborationRequest.java
@@ -13,7 +13,6 @@ package org.eclipse.net4j.internal.buddies.protocol;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -28,9 +27,9 @@ public class InitiateCollaborationRequest extends RequestWithConfirmation<Long>
{
private Collection<IBuddy> buddies;
- public InitiateCollaborationRequest(IChannel channel, Collection<IBuddy> buddies)
+ public InitiateCollaborationRequest(BuddiesClientProtocol protocol, Collection<IBuddy> buddies)
{
- super(channel);
+ super(protocol);
this.buddies = buddies;
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InstallFacilityRequest.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InstallFacilityRequest.java
index c2773b1d6d..b83b59cdb9 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InstallFacilityRequest.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InstallFacilityRequest.java
@@ -11,7 +11,6 @@
package org.eclipse.net4j.internal.buddies.protocol;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -27,9 +26,9 @@ public class InstallFacilityRequest extends RequestWithConfirmation<Boolean>
private String facilityType;
- public InstallFacilityRequest(IChannel channel, long collaborationID, String facilityType)
+ public InstallFacilityRequest(BuddiesClientProtocol protocol, long collaborationID, String facilityType)
{
- super(channel);
+ super(protocol);
this.collaborationID = collaborationID;
this.facilityType = facilityType;
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InviteBuddiesNotification.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InviteBuddiesNotification.java
index c469fba9a5..9e8ec9b692 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InviteBuddiesNotification.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/InviteBuddiesNotification.java
@@ -13,7 +13,6 @@ package org.eclipse.net4j.internal.buddies.protocol;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -29,9 +28,9 @@ public class InviteBuddiesNotification extends Request
private Collection<IBuddy> buddies;
- public InviteBuddiesNotification(IChannel channel, long collaborationID, Collection<IBuddy> buddies)
+ public InviteBuddiesNotification(BuddiesClientProtocol protocol, long collaborationID, Collection<IBuddy> buddies)
{
- super(channel);
+ super(protocol);
this.buddies = buddies;
this.collaborationID = collaborationID;
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/LoadAccountRequest.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/LoadAccountRequest.java
index db1b690d6a..0520177d7a 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/LoadAccountRequest.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/LoadAccountRequest.java
@@ -13,7 +13,6 @@ package org.eclipse.net4j.internal.buddies.protocol;
import org.eclipse.net4j.buddies.common.IAccount;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -27,9 +26,9 @@ public class LoadAccountRequest extends RequestWithConfirmation<IAccount>
{
private String userID;
- public LoadAccountRequest(IChannel channel, String userID)
+ public LoadAccountRequest(BuddiesClientProtocol protocol, String userID)
{
- super(channel);
+ super(protocol);
this.userID = userID;
}
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/OpenSessionRequest.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/OpenSessionRequest.java
index a13e369485..b9a8126a4a 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/OpenSessionRequest.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/OpenSessionRequest.java
@@ -14,7 +14,6 @@ import org.eclipse.net4j.buddies.IBuddySession;
import org.eclipse.net4j.buddies.common.IAccount;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.internal.common.protocol.ProtocolUtil;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.buddies.ClientSession;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -34,9 +33,9 @@ public class OpenSessionRequest extends RequestWithConfirmation<IBuddySession>
private Set<String> facilityTypes;
- public OpenSessionRequest(IChannel channel, String userID, String password, Set<String> facilityTypes)
+ public OpenSessionRequest(BuddiesClientProtocol protocol, String userID, String password, Set<String> facilityTypes)
{
- super(channel);
+ super(protocol);
this.userID = userID;
this.password = password;
this.facilityTypes = facilityTypes;
@@ -69,7 +68,7 @@ public class OpenSessionRequest extends RequestWithConfirmation<IBuddySession>
return null;
}
- ClientSession session = new ClientSession(getProtocol().getChannel());
+ ClientSession session = new ClientSession((BuddiesClientProtocol)getProtocol());
getProtocol().setInfraStructure(session);
session.setSelf(account, facilityTypes);
diff --git a/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClient.java b/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClient.java
index 9ad2f613d5..da4648151e 100644
--- a/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClient.java
+++ b/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClient.java
@@ -11,9 +11,7 @@
package org.eclipse.net4j.examples.echo.client;
import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.examples.echo.EchoProtocol;
import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -42,17 +40,16 @@ public class EchoClient
{
Net4jUtil.prepareContainer(container);
TCPUtil.prepareContainer(container);
- container.registerFactory(new EchoClientProtocol.Factory());
LifecycleUtil.activate(container);
// Start a connector that represents the client side of a physical connection
IConnector connector = (IConnector)container.getElement("org.eclipse.net4j.connectors", "tcp", "localhost:2036");
// Open a virtual channel with the ECHO protocol, send an ECHO request and close the channel
- IChannel channel = connector.openChannel(EchoProtocol.PROTOCOL_NAME, null);
- EchoRequest request = new EchoRequest(channel, "My cool message");
+ EchoClientProtocol protocol = new EchoClientProtocol(connector);
+ EchoRequest request = new EchoRequest(protocol, "My cool message");
String echo = request.send();
- channel.close();
+ protocol.close();
System.out.println();
System.out.println("ECHO: " + echo);
diff --git a/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClientProtocol.java b/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClientProtocol.java
index 3316f8eee0..96f50d4961 100644
--- a/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClientProtocol.java
+++ b/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoClientProtocol.java
@@ -10,11 +10,10 @@
**************************************************************************/
package org.eclipse.net4j.examples.echo.client;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.examples.echo.EchoProtocol;
-import org.eclipse.net4j.protocol.ClientProtocolFactory;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
-import org.eclipse.net4j.util.factory.ProductCreationException;
/**
* @author Eike Stepper
@@ -22,8 +21,9 @@ import org.eclipse.net4j.util.factory.ProductCreationException;
*/
public class EchoClientProtocol extends SignalProtocol implements EchoProtocol
{
- public EchoClientProtocol()
+ public EchoClientProtocol(IConnector connector)
{
+ super(connector);
}
public String getType()
@@ -37,20 +37,4 @@ public class EchoClientProtocol extends SignalProtocol implements EchoProtocol
// On client side only needed for server initiated requests
return null;
}
-
- /**
- * @author Eike Stepper
- */
- public static final class Factory extends ClientProtocolFactory
- {
- public Factory()
- {
- super(PROTOCOL_NAME);
- }
-
- public Object create(String description) throws ProductCreationException
- {
- return new EchoClientProtocol();
- }
- }
}
diff --git a/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoRequest.java b/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoRequest.java
index ef1fe2a6d9..e5862d7a27 100644
--- a/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoRequest.java
+++ b/plugins/org.eclipse.net4j.examples/src/org/eclipse/net4j/examples/echo/client/EchoRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.examples.echo.client;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.examples.echo.EchoProtocol;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -22,20 +21,20 @@ import java.io.IOException;
* @author Eike Stepper
* @since 2.0
*/
-public class EchoRequest extends RequestWithConfirmation<String> implements EchoProtocol
+public class EchoRequest extends RequestWithConfirmation<String>
{
private String message;
- public EchoRequest(IChannel channel, String message)
+ public EchoRequest(EchoClientProtocol protocol, String message)
{
- super(channel);
+ super(protocol);
this.message = message;
}
@Override
protected short getSignalID()
{
- return ECHO_SIGNAL;
+ return EchoProtocol.ECHO_SIGNAL;
}
@Override
diff --git a/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java b/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java
index 11668a6f13..f1f98aace3 100644
--- a/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java
+++ b/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java
@@ -10,12 +10,10 @@
**************************************************************************/
package org.eclipse.net4j.http.tests;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.http.HTTPUtil;
import org.eclipse.net4j.internal.http.HTTPClientConnector;
import org.eclipse.net4j.tests.AbstractTransportTest;
import org.eclipse.net4j.tests.signal.IntRequest;
-import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
import org.eclipse.net4j.tests.signal.TestSignalProtocol;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -42,7 +40,6 @@ public class HTTPTest extends AbstractTransportTest
{
IManagedContainer container = super.createContainer();
HTTPUtil.prepareContainer(container);
- container.registerFactory(new TestSignalClientProtocolFactory());
return container;
}
@@ -115,14 +112,14 @@ public class HTTPTest extends AbstractTransportTest
public void test1() throws Exception
{
HTTPClientConnector connector = getHTTPConnector();
- IChannel channel = connector.openChannel(TestSignalProtocol.PROTOCOL_NAME, null);
+ TestSignalProtocol protocol = new TestSignalProtocol(connector);
- IntRequest request = new IntRequest(channel, 305419896);
+ IntRequest request = new IntRequest(protocol, 305419896);
int result = request.send();
assertEquals(305419896, result);
sleep(500);
- channel.close();
+ protocol.close();
sleep(500);
connector.deactivate();
}
diff --git a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/admin/JMSAdminUtil.java b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/admin/JMSAdminUtil.java
index abf70a787f..5ea95650aa 100644
--- a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/admin/JMSAdminUtil.java
+++ b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/admin/JMSAdminUtil.java
@@ -12,8 +12,6 @@ package org.eclipse.net4j.jms.admin;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.jms.internal.admin.JMSAdmin;
-import org.eclipse.net4j.jms.internal.admin.protocol.JMSAdminProtocolFactory;
-import org.eclipse.net4j.util.container.IManagedContainer;
/**
* @author Eike Stepper
@@ -24,11 +22,6 @@ public final class JMSAdminUtil
{
}
- public static void prepareContainer(IManagedContainer container)
- {
- container.registerFactory(new JMSAdminProtocolFactory());
- }
-
public static IJMSAdmin createAdmin(IConnector connector)
{
return new JMSAdmin(connector);
diff --git a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/JMSAdmin.java b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/JMSAdmin.java
index 4b7dbe4522..2de0390bf8 100644
--- a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/JMSAdmin.java
+++ b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/JMSAdmin.java
@@ -10,11 +10,11 @@
**************************************************************************/
package org.eclipse.net4j.jms.internal.admin;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.jms.JMSAdminProtocolConstants;
import org.eclipse.net4j.jms.admin.IJMSAdmin;
import org.eclipse.net4j.jms.internal.admin.bundle.OM;
+import org.eclipse.net4j.jms.internal.admin.protocol.JMSAdminProtocol;
import org.eclipse.net4j.jms.internal.admin.protocol.JMSCreateDestinationRequest;
/**
@@ -22,17 +22,17 @@ import org.eclipse.net4j.jms.internal.admin.protocol.JMSCreateDestinationRequest
*/
public class JMSAdmin implements IJMSAdmin
{
- private IChannel channel;
+ private JMSAdminProtocol protocol;
public JMSAdmin(IConnector connector)
{
- channel = connector.openChannel(JMSAdminProtocolConstants.PROTOCOL_NAME, this);
+ protocol = new JMSAdminProtocol(connector);
}
public void close()
{
- channel.close();
- channel = null;
+ protocol.close();
+ protocol = null;
}
public boolean createQueue(String name)
@@ -49,7 +49,7 @@ public class JMSAdmin implements IJMSAdmin
{
try
{
- return new JMSCreateDestinationRequest(channel, type, name).send();
+ return new JMSCreateDestinationRequest(protocol, type, name).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocol.java b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocol.java
index 18faecf259..c28dc3215c 100644
--- a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocol.java
+++ b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocol.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.jms.internal.admin.protocol;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.jms.JMSAdminProtocolConstants;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
@@ -19,8 +20,9 @@ import org.eclipse.net4j.signal.SignalReactor;
*/
public class JMSAdminProtocol extends SignalProtocol
{
- public JMSAdminProtocol()
+ public JMSAdminProtocol(IConnector connector)
{
+ super(connector);
}
public String getType()
diff --git a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocolFactory.java b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocolFactory.java
deleted file mode 100644
index 59939eeacc..0000000000
--- a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSAdminProtocolFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 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.jms.internal.admin.protocol;
-
-import org.eclipse.net4j.jms.JMSAdminProtocolConstants;
-import org.eclipse.net4j.protocol.ClientProtocolFactory;
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-/**
- * @author Eike Stepper
- */
-public final class JMSAdminProtocolFactory extends ClientProtocolFactory
-{
- public static final String TYPE = JMSAdminProtocolConstants.PROTOCOL_NAME;
-
- public JMSAdminProtocolFactory()
- {
- super(TYPE);
- }
-
- public JMSAdminProtocol create(String description)
- {
- return new JMSAdminProtocol();
- }
-
- public static JMSAdminProtocol get(IManagedContainer container, String description)
- {
- return (JMSAdminProtocol)container.getElement(PRODUCT_GROUP, TYPE, description);
- }
-}
diff --git a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSCreateDestinationRequest.java b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSCreateDestinationRequest.java
index 513cbe58ee..cd256a5796 100644
--- a/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSCreateDestinationRequest.java
+++ b/plugins/org.eclipse.net4j.jms.admin/src/org/eclipse/net4j/jms/internal/admin/protocol/JMSCreateDestinationRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.jms.internal.admin.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSAdminProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -27,9 +26,9 @@ public class JMSCreateDestinationRequest extends RequestWithConfirmation<Boolean
private String name;
- public JMSCreateDestinationRequest(IChannel channel, byte type, String name)
+ public JMSCreateDestinationRequest(JMSAdminProtocol protocol, byte type, String name)
{
- super(channel);
+ super(protocol);
this.type = type;
this.name = name;
}
diff --git a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerConsumer.java b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerConsumer.java
index aa4b795705..49f1c4396e 100644
--- a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerConsumer.java
+++ b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/ServerConsumer.java
@@ -10,10 +10,10 @@
**************************************************************************/
package org.eclipse.net4j.jms.internal.server;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.jms.MessageImpl;
import org.eclipse.net4j.jms.internal.server.bundle.OM;
import org.eclipse.net4j.jms.internal.server.protocol.JMSServerMessageRequest;
+import org.eclipse.net4j.jms.internal.server.protocol.JMSServerProtocol;
import org.eclipse.net4j.jms.server.IServerConsumer;
import org.eclipse.net4j.jms.server.IStoreTransaction;
import org.eclipse.net4j.util.io.IOUtil;
@@ -79,9 +79,9 @@ public class ServerConsumer implements IServerConsumer
return noLocal;
}
- public IChannel getChannel()
+ public JMSServerProtocol getProtocol()
{
- return session.getConnection().getProtocol().getChannel();
+ return session.getConnection().getProtocol();
}
public boolean isDurable()
@@ -99,7 +99,7 @@ public class ServerConsumer implements IServerConsumer
messages.put(messageID, message);
}
- new JMSServerMessageRequest(getChannel(), session.getID(), id, message).send();
+ new JMSServerMessageRequest(getProtocol(), session.getID(), id, message).send();
transaction.messageSent(message, id);
return true;
}
diff --git a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/protocol/JMSServerMessageRequest.java b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/protocol/JMSServerMessageRequest.java
index 6df0efbb37..4cc8a2b1ca 100644
--- a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/protocol/JMSServerMessageRequest.java
+++ b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/internal/server/protocol/JMSServerMessageRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.jms.internal.server.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.jms.MessageImpl;
import org.eclipse.net4j.internal.jms.util.MessageUtil;
import org.eclipse.net4j.jms.JMSProtocolConstants;
@@ -30,9 +29,9 @@ public class JMSServerMessageRequest extends Request
private MessageImpl message;
- public JMSServerMessageRequest(IChannel channel, int sessionID, long consumerID, MessageImpl message)
+ public JMSServerMessageRequest(JMSServerProtocol protocol, int sessionID, long consumerID, MessageImpl message)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
this.consumerID = consumerID;
this.message = message;
diff --git a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/server/IServerConsumer.java b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/server/IServerConsumer.java
index a2c0aeb079..ea249d0cc8 100644
--- a/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/server/IServerConsumer.java
+++ b/plugins/org.eclipse.net4j.jms.server/src/org/eclipse/net4j/jms/server/IServerConsumer.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.jms.server;
-import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.protocol.IProtocol;
/**
* @author Eike Stepper
@@ -26,7 +26,7 @@ public interface IServerConsumer
public ISession getSession();
- public IChannel getChannel();
+ public IProtocol getProtocol();
public boolean isNoLocal();
diff --git a/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSSeparatedTest.java b/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSSeparatedTest.java
index f21090c660..246ef6f688 100644
--- a/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSSeparatedTest.java
+++ b/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSSeparatedTest.java
@@ -15,7 +15,6 @@ import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.internal.derby.EmbeddedDerbyAdapter;
import org.eclipse.net4j.jms.JMSInitialContext;
-import org.eclipse.net4j.jms.JMSUtil;
import org.eclipse.net4j.jms.admin.IJMSAdmin;
import org.eclipse.net4j.jms.admin.JMSAdminUtil;
import org.eclipse.net4j.jms.internal.server.Server;
@@ -109,8 +108,6 @@ public class JMSSeparatedTest
IManagedContainer clientContainer = new ManagedContainer();
Net4jUtil.prepareContainer(clientContainer);
TCPUtil.prepareContainer(clientContainer);
- JMSUtil.prepareContainer(clientContainer);
- JMSAdminUtil.prepareContainer(clientContainer);
IConnector connector = TCPUtil.getConnector(clientContainer, "localhost");
diff --git a/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSTest.java b/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSTest.java
index af430e7b52..a1cca9056e 100644
--- a/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSTest.java
+++ b/plugins/org.eclipse.net4j.jms.tests/src/org/eclipse/net4j/jms/tests/JMSTest.java
@@ -15,7 +15,6 @@ import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.internal.derby.EmbeddedDerbyAdapter;
import org.eclipse.net4j.jms.JMSInitialContext;
-import org.eclipse.net4j.jms.JMSUtil;
import org.eclipse.net4j.jms.admin.IJMSAdmin;
import org.eclipse.net4j.jms.admin.JMSAdminUtil;
import org.eclipse.net4j.jms.internal.server.Server;
@@ -92,9 +91,7 @@ public class JMSTest
IManagedContainer container = new ManagedContainer();
Net4jUtil.prepareContainer(container);
TCPUtil.prepareContainer(container);
- JMSUtil.prepareContainer(container);
JMSServerUtil.prepareContainer(container);
- JMSAdminUtil.prepareContainer(container);
TCPUtil.getAcceptor(container, null);
IConnector connector = TCPUtil.getConnector(container, "localhost");
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/ConnectionImpl.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/ConnectionImpl.java
index ee7d1379af..9555ff8d6f 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/ConnectionImpl.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/ConnectionImpl.java
@@ -63,7 +63,7 @@ public class ConnectionImpl extends Container<Session> implements Connection
private IManagedContainer transportContainer;
- private IChannel channel;
+ private JMSClientProtocol protocol;
private List<SessionImpl> sessions = new ArrayList<SessionImpl>(0);
@@ -110,14 +110,13 @@ public class ConnectionImpl extends Container<Session> implements Connection
this.password = password;
IConnector connector = Net4jUtil.getConnector(transportContainer, connectorType, connectorDescription);
- JMSClientProtocol protocol = new JMSClientProtocol();
- protocol.setInfraStructure(this);
- channel = connector.openChannel(protocol);
+ JMSClientProtocol protocol = new JMSClientProtocol(this);
+ IChannel channel = connector.openChannel(protocol);
channel.addListener(channelListener);
try
{
- if (!new JMSLogonRequest(channel, userName, password).send())
+ if (!new JMSLogonRequest(protocol, userName, password).send())
{
throw new JMSException("Server rejected logon request");
}
@@ -154,7 +153,7 @@ public class ConnectionImpl extends Container<Session> implements Connection
try
{
- if (!new JMSOpenSessionRequest(channel, sessionID).send())
+ if (!new JMSOpenSessionRequest(protocol, sessionID).send())
{
throw new JMSException("Server rejected open session request");
}
@@ -290,7 +289,7 @@ public class ConnectionImpl extends Container<Session> implements Connection
public synchronized void close()
{
- if (channel != null)
+ if (protocol != null)
{
stop();
for (SessionImpl session : getSessions())
@@ -298,15 +297,18 @@ public class ConnectionImpl extends Container<Session> implements Connection
session.close();
}
- channel.removeListener(channelListener);
- channel.close();
- channel = null;
+ protocol.getChannel().removeListener(channelListener);
+ protocol.close();
+ protocol = null;
}
}
- public IChannel getChannel()
+ /**
+ * @since 2.0
+ */
+ public JMSClientProtocol getProtocol()
{
- return channel;
+ return protocol;
}
public void handleMessageFromSignal(int sessionID, long consumerID, MessageImpl message)
@@ -397,9 +399,9 @@ public class ConnectionImpl extends Container<Session> implements Connection
private void ensureOpen() throws IllegalStateException
{
- if (channel == null)
+ if (protocol == null)
{
- throw new IllegalStateException("channel == null");
+ throw new IllegalStateException("protocol == null");
}
}
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/SessionImpl.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/SessionImpl.java
index 949b630850..9e4cebe9a9 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/SessionImpl.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/SessionImpl.java
@@ -240,7 +240,7 @@ public class SessionImpl extends QueueWorker<MessageConsumerImpl> implements Ses
try
{
stop();
- new JMSRecoverRequest(connection.getChannel(), id).send();
+ new JMSRecoverRequest(connection.getProtocol(), id).send();
start();
}
catch (Exception ex)
@@ -257,7 +257,7 @@ public class SessionImpl extends QueueWorker<MessageConsumerImpl> implements Ses
{
try
{
- String[] messageIDs = new JMSCommitRequest(connection.getChannel(), id, messages).send();
+ String[] messageIDs = new JMSCommitRequest(connection.getProtocol(), id, messages).send();
if (messageIDs == null)
{
throw new TransactionRolledbackException("Transaction rolled back by JMS server");
@@ -292,7 +292,7 @@ public class SessionImpl extends QueueWorker<MessageConsumerImpl> implements Ses
{
try
{
- if (!new JMSRollbackRequest(connection.getChannel(), id).send())
+ if (!new JMSRollbackRequest(connection.getProtocol(), id).send())
{
throw new JMSException("JMS server failed to rolled back transaction");
}
@@ -329,8 +329,8 @@ public class SessionImpl extends QueueWorker<MessageConsumerImpl> implements Ses
{
try
{
- return new JMSRegisterConsumerRequest(connection.getChannel(), id, destination, messageSelector, noLocal, durable)
- .send();
+ return new JMSRegisterConsumerRequest(connection.getProtocol(), id, destination, messageSelector, noLocal,
+ durable).send();
}
catch (Exception ex)
{
@@ -359,7 +359,7 @@ public class SessionImpl extends QueueWorker<MessageConsumerImpl> implements Ses
try
{
MessageImpl impl = MessageUtil.convert(message);
- JMSClientMessageRequest request = new JMSClientMessageRequest(connection.getChannel(), impl);
+ JMSClientMessageRequest request = new JMSClientMessageRequest(connection.getProtocol(), impl);
String messageID = request.send(connection.getSendTimeout());
if (messageID == null)
{
@@ -387,7 +387,7 @@ public class SessionImpl extends QueueWorker<MessageConsumerImpl> implements Ses
{
try
{
- new JMSAcknowledgeRequest(connection.getChannel(), id).send();
+ new JMSAcknowledgeRequest(connection.getProtocol(), id).send();
return true;
}
catch (Exception ex)
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSAcknowledgeRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSAcknowledgeRequest.java
index 90c24240ea..5ea6fd1a02 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSAcknowledgeRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSAcknowledgeRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,12 @@ public class JMSAcknowledgeRequest extends Request
{
private int sessionID;
- public JMSAcknowledgeRequest(IChannel channel, int sessionID)
+ /**
+ * @since 2.0
+ */
+ public JMSAcknowledgeRequest(JMSClientProtocol protocol, int sessionID)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientMessageRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientMessageRequest.java
index 3220abfc1e..0001f61383 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientMessageRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientMessageRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.jms.MessageImpl;
import org.eclipse.net4j.internal.jms.util.MessageUtil;
import org.eclipse.net4j.jms.JMSProtocolConstants;
@@ -27,9 +26,12 @@ public class JMSClientMessageRequest extends RequestWithConfirmation<String>
{
private MessageImpl message;
- public JMSClientMessageRequest(IChannel channel, MessageImpl message)
+ /**
+ * @since 2.0
+ */
+ public JMSClientMessageRequest(JMSClientProtocol protocol, MessageImpl message)
{
- super(channel);
+ super(protocol);
this.message = message;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocol.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocol.java
index 93f7999f22..88aaf55d29 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocol.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocol.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
+import org.eclipse.net4j.internal.jms.ConnectionImpl;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
@@ -19,8 +20,12 @@ import org.eclipse.net4j.signal.SignalReactor;
*/
public class JMSClientProtocol extends SignalProtocol
{
- public JMSClientProtocol()
+ /**
+ * @since 2.0
+ */
+ public JMSClientProtocol(ConnectionImpl connection)
{
+ setInfraStructure(connection);
}
public String getType()
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocolFactory.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocolFactory.java
deleted file mode 100644
index cca78faab1..0000000000
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSClientProtocolFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.jms.protocol;
-
-import org.eclipse.net4j.jms.JMSProtocolConstants;
-import org.eclipse.net4j.protocol.ClientProtocolFactory;
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-/**
- * @author Eike Stepper
- */
-public final class JMSClientProtocolFactory extends ClientProtocolFactory
-{
- public static final String TYPE = JMSProtocolConstants.PROTOCOL_NAME;
-
- public JMSClientProtocolFactory()
- {
- super(TYPE);
- }
-
- public JMSClientProtocol create(String description)
- {
- return new JMSClientProtocol();
- }
-
- public static JMSClientProtocol get(IManagedContainer container, String description)
- {
- return (JMSClientProtocol)container.getElement(PRODUCT_GROUP, TYPE, description);
- }
-}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCloseSessionRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCloseSessionRequest.java
index 6545bd4425..8d9cb1e622 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCloseSessionRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCloseSessionRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -25,9 +24,12 @@ public class JMSCloseSessionRequest extends RequestWithConfirmation<Boolean>
{
private int sessionID;
- public JMSCloseSessionRequest(IChannel channel, int sessionID)
+ /**
+ * @since 2.0
+ */
+ public JMSCloseSessionRequest(JMSClientProtocol protocol, int sessionID)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCommitRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCommitRequest.java
index aca1200758..236bbd4469 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCommitRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSCommitRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.jms.MessageImpl;
import org.eclipse.net4j.internal.jms.util.MessageUtil;
import org.eclipse.net4j.jms.JMSProtocolConstants;
@@ -30,9 +29,12 @@ public class JMSCommitRequest extends RequestWithConfirmation<String[]>
private List<MessageImpl> messages;
- public JMSCommitRequest(IChannel channel, int sessionID, List<MessageImpl> messages)
+ /**
+ * @since 2.0
+ */
+ public JMSCommitRequest(JMSClientProtocol protocol, int sessionID, List<MessageImpl> messages)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
this.messages = messages;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSDeregisterConsumerRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSDeregisterConsumerRequest.java
index d81a0aaa68..80c110c4fa 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSDeregisterConsumerRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSDeregisterConsumerRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -27,9 +26,12 @@ public class JMSDeregisterConsumerRequest extends RequestWithConfirmation<Boolea
private long consumerID;
- public JMSDeregisterConsumerRequest(IChannel channel, int sessionID, long consumerID)
+ /**
+ * @since 2.0
+ */
+ public JMSDeregisterConsumerRequest(JMSClientProtocol protocol, int sessionID, long consumerID)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
this.consumerID = consumerID;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogoffRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogoffRequest.java
index 80b63e31cd..06e2cf637c 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogoffRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogoffRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -22,9 +21,12 @@ import java.io.IOException;
*/
public class JMSLogoffRequest extends Request
{
- public JMSLogoffRequest(IChannel channel)
+ /**
+ * @since 2.0
+ */
+ public JMSLogoffRequest(JMSClientProtocol protocol)
{
- super(channel);
+ super(protocol);
}
@Override
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogonRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogonRequest.java
index e5649fb72f..a977d52634 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogonRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSLogonRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -27,9 +26,12 @@ public class JMSLogonRequest extends RequestWithConfirmation<Boolean>
private String password;
- public JMSLogonRequest(IChannel channel, String userName, String password)
+ /**
+ * @since 2.0
+ */
+ public JMSLogonRequest(JMSClientProtocol protocol, String userName, String password)
{
- super(channel);
+ super(protocol);
this.userName = userName;
this.password = password;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSOpenSessionRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSOpenSessionRequest.java
index ec829f5b74..a0744b0305 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSOpenSessionRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSOpenSessionRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -25,9 +24,12 @@ public class JMSOpenSessionRequest extends RequestWithConfirmation<Boolean>
{
private int sessionID;
- public JMSOpenSessionRequest(IChannel channel, int sessionID)
+ /**
+ * @since 2.0
+ */
+ public JMSOpenSessionRequest(JMSClientProtocol protocol, int sessionID)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRecoverRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRecoverRequest.java
index 2842eb32d2..eeed2f8d0a 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRecoverRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRecoverRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -25,9 +24,12 @@ public class JMSRecoverRequest extends RequestWithConfirmation<Object>
{
private int sessionID;
- public JMSRecoverRequest(IChannel channel, int sessionID)
+ /**
+ * @since 2.0
+ */
+ public JMSRecoverRequest(JMSClientProtocol protocol, int sessionID)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRegisterConsumerRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRegisterConsumerRequest.java
index 0ee1a451af..5bfe659c79 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRegisterConsumerRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRegisterConsumerRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.internal.jms.DestinationImpl;
import org.eclipse.net4j.internal.jms.util.DestinationUtil;
import org.eclipse.net4j.jms.JMSProtocolConstants;
@@ -35,10 +34,13 @@ public class JMSRegisterConsumerRequest extends RequestWithConfirmation<Long>
private boolean durable;
- public JMSRegisterConsumerRequest(IChannel channel, int sessionID, DestinationImpl destination,
+ /**
+ * @since 2.0
+ */
+ public JMSRegisterConsumerRequest(JMSClientProtocol protocol, int sessionID, DestinationImpl destination,
String messageSelector, boolean noLocal, boolean durable)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
this.destination = destination;
this.messageSelector = messageSelector;
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRollbackRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRollbackRequest.java
index c4db85ca0d..f182314f02 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRollbackRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSRollbackRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -25,9 +24,12 @@ public class JMSRollbackRequest extends RequestWithConfirmation<Boolean>
{
private int sessionID;
- public JMSRollbackRequest(IChannel channel, int sessionID)
+ /**
+ * @since 2.0
+ */
+ public JMSRollbackRequest(JMSClientProtocol protocol, int sessionID)
{
- super(channel);
+ super(protocol);
this.sessionID = sessionID;
}
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSSyncRequest.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSSyncRequest.java
index e6601a5255..f57b9ebf44 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSSyncRequest.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/internal/jms/protocol/JMSSyncRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.internal.jms.protocol;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.jms.JMSProtocolConstants;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -25,9 +24,12 @@ public class JMSSyncRequest extends RequestWithConfirmation<Long>
{
private long clientTime0;
- public JMSSyncRequest(IChannel channel)
+ /**
+ * @since 2.0
+ */
+ public JMSSyncRequest(JMSClientProtocol protocol)
{
- super(channel);
+ super(protocol);
}
@Override
diff --git a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/jms/JMSUtil.java b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/jms/JMSUtil.java
index 1cfa876d56..83bede4a15 100644
--- a/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/jms/JMSUtil.java
+++ b/plugins/org.eclipse.net4j.jms/src/org/eclipse/net4j/jms/JMSUtil.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.jms;
-import org.eclipse.net4j.internal.jms.protocol.JMSClientProtocolFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
import javax.naming.Context;
@@ -27,11 +26,6 @@ public final class JMSUtil
{
}
- public static void prepareContainer(IManagedContainer container)
- {
- container.registerFactory(new JMSClientProtocolFactory());
- }
-
public static Context createInitialContext() throws NamingException
{
if (transportContainer == null)
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
index 4297b91353..0e59bb004c 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
@@ -220,11 +220,6 @@ public class ControlChannel extends Channel
handleBuffer(buffer);
}
- private IBuffer provideBuffer()
- {
- return getConnector().getBufferProvider().provideBuffer();
- }
-
private void assertNegotiating()
{
if (!getConnector().isNegotiating())
diff --git a/plugins/org.eclipse.net4j.tests/plugin.xml b/plugins/org.eclipse.net4j.tests/plugin.xml
index f39f451a6e..6788d2bd12 100644
--- a/plugins/org.eclipse.net4j.tests/plugin.xml
+++ b/plugins/org.eclipse.net4j.tests/plugin.xml
@@ -20,11 +20,7 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
- class="org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory"
- productGroup="org.eclipse.net4j.clientProtocols"
- type="signal.protocol"/>
- <factory
- class="org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory"
+ class="org.eclipse.net4j.tests.signal.TestSignalProtocol$Factory"
productGroup="org.eclipse.net4j.serverProtocols"
type="signal.protocol"/>
</extension>
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
index ecf8e8803f..21f17a75f4 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
@@ -113,7 +113,7 @@ public abstract class AbstractTransportTest extends AbstractOMTest
return connector;
}
- protected void startTransport() throws Exception
+ protected IConnector startTransport() throws Exception
{
if (container != null)
{
@@ -122,7 +122,10 @@ public abstract class AbstractTransportTest extends AbstractOMTest
IConnector connector = getConnector();
LifecycleUtil.activate(connector);
+ return connector;
}
+
+ return null;
}
protected void stopTransport() throws Exception
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java
index da25371f3a..1040aed444 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/AllTests.java
@@ -39,6 +39,8 @@ public class AllTests
suite.addTestSuite(BufferPoolTest.class);
suite.addTestSuite(ExtendedIOTest.class);
suite.addTestSuite(Bugzilla241463_Test.class);
+ suite.addTestSuite(TCPTransportTest.class);
+ suite.addTestSuite(SignalTest.class);
// suite.addTestSuite(SecurityTest.class);
// TODO suite.addTestSuite(ConnectorTest.class);
// $JUnit-END$
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
index 5d3f9d8497..b57e9bb210 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/FailOverTest.java
@@ -10,13 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.signal.failover.RetryFailOverStrategy;
import org.eclipse.net4j.tests.signal.IntFailRequest;
import org.eclipse.net4j.tests.signal.IntRequest;
-import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
-import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
+import org.eclipse.net4j.tests.signal.TestSignalProtocol;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -25,19 +24,22 @@ import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
*/
public class FailOverTest extends AbstractTransportTest
{
+ public FailOverTest()
+ {
+ }
+
@Override
protected IManagedContainer createContainer()
{
IManagedContainer container = super.createContainer();
- container.registerFactory(new TestSignalServerProtocolFactory());
- container.registerFactory(new TestSignalClientProtocolFactory());
+ container.registerFactory(new TestSignalProtocol.Factory());
return container;
}
public void testFailingBefore() throws Exception
{
- startTransport();
- IChannel channel = getConnector().openChannel(TestSignalClientProtocolFactory.TYPE, null);
+ IConnector connector = startTransport();
+ TestSignalProtocol protocol = new TestSignalProtocol(connector);
// Simulate a disconnect from the server.
LifecycleUtil.deactivate(getAcceptor());
@@ -46,7 +48,7 @@ public class FailOverTest extends AbstractTransportTest
IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
// Exception HERE
- IntRequest request = new IntRequest(channel, data);
+ IntRequest request = new IntRequest(protocol, data);
int result = failOverStrategy.send(request);
assertEquals(data, result);
@@ -54,14 +56,14 @@ public class FailOverTest extends AbstractTransportTest
public void testFailingDuring() throws Exception
{
- startTransport();
- IChannel channel = getConnector().openChannel(TestSignalClientProtocolFactory.TYPE, null);
+ IConnector connector = startTransport();
+ TestSignalProtocol protocol = new TestSignalProtocol(connector);
int data = 0x0a;
IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
// Exception HERE
- IntRequest request = new IntRequest(channel, data);
+ IntRequest request = new IntRequest(protocol, data);
// Simulate a disconnect from the server.
LifecycleUtil.deactivate(getAcceptor());
@@ -72,14 +74,14 @@ public class FailOverTest extends AbstractTransportTest
public void testFailingDuring2() throws Exception
{
- startTransport();
- IChannel channel = getConnector().openChannel(TestSignalClientProtocolFactory.TYPE, null);
+ IConnector connector = startTransport();
+ TestSignalProtocol protocol = new TestSignalProtocol(connector);
int data = 0x0a;
IFailOverStrategy failOverStrategy = new RetryFailOverStrategy(getConnector());
// Exception HERE
- IntFailRequest request = new IntFailRequest(channel, data);
+ IntFailRequest request = new IntFailRequest(protocol, data);
int result = failOverStrategy.send(request, 1000);
assertEquals(data, result);
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 f9fd894d35..29a10258bb 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
@@ -10,14 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.tests;
-import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.tests.signal.ArrayRequest;
import org.eclipse.net4j.tests.signal.AsyncRequest;
import org.eclipse.net4j.tests.signal.IntRequest;
import org.eclipse.net4j.tests.signal.StringRequest;
-import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
import org.eclipse.net4j.tests.signal.TestSignalProtocol;
-import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.om.OMPlatform;
@@ -28,45 +26,84 @@ import java.util.Arrays;
*/
public class SignalTest extends AbstractTransportTest
{
+ public SignalTest()
+ {
+ }
+
@Override
protected IManagedContainer createContainer()
{
IManagedContainer container = super.createContainer();
- container.registerFactory(new TestSignalClientProtocolFactory());
- container.registerFactory(new TestSignalServerProtocolFactory());
+ container.registerFactory(new TestSignalProtocol.Factory());
return container;
}
public void testInteger() throws Exception
{
- startTransport();
- IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_NAME, null);
- int data = 0x0a;
- int result = new IntRequest(channel, data).send();
- assertEquals(data, result);
+ TestSignalProtocol protocol = null;
+
+ try
+ {
+ IConnector connector = startTransport();
+ protocol = new TestSignalProtocol(connector);
+ int data = 0x0a;
+ int result = new IntRequest(protocol, data).send();
+ assertEquals(data, result);
+ }
+ finally
+ {
+ if (protocol != null)
+ {
+ protocol.close();
+ }
+ }
}
public void testArray() throws Exception
{
- startTransport();
- IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_NAME, null);
- byte[] data = TinyData.getBytes();
- byte[] result = new ArrayRequest(channel, data).send();
- assertTrue(Arrays.equals(data, result));
+ TestSignalProtocol protocol = null;
+
+ try
+ {
+ IConnector connector = startTransport();
+ protocol = new TestSignalProtocol(connector);
+ byte[] data = TinyData.getBytes();
+ byte[] result = new ArrayRequest(protocol, data).send();
+ assertTrue(Arrays.equals(data, result));
+ }
+ finally
+ {
+ if (protocol != null)
+ {
+ protocol.close();
+ }
+ }
}
public void testAsync() throws Exception
{
- startTransport();
- OMPlatform.INSTANCE.setDebugging(false);
- IChannel channel = getConnector().openChannel(TestSignalProtocol.PROTOCOL_NAME, null);
- String data = TinyData.getText();
- for (int i = 0; i < 10000; i++)
+ TestSignalProtocol protocol = null;
+
+ try
{
- msg("Loop " + i);
- new AsyncRequest(channel, data).send();
- String result = new StringRequest(channel, data).send();
- assertEquals(data, result);
+ IConnector connector = startTransport();
+ OMPlatform.INSTANCE.setDebugging(false);
+ protocol = new TestSignalProtocol(connector);
+ String data = TinyData.getText();
+ for (int i = 0; i < 10000; i++)
+ {
+ msg("Loop " + i);
+ new AsyncRequest(protocol, data).send();
+ String result = new StringRequest(protocol, data).send();
+ assertEquals(data, result);
+ }
+ }
+ finally
+ {
+ if (protocol != null)
+ {
+ protocol.close();
+ }
}
}
}
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 051d4cad59..8b244fcacb 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
@@ -17,11 +17,10 @@ import org.eclipse.net4j.channel.ChannelInputStream;
import org.eclipse.net4j.channel.ChannelOutputStream;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
+import org.eclipse.net4j.tests.signal.TestSignalProtocol;
import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.container.ManagedContainer;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
@@ -45,8 +44,8 @@ public class TCPTransportTest extends AbstractTransportTest
@Override
protected IManagedContainer createContainer()
{
- IManagedContainer container = new ManagedContainer();
- container.registerFactory(new TestSignalServerProtocolFactory());
+ IManagedContainer container = super.createContainer();
+ container.registerFactory(new TestSignalProtocol.Factory());
return container;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla241463_Test.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla241463_Test.java
index b8e4aa1c25..2ca850d6d8 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla241463_Test.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla241463_Test.java
@@ -20,8 +20,7 @@ import org.eclipse.net4j.internal.tcp.TCPSelectorInjector;
import org.eclipse.net4j.internal.tcp.TCPServerConnector;
import org.eclipse.net4j.tcp.ITCPAcceptor;
import org.eclipse.net4j.tests.AbstractTransportTest;
-import org.eclipse.net4j.tests.signal.TestSignalClientProtocolFactory;
-import org.eclipse.net4j.tests.signal.TestSignalServerProtocolFactory;
+import org.eclipse.net4j.tests.signal.TestSignalProtocol;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.concurrent.TimeoutRuntimeException;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -56,21 +55,18 @@ public class Bugzilla241463_Test extends AbstractTransportTest
container.addPostProcessor(new TCPSelectorInjector());
// Test
- container.registerFactory(new TestSignalServerProtocolFactory());
- container.registerFactory(new TestSignalClientProtocolFactory());
+ container.registerFactory(new TestSignalProtocol.Factory());
return container;
}
public void testBugzilla241463() throws Exception
{
- startTransport();
-
- IConnector connector = getConnector();
+ IConnector connector = startTransport();
connector.setOpenChannelTimeout(2000L);
try
{
- connector.openChannel(TestSignalClientProtocolFactory.TYPE, null);
+ new TestSignalProtocol(connector);
fail("TimeoutRuntimeException expected");
}
catch (TimeoutRuntimeException success)
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/ArrayRequest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/ArrayRequest.java
index 826e5df5ca..159bc64389 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/ArrayRequest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/ArrayRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.tests.signal;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,9 @@ public class ArrayRequest extends RequestWithConfirmation<byte[]>
{
private byte[] data;
- public ArrayRequest(IChannel channel, byte[] data)
+ public ArrayRequest(TestSignalProtocol protocol, byte[] data)
{
- super(channel);
+ super(protocol);
this.data = data;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/AsyncRequest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/AsyncRequest.java
index 5b9bada13a..66e718dee2 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/AsyncRequest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/AsyncRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.tests.signal;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.Request;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -23,9 +22,9 @@ public class AsyncRequest extends Request
{
private String data;
- public AsyncRequest(IChannel channel, String data)
+ public AsyncRequest(TestSignalProtocol protocol, String data)
{
- super(channel);
+ super(protocol);
this.data = data;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntFailRequest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntFailRequest.java
index f06def6211..e3f87fb216 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntFailRequest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntFailRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.tests.signal;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,9 @@ public class IntFailRequest extends RequestWithConfirmation<Integer>
{
private int data;
- public IntFailRequest(IChannel channel, int data)
+ public IntFailRequest(TestSignalProtocol protocol, int data)
{
- super(channel);
+ super(protocol);
this.data = data;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntRequest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntRequest.java
index c79435b544..fad256f60f 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntRequest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/IntRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.tests.signal;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,9 @@ public class IntRequest extends RequestWithConfirmation<Integer>
{
private int data;
- public IntRequest(IChannel channel, int data)
+ public IntRequest(TestSignalProtocol protocol, int data)
{
- super(channel);
+ super(protocol);
this.data = data;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/StringRequest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/StringRequest.java
index 2b98f93818..a3a0a45860 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/StringRequest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/StringRequest.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.tests.signal;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -24,9 +23,9 @@ public class StringRequest extends RequestWithConfirmation<String>
{
private String data;
- public StringRequest(IChannel channel, String data)
+ public StringRequest(TestSignalProtocol protocol, String data)
{
- super(channel);
+ super(protocol);
this.data = data;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalClientProtocolFactory.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalClientProtocolFactory.java
deleted file mode 100644
index 80106ae1aa..0000000000
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalClientProtocolFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 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.tests.signal;
-
-import org.eclipse.net4j.protocol.ClientProtocolFactory;
-import org.eclipse.net4j.util.factory.ProductCreationException;
-
-/**
- * @author Eike Stepper
- */
-public class TestSignalClientProtocolFactory extends ClientProtocolFactory
-{
- public static final String TYPE = TestSignalServerProtocolFactory.TYPE;
-
- public TestSignalClientProtocolFactory()
- {
- super(TYPE);
- }
-
- public TestSignalProtocol create(String description) throws ProductCreationException
- {
- return new TestSignalProtocol();
- }
-}
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 099df2345a..3dccb36719 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
@@ -10,8 +10,11 @@
**************************************************************************/
package org.eclipse.net4j.tests.signal;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.protocol.ServerProtocolFactory;
import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.signal.SignalReactor;
+import org.eclipse.net4j.util.factory.ProductCreationException;
/**
* @author Eike Stepper
@@ -30,7 +33,12 @@ public class TestSignalProtocol extends SignalProtocol
public static final short SIGNAL_ASYNC = 5;
- public TestSignalProtocol()
+ public TestSignalProtocol(IConnector connector)
+ {
+ super(connector);
+ }
+
+ private TestSignalProtocol()
{
}
@@ -57,4 +65,20 @@ public class TestSignalProtocol extends SignalProtocol
}
return null;
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Factory extends ServerProtocolFactory
+ {
+ public Factory()
+ {
+ super(PROTOCOL_NAME);
+ }
+
+ public TestSignalProtocol create(String description) throws ProductCreationException
+ {
+ return new TestSignalProtocol();
+ }
+ }
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java
deleted file mode 100644
index a105410d22..0000000000
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/signal/TestSignalServerProtocolFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 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.tests.signal;
-
-import org.eclipse.net4j.protocol.ServerProtocolFactory;
-import org.eclipse.net4j.util.factory.ProductCreationException;
-
-/**
- * @author Eike Stepper
- */
-public class TestSignalServerProtocolFactory extends ServerProtocolFactory
-{
- public static final String TYPE = TestSignalProtocol.PROTOCOL_NAME;
-
- public TestSignalServerProtocolFactory()
- {
- super(TYPE);
- }
-
- public TestSignalProtocol create(String description) throws ProductCreationException
- {
- return new TestSignalProtocol();
- }
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/channel/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/channel/Channel.java
index cff8f93601..bc58ba8ab9 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/channel/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/channel/Channel.java
@@ -176,6 +176,21 @@ public class Channel extends Lifecycle implements InternalChannel
}
}
+ public short getBufferCapacity()
+ {
+ return channelMultiplexer.getBufferCapacity();
+ }
+
+ public IBuffer provideBuffer()
+ {
+ return channelMultiplexer.provideBuffer();
+ }
+
+ public void retainBuffer(IBuffer buffer)
+ {
+ channelMultiplexer.retainBuffer(buffer);
+ }
+
@Override
public String toString()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java
index fd0f21bb35..ccaf97bf3f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/connector/Connector.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.internal.net4j.connector;
+import org.eclipse.net4j.buffer.IBuffer;
import org.eclipse.net4j.buffer.IBufferProvider;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.connector.ConnectorException;
@@ -657,6 +658,21 @@ public abstract class Connector extends Container<IChannel> implements InternalC
}
}
+ public short getBufferCapacity()
+ {
+ return bufferProvider.getBufferCapacity();
+ }
+
+ public IBuffer provideBuffer()
+ {
+ return bufferProvider.provideBuffer();
+ }
+
+ public void retainBuffer(IBuffer buffer)
+ {
+ bufferProvider.retainBuffer(buffer);
+ }
+
protected void leaveConnecting()
{
if (getNegotiator() == null)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/channel/IChannelMultiplexer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/channel/IChannelMultiplexer.java
index ecc6ce162c..bd52337352 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/channel/IChannelMultiplexer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/channel/IChannelMultiplexer.java
@@ -10,10 +10,12 @@
**************************************************************************/
package org.eclipse.net4j.channel;
+import org.eclipse.net4j.buffer.IBufferProvider;
+
/**
* @author Eike Stepper
*/
-public interface IChannelMultiplexer
+public interface IChannelMultiplexer extends IBufferProvider
{
/**
* Called by an {@link IChannel} each time a new buffer is available for multiplexing. This or another buffer can be
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 6d890a67de..4d64896325 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,6 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.buffer.BufferInputStream;
import org.eclipse.net4j.buffer.BufferOutputStream;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -29,9 +28,12 @@ public abstract class Request extends SignalActor<Object>
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SIGNAL, Request.class);
- protected Request(IChannel channel)
+ /**
+ * @since 2.0
+ */
+ protected Request(SignalProtocol protocol)
{
- super(channel);
+ super(protocol);
}
@Override
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 645c6eae99..034930aa26 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,6 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.buffer.BufferInputStream;
import org.eclipse.net4j.buffer.BufferOutputStream;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -31,9 +30,12 @@ public abstract class RequestWithConfirmation<RESULT> extends SignalActor<RESULT
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SIGNAL, RequestWithConfirmation.class);
- protected RequestWithConfirmation(IChannel channel)
+ /**
+ * @since 2.0
+ */
+ protected RequestWithConfirmation(SignalProtocol protocol)
{
- super(channel);
+ super(protocol);
}
@Override
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 1195013c77..0019c5bd7f 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,6 @@
package org.eclipse.net4j.signal;
import org.eclipse.net4j.buffer.BufferInputStream;
-import org.eclipse.net4j.buffer.IBufferHandler;
-import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.util.ReflectUtil;
import java.text.MessageFormat;
@@ -28,10 +26,13 @@ public abstract class SignalActor<RESULT> extends Signal
private RESULT result;
- protected SignalActor(IChannel channel)
+ /**
+ * @since 2.0
+ */
+ protected SignalActor(SignalProtocol protocol)
{
- SignalProtocol protocol = extractSignalProtocol(channel);
setProtocol(protocol);
+ setCorrelationID(protocol.getNextCorrelationID());
}
public RESULT send() throws Exception
@@ -62,20 +63,4 @@ public abstract class SignalActor<RESULT> extends Signal
{
this.result = result;
}
-
- private static SignalProtocol extractSignalProtocol(IChannel channel)
- {
- IBufferHandler receiveHandler = channel.getReceiveHandler();
- if (receiveHandler == null)
- {
- throw new IllegalArgumentException("Channel has no protocol"); //$NON-NLS-1$
- }
-
- if (receiveHandler instanceof SignalProtocol)
- {
- return (SignalProtocol)receiveHandler;
- }
-
- throw new IllegalArgumentException("Channel has no signal 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 ebfc11efbb..bf9a755048 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
@@ -14,6 +14,8 @@ import org.eclipse.net4j.buffer.BufferInputStream;
import org.eclipse.net4j.buffer.IBuffer;
import org.eclipse.net4j.buffer.IBufferProvider;
import org.eclipse.net4j.channel.ChannelOutputStream;
+import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.protocol.Protocol;
import org.eclipse.net4j.util.io.IStreamWrapper;
import org.eclipse.net4j.util.io.StreamWrapperChain;
@@ -21,6 +23,8 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.OM;
+import org.eclipse.spi.net4j.InternalConnector;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -54,6 +58,34 @@ public abstract class SignalProtocol extends Protocol
{
}
+ /**
+ * @since 2.0
+ */
+ protected SignalProtocol(IConnector connector)
+ {
+ open(connector);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public IChannel open(IConnector connector)
+ {
+ InternalConnector internal = (InternalConnector)connector;
+ setBufferProvider(internal.getBufferProvider());
+ setExecutorService(internal.getReceiveExecutor());
+ return connector.openChannel(this);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void close()
+ {
+ getChannel().close();
+ setChannel(null);
+ }
+
public IStreamWrapper getStreamWrapper()
{
return streamWrapper;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java
index 664d625869..6b2f4ed664 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java
@@ -11,6 +11,7 @@
package org.eclipse.spi.net4j;
import org.eclipse.net4j.buffer.IBuffer;
+import org.eclipse.net4j.buffer.IBufferProvider;
import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.channel.IChannelMultiplexer;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
@@ -21,7 +22,7 @@ import java.util.concurrent.ExecutorService;
/**
* @author Eike Stepper
*/
-public interface InternalChannel extends IChannel, ILifecycle.Introspection
+public interface InternalChannel extends IChannel, IBufferProvider, ILifecycle.Introspection
{
public void setChannelID(int channelID);

Back to the top