[jboss-cvs] JBoss Messaging SVN: r3349 - in branches/Branch_JBMESSAGING-544: src/main/org/jboss/jms/server/endpoint and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 20 11:15:07 EST 2007
Author: jmesnil
Date: 2007-11-20 11:15:07 -0500 (Tue, 20 Nov 2007)
New Revision: 3349
Added:
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserRequestCodec.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserResponseCodec.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserRequest.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserResponse.java
Modified:
branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateConsumerRequestCodec.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/PacketCodecFactory.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/SendTransactionRequestCodec.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/ClosingResponse.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDRequest.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDResponse.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/PacketType.java
branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/SetClientIDMessage.java
branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-544: Replace client-server transport with NIO based transport
* added packets & codecs for browser creation
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -54,7 +54,6 @@
import org.jboss.jms.message.TextMessageProxy;
import org.jboss.jms.wireformat.RequestSupport;
import org.jboss.jms.wireformat.SessionAddTemporaryDestinationRequest;
-import org.jboss.jms.wireformat.SessionCreateBrowserDelegateRequest;
import org.jboss.jms.wireformat.SessionCreateQueueRequest;
import org.jboss.jms.wireformat.SessionCreateTopicRequest;
import org.jboss.jms.wireformat.SessionDeleteTemporaryDestinationRequest;
@@ -68,6 +67,8 @@
import org.jboss.messaging.core.remoting.wireformat.CancelDeliveryMessage;
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerRequest;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerResponse;
import org.jboss.messaging.core.remoting.wireformat.NullPacket;
@@ -286,12 +287,27 @@
public BrowserDelegate createBrowserDelegate(JBossDestination queue, String messageSelector)
throws JMSException
{
- RequestSupport req = new SessionCreateBrowserDelegateRequest(id, version, queue,
- messageSelector);
+ assert newClient != null;
+
+ CreateBrowserRequest request = new CreateBrowserRequest(queue, messageSelector);
+ request.setTargetID(id);
+ try
+ {
+ CreateBrowserResponse response = (CreateBrowserResponse) newClient.sendBlocking(request);
+ return new ClientBrowserDelegate(response.getBrowserID());
+ } catch (TimeoutException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+
- Object res = doInvoke(client, req);
-
- return (BrowserDelegate)res;
+// RequestSupport req = new SessionCreateBrowserDelegateRequest(id, version, queue,
+// messageSelector);
+//
+// Object res = doInvoke(client, req);
+//
+// return (BrowserDelegate)res;
}
/**
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -29,6 +29,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_SENDMESSAGE;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_ACKDELIVERY;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CLOSING;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATEBROWSER;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONSUMER;
import java.lang.ref.WeakReference;
@@ -103,6 +104,8 @@
import org.jboss.messaging.core.remoting.wireformat.CancelDeliveriesMessage;
import org.jboss.messaging.core.remoting.wireformat.CancelDeliveryMessage;
import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerRequest;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerResponse;
import org.jboss.messaging.core.remoting.wireformat.DeliverMessage;
@@ -2459,6 +2462,13 @@
CreateConsumerResponse response = new CreateConsumerResponse(consumer.getID(), consumer.getBufferSize(), consumer.getMaxDeliveries(), consumer.getRedeliveryDelay());
response.normalize(request);
session.write(response);
+ } else if (type == REQ_CREATEBROWSER)
+ {
+ CreateBrowserRequest request = (CreateBrowserRequest) packet;
+ ClientBrowserDelegate browser = (ClientBrowserDelegate) createBrowserDelegate(request.getDestination(), request.getSelector());
+ CreateBrowserResponse response = new CreateBrowserResponse(browser.getID());
+ response.normalize(request);
+ session.write(response);
} else if (type == REQ_ACKDELIVERY)
{
AcknowledgeDeliveryRequest request = (AcknowledgeDeliveryRequest) packet;
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/AbstractPacketCodec.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -6,6 +6,13 @@
*/
package org.jboss.messaging.core.remoting.codec;
+import static org.jboss.jms.destination.JBossDestination.readDestination;
+import static org.jboss.jms.destination.JBossDestination.writeDestination;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
@@ -18,6 +25,7 @@
import org.apache.mina.filter.codec.demux.MessageDecoder;
import org.apache.mina.filter.codec.demux.MessageDecoderResult;
import org.apache.mina.filter.codec.demux.MessageEncoder;
+import org.jboss.jms.destination.JBossDestination;
import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
import org.jboss.messaging.core.remoting.wireformat.PacketType;
@@ -25,15 +33,15 @@
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
*/
public abstract class AbstractPacketCodec<P extends AbstractPacket> implements
- MessageEncoder<P>, MessageDecoder
+MessageEncoder<P>, MessageDecoder
{
// Constants -----------------------------------------------------
private static final CharsetEncoder UTF_8_ENCODER = Charset.forName("UTF-8")
- .newEncoder();
+ .newEncoder();
private static final CharsetDecoder UTF_8_DECODER = Charset.forName("UTF-8")
- .newDecoder();
+ .newDecoder();
private static final byte TRUE = (byte) 0;
@@ -72,7 +80,7 @@
// MessageEncoder implementation ---------------------------------
public void encode(IoSession session, P packet, ProtocolEncoderOutput out)
- throws Exception
+ throws Exception
{
long correlationID = packet.getCorrelationID();
String targetID = packet.getTargetID();
@@ -155,7 +163,7 @@
public MessageDecoderResult decode(IoSession session, IoBuffer in,
ProtocolDecoderOutput out) throws Exception
- {
+ {
in.get(); // skip message type
in.getInt(); // skip header length
long correlationID = in.getLong();
@@ -174,22 +182,18 @@
out.write(packet);
return OK;
- }
+ }
public void finishDecode(IoSession session, ProtocolDecoderOutput out)
- throws Exception
+ throws Exception
{
}
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
protected abstract void encodeBody(IoSession session, P packet, IoBuffer out)
- throws Exception;
+ throws Exception;
protected abstract P decodeBody(IoSession session, IoBuffer in)
- throws Exception;
+ throws Exception;
public static int sizeof(String nullableString)
{
@@ -204,7 +208,7 @@
}
public static void putString(IoBuffer out, String nullableString)
- throws CharacterCodingException
+ throws CharacterCodingException
{
if (nullableString == null)
@@ -255,7 +259,24 @@
return false;
}
}
+
+ // Package protected ---------------------------------------------
+ // Protected -----------------------------------------------------
+
+ protected static byte[] encode(JBossDestination destination) throws Exception
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writeDestination(new DataOutputStream(baos), destination);
+ baos.flush();
+ return baos.toByteArray();
+ }
+
+ protected static JBossDestination decode(byte[] b) throws Exception
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(b);
+ return readDestination(new DataInputStream(bais));
+ }
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Added: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserRequestCodec.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserRequestCodec.java (rev 0)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserRequestCodec.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.core.remoting.codec;
+
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATEBROWSER;
+
+import org.apache.mina.common.IoBuffer;
+import org.apache.mina.common.IoSession;
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserRequest;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ */
+public class CreateBrowserRequestCodec extends
+ AbstractPacketCodec<CreateBrowserRequest>
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateBrowserRequestCodec()
+ {
+ super(REQ_CREATEBROWSER);
+ }
+
+ // Public --------------------------------------------------------
+
+ // AbstractPacketCodec overrides ---------------------------------
+
+ @Override
+ protected void encodeBody(IoSession session, CreateBrowserRequest request,
+ IoBuffer out) throws Exception
+ {
+ byte[] destination = encode(request.getDestination());
+ String selector = request.getSelector();
+
+ int bodyLength = INT_LENGTH + destination.length + sizeof(selector);
+
+ out.putInt(bodyLength);
+ out.putInt(destination.length);
+ out.put(destination);
+ putString(out, selector);
+ }
+
+ @Override
+ protected CreateBrowserRequest decodeBody(IoSession session, IoBuffer in)
+ throws Exception
+ {
+ int bodyLength = in.getInt();
+ if (in.remaining() < bodyLength)
+ {
+ return null;
+ }
+
+ int destinationLength = in.getInt();
+ byte[] b = new byte[destinationLength];
+ in.get(b);
+ JBossDestination destination = decode(b);
+ String selector = getString(in);
+
+ return new CreateBrowserRequest(destination, selector);
+ }
+
+ // Inner classes -------------------------------------------------
+}
Added: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserResponseCodec.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserResponseCodec.java (rev 0)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateBrowserResponseCodec.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.core.remoting.codec;
+
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CREATEBROWSER;
+
+import org.apache.mina.common.IoBuffer;
+import org.apache.mina.common.IoSession;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ */
+public class CreateBrowserResponseCodec extends
+ AbstractPacketCodec<CreateBrowserResponse>
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateBrowserResponseCodec()
+ {
+ super(RESP_CREATEBROWSER);
+ }
+
+ // Public --------------------------------------------------------
+
+ // AbstractPacketCodec overrides ---------------------------------
+
+ @Override
+ protected void encodeBody(IoSession session,
+ CreateBrowserResponse response, IoBuffer out) throws Exception
+ {
+ String browserID = response.getBrowserID();
+
+ int bodyLength = sizeof(browserID);
+
+ out.putInt(bodyLength);
+ putString(out, browserID);
+ }
+
+ @Override
+ protected CreateBrowserResponse decodeBody(IoSession session, IoBuffer in)
+ throws Exception
+ {
+ int bodyLength = in.getInt();
+ if (in.remaining() < bodyLength)
+ {
+ return null;
+ }
+
+ String browserID = getString(in);
+
+ return new CreateBrowserResponse(browserID);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateConsumerRequestCodec.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateConsumerRequestCodec.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/CreateConsumerRequestCodec.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -6,15 +6,8 @@
*/
package org.jboss.messaging.core.remoting.codec;
-import static org.jboss.jms.destination.JBossDestination.readDestination;
-import static org.jboss.jms.destination.JBossDestination.writeDestination;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONSUMER;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
import org.apache.mina.common.IoBuffer;
import org.apache.mina.common.IoSession;
import org.jboss.jms.destination.JBossDestination;
@@ -97,19 +90,5 @@
// Private -------------------------------------------------------
- private static byte[] encode(JBossDestination destination) throws Exception
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- writeDestination(new DataOutputStream(baos), destination);
- baos.flush();
- return baos.toByteArray();
- }
-
- private static JBossDestination decode(byte[] b) throws Exception
- {
- ByteArrayInputStream bais = new ByteArrayInputStream(b);
- return readDestination(new DataInputStream(bais));
- }
-
// Inner classes -------------------------------------------------
}
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/PacketCodecFactory.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/PacketCodecFactory.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/PacketCodecFactory.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -16,6 +16,8 @@
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
import org.jboss.messaging.core.remoting.wireformat.ClosingRequest;
import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionRequest;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerRequest;
@@ -107,6 +109,14 @@
super.addMessageEncoder(CreateConsumerResponse.class,
CreateConsumerResponseCodec.class);
+ super.addMessageDecoder(CreateBrowserRequestCodec.class);
+ super.addMessageEncoder(CreateBrowserRequest.class,
+ CreateBrowserRequestCodec.class);
+
+ super.addMessageDecoder(CreateBrowserResponseCodec.class);
+ super.addMessageEncoder(CreateBrowserResponse.class,
+ CreateBrowserResponseCodec.class);
+
super.addMessageDecoder(StartConnectionMessageCodec.class);
super.addMessageEncoder(StartConnectionMessage.class,
StartConnectionMessageCodec.class);
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/SendTransactionRequestCodec.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/SendTransactionRequestCodec.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/codec/SendTransactionRequestCodec.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -44,7 +44,7 @@
protected void encodeBody(IoSession session, SendTransactionMessage request,
IoBuffer out) throws Exception
{
- byte[] encodedTxReq = encode(request.getTransactionRequest());
+ byte[] encodedTxReq = encodeTransactionRequest(request.getTransactionRequest());
boolean checkForDuplicates = request.checkForDuplicates();
int bodyLength = INT_LENGTH + encodedTxReq.length + 1;
@@ -68,7 +68,7 @@
int txReqLength = in.getInt();
byte[] encodedTxReq = new byte[txReqLength];
in.get(encodedTxReq);
- TransactionRequest tr = decode(encodedTxReq);
+ TransactionRequest tr = decodeTransactionRequest(encodedTxReq);
boolean checkForDuplicates = getBoolean(in);
return new SendTransactionMessage(tr, checkForDuplicates);
@@ -80,7 +80,7 @@
// Private ----------------------------------------------------
- private static byte[] encode(TransactionRequest tr) throws Exception
+ private static byte[] encodeTransactionRequest(TransactionRequest tr) throws Exception
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tr.write(new DataOutputStream(baos));
@@ -88,7 +88,7 @@
return baos.toByteArray();
}
- private static TransactionRequest decode(byte[] b) throws Exception
+ private static TransactionRequest decodeTransactionRequest(byte[] b) throws Exception
{
TransactionRequest tr = new TransactionRequest();
ByteArrayInputStream bais = new ByteArrayInputStream(b);
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/ClosingResponse.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/ClosingResponse.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/ClosingResponse.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -6,7 +6,9 @@
*/
package org.jboss.messaging.core.remoting.wireformat;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CLOSING;
+
/**
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -28,7 +30,7 @@
public ClosingResponse(long id)
{
- super(PacketType.RESP_CLOSING);
+ super(RESP_CLOSING);
this.id = id;
}
Added: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserRequest.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserRequest.java (rev 0)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserRequest.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.core.remoting.wireformat;
+
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATEBROWSER;
+
+import org.jboss.jms.destination.JBossDestination;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class CreateBrowserRequest extends AbstractPacket
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final JBossDestination destination;
+ private final String selector;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateBrowserRequest(JBossDestination destination, String selector)
+ {
+ super(REQ_CREATEBROWSER);
+
+ assert destination != null;
+
+ this.destination = destination;
+ this.selector = selector;
+ }
+
+ // Public --------------------------------------------------------
+
+ public JBossDestination getDestination()
+ {
+ return destination;
+ }
+
+ public String getSelector()
+ {
+ return selector;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", destination=" + destination + ", selector="
+ + selector + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserResponse.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserResponse.java (rev 0)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/CreateBrowserResponse.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.messaging.core.remoting.wireformat;
+
+import static org.jboss.messaging.core.remoting.Assert.assertValidID;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CREATEBROWSER;
+
+/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class CreateBrowserResponse extends AbstractPacket
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final String browserID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateBrowserResponse(String browserID)
+ {
+ super(RESP_CREATEBROWSER);
+
+ assertValidID(browserID);
+
+ this.browserID = browserID;
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getBrowserID()
+ {
+ return browserID;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", browserID=" + browserID + "]";
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDRequest.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDRequest.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDRequest.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -9,6 +9,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_GETCLIENTID;
/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
*
* @version <tt>$Revision$</tt>
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDResponse.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDResponse.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/GetClientIDResponse.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -10,6 +10,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_GETCLIENTID;
/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
*
* @version <tt>$Revision$</tt>
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/PacketType.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/PacketType.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/PacketType.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -15,42 +15,43 @@
{
// FIXME better choice of byte value...
- NULL((byte)1),
- TEXT((byte) 3),
+ NULL ((byte) 1),
+ TEXT ((byte) 3),
// Connection factory
- REQ_CREATECONNECTION((byte) 4),
- RESP_CREATECONNECTION((byte) 5),
+ REQ_CREATECONNECTION ((byte) 4),
+ RESP_CREATECONNECTION ((byte) 5),
// Connection
- REQ_IDBLOCK((byte)6),
- RESP_IDBLOCK((byte)7),
- REQ_CREATESESSION((byte) 8),
- RESP_CREATESESSION((byte) 9),
- MSG_STARTCONNECTION((byte)10),
- MSG_SENDTRANSACTION((byte)11),
- RESP_SENDTRANSACTION((byte)12),
- REQ_GETCLIENTID((byte)13),
- RESP_GETCLIENTID((byte)14),
- MSG_SETCLIENTID((byte)15),
+ REQ_IDBLOCK ((byte) 6),
+ RESP_IDBLOCK ((byte) 7),
+ REQ_CREATESESSION ((byte) 8),
+ RESP_CREATESESSION ((byte) 9),
+ MSG_STARTCONNECTION ((byte)10),
+ MSG_SENDTRANSACTION ((byte)11),
+ RESP_SENDTRANSACTION ((byte)12),
+ REQ_GETCLIENTID ((byte)13),
+ RESP_GETCLIENTID ((byte)14),
+ MSG_SETCLIENTID ((byte)15),
// Session
- REQ_CREATECONSUMER((byte)16),
- RESP_CREATECONSUMER((byte)17),
- MSG_SENDMESSAGE((byte)18),
- MSG_DELIVERMESSAGE((byte)19),
- REQ_ACKDELIVERY((byte)20),
- RESP_ACKDELIVERY((byte)21),
- MSG_ACKDELIVERIES((byte)22),
- RESP_ACKDELIVERIES((byte)23),
- MSG_RECOVERDELIVERIES((byte)24),
- MSG_CANCELDELIVERY((byte)25),
- MSG_CANCELDELIVERIES((byte)26),
+ REQ_CREATECONSUMER ((byte)16),
+ RESP_CREATECONSUMER ((byte)17),
+ REQ_CREATEBROWSER ((byte)18),
+ RESP_CREATEBROWSER ((byte)19),
+ MSG_SENDMESSAGE ((byte)20),
+ MSG_DELIVERMESSAGE ((byte)22),
+ REQ_ACKDELIVERY ((byte)23),
+ RESP_ACKDELIVERY ((byte)24),
+ MSG_ACKDELIVERIES ((byte)25),
+ RESP_ACKDELIVERIES ((byte)26),
+ MSG_RECOVERDELIVERIES ((byte)27),
+ MSG_CANCELDELIVERY ((byte)28),
+ MSG_CANCELDELIVERIES ((byte)29),
// Consumer
- MSG_CHANGERATE((byte)27),
+ MSG_CHANGERATE ((byte)30),
// Misc
- REQ_CLOSING((byte)28),
- RESP_CLOSING((byte)29),
- MSG_CLOSE((byte)30);
+ REQ_CLOSING ((byte)32),
+ RESP_CLOSING ((byte)33),
+ MSG_CLOSE ((byte)34);
-
private byte type;
PacketType(byte type)
Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/SetClientIDMessage.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/SetClientIDMessage.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/messaging/core/remoting/wireformat/SetClientIDMessage.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -10,6 +10,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.MSG_SETCLIENTID;
/**
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
*
* @version <tt>$Revision$</tt>
Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java 2007-11-20 15:22:54 UTC (rev 3348)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java 2007-11-20 16:15:07 UTC (rev 3349)
@@ -21,6 +21,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.NULL;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_ACKDELIVERY;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CLOSING;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATEBROWSER;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONNECTION;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATECONSUMER;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_CREATESESSION;
@@ -28,6 +29,7 @@
import static org.jboss.messaging.core.remoting.wireformat.PacketType.REQ_IDBLOCK;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_ACKDELIVERY;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CLOSING;
+import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CREATEBROWSER;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CREATECONNECTION;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CREATECONSUMER;
import static org.jboss.messaging.core.remoting.wireformat.PacketType.RESP_CREATESESSION;
@@ -66,6 +68,8 @@
import org.jboss.messaging.core.remoting.wireformat.CloseMessage;
import org.jboss.messaging.core.remoting.wireformat.ClosingRequest;
import org.jboss.messaging.core.remoting.wireformat.ClosingResponse;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserRequest;
+import org.jboss.messaging.core.remoting.wireformat.CreateBrowserResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionRequest;
import org.jboss.messaging.core.remoting.wireformat.CreateConnectionResponse;
import org.jboss.messaging.core.remoting.wireformat.CreateConsumerRequest;
@@ -575,7 +579,37 @@
assertEquals(MSG_CANCELDELIVERIES, decodedMessage.getType());
assertSameCancels(message.getCancels(), decodedMessage.getCancels());
}
+
+ public void testCreateBrowserRequest() throws Exception
+ {
+ JBossDestination destination = new JBossQueue(
+ "testCreateBrowserRequest", true);
+ CreateBrowserRequest request = new CreateBrowserRequest(destination,
+ "color = 'red'");
+ AbstractPacket decodedPacket = encodeAndDecode(request);
+
+ assertTrue(decodedPacket instanceof CreateBrowserRequest);
+
+ CreateBrowserRequest decodedRequest = (CreateBrowserRequest) decodedPacket;
+ assertEquals(REQ_CREATEBROWSER, decodedRequest.getType());
+ assertEquals(request.getDestination(), decodedRequest.getDestination());
+ assertEquals(request.getSelector(), decodedRequest.getSelector());
+ }
+
+ public void testCreateBrowserResponse() throws Exception
+ {
+ CreateBrowserResponse response = new CreateBrowserResponse(randomUUID().toString());
+
+ AbstractPacket decodedPacket = encodeAndDecode(response);
+
+ assertTrue(decodedPacket instanceof CreateBrowserResponse);
+
+ CreateBrowserResponse decodedResponse = (CreateBrowserResponse) decodedPacket;
+ assertEquals(RESP_CREATEBROWSER, decodedResponse.getType());
+ assertEquals(response.getBrowserID(), decodedResponse.getBrowserID());
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
More information about the jboss-cvs-commits
mailing list