[jboss-cvs] JBoss Messaging SVN: r5110 - in branches/amqp_integration: examples/messaging/src/org/jboss/messaging/example and 24 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 14 11:01:09 EDT 2008
Author: jmesnil
Date: 2008-10-14 11:01:09 -0400 (Tue, 14 Oct 2008)
New Revision: 5110
Added:
branches/amqp_integration/.gitignore
branches/amqp_integration/src/main/org/jboss/messaging/amq/
branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQChannelException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQConnectionException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQMessage.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQPInvalidClassException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/
branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQCodecFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQDecoder.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQEncoder.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQProtocolCodecFilter.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/exchange/
branches/amqp_integration/src/main/org/jboss/messaging/amq/exchange/ExchangeDefaults.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlock.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockDecoder.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockEncoder.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrame.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrameDecodingException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyInstanceFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolClassException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolHeaderException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolInstanceException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolVersionException.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortString.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortStringTokenizer.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQType.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypeMap.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypedValue.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicAckBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicContentHeaderProperties.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicDeliverBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetEmptyBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicPublishBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRejectBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicReturnBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BodyFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelAlertBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPingBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPongBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelResumeBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ClientMethodDispatcher.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CommonContentHeaderProperties.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CompositeAMQDataBlock.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionRedirectBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/Content.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBodyFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBodyFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderProperties.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderPropertiesFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DeferredDataBlock.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodableAMQDataBlock.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodingUtils.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTable.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTableFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBodyFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageAppendBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCancelBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCheckpointBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCloseBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageConsumeBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageEmptyBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageGetBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOffsetBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOpenBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageQosBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRecoverBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRejectBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageResumeBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageTransferBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MethodRegistry.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolInitiation.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolVersion.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ServerMethodDispatcher.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/SmallCompositeAMQDataBlock.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TunnelRequestBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectOkBody.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/AMQMethodBody_0_9.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/BasicPublishBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseOkBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenOkBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionCloseBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenOkBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartOkBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneOkBodyImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/MethodRegistry_0_9.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/impl/
branches/amqp_integration/src/main/org/jboss/messaging/amq/impl/AMQMessageImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/protocol/
branches/amqp_integration/src/main/org/jboss/messaging/amq/protocol/AMQConstant.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/server/
branches/amqp_integration/src/main/org/jboss/messaging/amq/server/protocol/
branches/amqp_integration/src/main/org/jboss/messaging/amq/server/protocol/HeartbeatConfig.java
branches/amqp_integration/src/main/org/jboss/messaging/amq/server/security/
branches/amqp_integration/src/main/org/jboss/messaging/amq/server/security/auth/
branches/amqp_integration/src/main/org/jboss/messaging/amq/server/security/auth/AuthenticationResult.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptor.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptorFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/FilterChainSupport.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/IoBufferWrapper.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MessagingIOSessionDataStructureFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaConnection.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaProtocolCodecFilter.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/TransportConstants.java
Modified:
branches/amqp_integration/
branches/amqp_integration/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
branches/amqp_integration/src/config/jbm-configuration.xml
branches/amqp_integration/src/config/log4j.xml
branches/amqp_integration/src/main/org/jboss/messaging/core/client/impl/ClientSessionPacketHandler.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/Channel.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/ChannelHandler.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ConnectionRegistryImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/ChannelBufferWrapper.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyAcceptor.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/AcceptorFactory.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/BufferHandler.java
branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java
branches/amqp_integration/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java
branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java
branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/ServerSessionPacketHandler.java
branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java
branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java
branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java
Log:
initial import for AMQP integration
- imported classes generated using Qpid tools from AMQP 0.9 XML spec
- adapted these classes to use our MessagingBuffer instead of MINA 1.x ByteBuffer
- duplicated the mina remoting code in the remoting.impl.amqp package to handle incoming AMQ protocol
- duplicated code to handle AMQP frame (based on our code to handle JBM Packet)
- added support for the simplest basic.publish example (no code to consume a message, no tx, no exchange & queue support,...)
Property changes on: branches/amqp_integration
___________________________________________________________________
Name: svn:ignore
- coverage.ec
output
thirdparty
messaging.iws
bin
ObjectStore
build
data
data-backup
eclipse-output
logs
tags
+ coverage.ec
output
thirdparty
messaging.iws
bin
ObjectStore
build
data
data-backup
eclipse-output
logs
tags
.git
Added: branches/amqp_integration/.gitignore
===================================================================
--- branches/amqp_integration/.gitignore (rev 0)
+++ branches/amqp_integration/.gitignore 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,19 @@
+# xcode noise
+build
+*/build/*
+*.pbxuser
+*.mode1v3
+
+# old skool
+.svn
+
+# osx noise
+.DS_Store
+profile
+
+
+# specific stuff
+thirdparty
+data
+eclipse-output
+*/logs/*
Modified: branches/amqp_integration/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java
===================================================================
--- branches/amqp_integration/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/examples/messaging/src/org/jboss/messaging/example/SimpleClient.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -29,7 +29,6 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.util.SimpleString;
@@ -53,11 +52,14 @@
ClientMessage message = clientSession.createClientMessage(JBossTextMessage.TYPE, false, 0,
System.currentTimeMillis(), (byte) 1);
message.getBody().putString("Hello!");
- clientProducer.send(message);
+ //clientProducer.send(message);
ClientConsumer clientConsumer = clientSession.createConsumer(queue);
clientSession.start();
ClientMessage msg = clientConsumer.receive(5000);
- System.out.println("msg.getPayload() = " + msg.getBody().getString());
+// System.out.println("msg.getPayload() = " + msg.getBody().getString());
+ byte[] b = new byte[msg.getBody().capacity()];
+ msg.getBody().getBytes(b);
+ System.out.println("msg.getPayload() = " + new String(b));
msg.processed();
}
catch(Exception e)
Modified: branches/amqp_integration/src/config/jbm-configuration.xml
===================================================================
--- branches/amqp_integration/src/config/jbm-configuration.xml 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/config/jbm-configuration.xml 2008-10-14 15:01:09 UTC (rev 5110)
@@ -64,6 +64,18 @@
<param key="jbm.remoting.netty.sslenabled" value="false" type="Boolean"/>
</params>
</acceptor>
+ <!-- AMQP TCP acceptor -->
+ <acceptor>
+ <factory-class>org.jboss.messaging.core.remoting.impl.amqp.AMQPMinaAcceptorFactory</factory-class>
+ <params>
+ <param key="jbm.remoting.mina.host" value="localhost" type="String"/>
+ <param key="jbm.remoting.mina.port" value="5672" type="Integer"/>
+ <param key="jbm.remoting.mina.tcpnodelay" value="true" type="Boolean"/>
+ <param key="jbm.remoting.mina.tcpsendbuffersize" value="32768" type="Integer"/>
+ <param key="jbm.remoting.mina.tcpreceivebuffersize" value="32768" type="Integer"/>
+ <param key="jbm.remoting.mina.sslenabled" value="false" type="Boolean"/>
+ </params>
+ </acceptor>
<!-- Netty SSL Acceptor
<acceptor>
<factory-class>org.jboss.messaging.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
Modified: branches/amqp_integration/src/config/log4j.xml
===================================================================
--- branches/amqp_integration/src/config/log4j.xml 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/config/log4j.xml 2008-10-14 15:01:09 UTC (rev 5110)
@@ -7,7 +7,7 @@
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
- <param name="Threshold" value="INFO"/>
+ <param name="Threshold" value="TRACE"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
</layout>
@@ -37,7 +37,7 @@
</appender>
<category name="org.jboss">
- <priority value="INFO"/>
+ <priority value="TRACE"/>
</category>
<root>
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQChannelException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQChannelException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQChannelException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,72 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq;
+
+import org.jboss.messaging.amq.framing.*;
+import org.jboss.messaging.amq.protocol.AMQConstant;
+
+/**
+ * AMQChannelException indicates that an error that requires the channel to be closed has occurred.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents an error that rquires the channel to be closed.
+ * </table>
+ *
+ * @todo Does this duplicate AMQChannelClosedException?
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQChannelException extends AMQException
+{
+ private final int _classId;
+
+ private final int _methodId;
+
+ /* AMQP version for which exception ocurred */
+ private final byte major;
+
+ private final byte minor;
+
+ public AMQChannelException(AMQConstant errorCode,
+ String msg,
+ int classId,
+ int methodId,
+ byte major,
+ byte minor,
+ Throwable cause)
+ {
+ super(errorCode, msg, cause);
+ _classId = classId;
+ _methodId = methodId;
+ this.major = major;
+ this.minor = minor;
+ }
+
+ public AMQFrame getCloseFrame(int channel)
+ {
+ MethodRegistry reg = MethodRegistry.getMethodRegistry(new ProtocolVersion(major, minor));
+ // FIXME return new AMQFrame(channel, reg.createChannelCloseBody(getErrorCode() == null ?
+ // AMQConstant.INTERNAL_ERROR.getCode() : getErrorCode().getCode(), new
+ // AMQShortString(getMessage()),_classId,_methodId));
+ return new AMQFrame(channel, null);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQConnectionException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQConnectionException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQConnectionException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,76 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq;
+
+
+import org.jboss.messaging.amq.framing.*;
+import org.jboss.messaging.amq.protocol.AMQConstant;
+
+/**
+ * AMQConnectionException indicates that an error that requires the channel to be closed has occurred.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents an error that rquires the channel to be closed.
+ * </table>
+ *
+ * @todo Does this duplicate AMQChannelClosedException?
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQConnectionException extends AMQException
+{
+ private final int _classId;
+ private final int _methodId;
+
+ /** AMQP version for which exception ocurred, major code. */
+ private final byte major;
+
+ /** AMQP version for which exception ocurred, minor code. */
+ private final byte minor;
+
+ boolean _closeConnetion;
+
+ public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor,
+ Throwable cause)
+ {
+ super(errorCode, msg, cause);
+ _classId = classId;
+ _methodId = methodId;
+ this.major = major;
+ this.minor = minor;
+ }
+
+ public AMQFrame getCloseFrame(int channel)
+ {
+ MethodRegistry reg = MethodRegistry.getMethodRegistry(new ProtocolVersion(major,minor));
+ return new AMQFrame(channel, null);
+
+ // FIXME
+ /*
+ reg.createConnectionCloseBody(getErrorCode().getCode(),
+ new AMQShortString(getMessage()),
+ _classId,
+ _methodId));
+ */
+
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,92 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq;
+
+import org.jboss.messaging.amq.protocol.AMQConstant;
+
+/**
+ * AMQException forms the root exception of all exceptions relating to the AMQ protocol. It provides space to associate
+ * a required AMQ error code with the exception, which is a numeric value, with a meaning defined by the protocol.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents an exception condition associated with an AMQ protocol status code.
+ * </table>
+ *
+ * @todo This exception class is also used as a generic exception throughout Qpid code. This usage may not be strictly
+ * correct if this is to signify a protocol exception. Should review.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQException extends Exception
+{
+ /** Holds the AMQ error code constant associated with this exception. */
+ private AMQConstant _errorCode;
+
+ /**
+ * Creates an exception with an optional error code, optional message and optional underlying cause.
+ *
+ * @param errorCode The error code. May be null if not to be set.
+ * @param msg The exception message. May be null if not to be set.
+ * @param cause The underlying cause of the exception. May be null if not to be set.
+ */
+ public AMQException(AMQConstant errorCode, String msg, Throwable cause)
+ {
+ super(((msg == null) ? "" : msg) + ((errorCode == null) ? "" : (" [error code " + errorCode + "]")), cause);
+ _errorCode = errorCode;
+ }
+
+ /*
+ * Deprecated constructors brought from M2.1
+ */
+ @Deprecated
+ public AMQException(String msg)
+ {
+ this(null, (msg == null) ? "" : msg);
+ }
+
+ @Deprecated
+ public AMQException(AMQConstant errorCode, String msg)
+ {
+ this(errorCode, (msg == null) ? "" : msg, null);
+ }
+
+ @Deprecated
+ public AMQException(String msg, Throwable cause)
+ {
+ this(null, msg, cause);
+ }
+
+ /**
+ * Gets the AMQ protocol exception code associated with this exception.
+ *
+ * @return The AMQ protocol exception code associated with this exception.
+ */
+ public AMQConstant getErrorCode()
+ {
+ return _errorCode;
+ }
+
+ public boolean isHardError()
+ {
+ return true;
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQMessage.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQMessage.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQMessage.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.amq;
+
+import org.jboss.messaging.amq.framing.ContentHeaderProperties;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A AMQMessage
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface AMQMessage
+{
+ SimpleString getExchange();
+
+ boolean isImmediate();
+
+ boolean isMandatory();
+
+ SimpleString getRoutingKey();
+
+ void setHeader(ContentHeaderProperties properties);
+
+ ContentHeaderProperties getHeader();
+
+ boolean addPayload(MessagingBuffer payload, int size);
+
+ void setBodySize(long bodySize);
+
+ long getBodySize();
+
+ ServerMessage toCoreMessage();
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQPInvalidClassException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQPInvalidClassException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/AMQPInvalidClassException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq;
+
+/**
+ * AMQPInvalidClassException indicates an error when trying to store an illegally typed argument in a field table.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents illegal argument type for field table values.
+ * </table>
+ *
+ * @todo Could just re-use an exising exception like IllegalArgumentException or ClassCastException.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQPInvalidClassException extends RuntimeException
+{
+ public AMQPInvalidClassException(String s)
+ {
+ super(s);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQCodecFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQCodecFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQCodecFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.codec;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+
+
+/**
+ * AMQCodecFactory is a Mina codec factory. It supplies the encoders and decoders need to read and write the bytes to
+ * the wire.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations.
+ * <tr><td> Supply the protocol encoder. <td> {@link AMQEncoder}
+ * <tr><td> Supply the protocol decoder. <td> {@link AMQDecoder}
+ * </table>
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQCodecFactory implements ProtocolCodecFactory
+{
+ /** Holds the protocol encoder. */
+ private final AMQEncoder _encoder = new AMQEncoder();
+
+ /** Holds the protocol decoder. */
+ private final AMQDecoder _frameDecoder;
+
+ /**
+ * Creates a new codec factory, specifiying whether it is expected that the first frame of data should be an
+ * initiation. This is the case for the broker, which always expects to received the protocol initiation on a newly
+ * connected client.
+ *
+ * @param expectProtocolInitiation <tt>true</tt> if the first frame received is going to be a protocol initiation
+ * frame, <tt>false</tt> if it is going to be a standard AMQ data block.
+ */
+ public AMQCodecFactory(boolean expectProtocolInitiation)
+ {
+ _frameDecoder = new AMQDecoder(expectProtocolInitiation);
+ }
+
+ /**
+ * Gets the AMQP encoder.
+ *
+ * @return The AMQP encoder.
+ */
+ public ProtocolEncoder getEncoder(IoSession session)
+ {
+ return _encoder;
+ }
+
+ /**
+ * Gets the AMQP decoder.
+ *
+ * @return The AMQP decoder.
+ */
+ public ProtocolDecoder getDecoder(IoSession session)
+ {
+ return _frameDecoder;
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQDecoder.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQDecoder.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQDecoder.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,278 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.codec;
+
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.jboss.messaging.amq.framing.AMQDataBlockDecoder;
+import org.jboss.messaging.amq.framing.ProtocolInitiation;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.amqp.IoBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * AMQDecoder delegates the decoding of AMQP either to a data block decoder, or in the case of new connections, to a
+ * protocol initiation decoder. It is a cumulative decoder, which means that it can accumulate data to decode in the
+ * buffer until there is enough data to decode.
+ *
+ * <p/>One instance of this class is created per session, so any changes or configuration done at run time to the
+ * decoder will only affect decoding of the protocol session data to which is it bound.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Delegate protocol initiation to its decoder. <td> {@link ProtocolInitiation.Decoder}
+ * <tr><td> Delegate AMQP data to its decoder. <td> {@link AMQDataBlockDecoder}
+ * <tr><td> Accept notification that protocol initiation has completed.
+ * </table>
+ *
+ * @todo If protocol initiation decoder not needed, then don't create it. Probably not a big deal, but it adds to the
+ * per-session overhead.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQDecoder implements ProtocolDecoder
+{
+
+ private static final Logger log = Logger.getLogger(AMQDecoder.class);
+
+ private static final String BUFFER = AMQDecoder.class.getName() + ".Buffer";
+
+ /** Holds the 'normal' AMQP data decoder. */
+ private AMQDataBlockDecoder _dataBlockDecoder = new AMQDataBlockDecoder();
+
+ /** Holds the protocol initiation decoder. */
+ private ProtocolInitiation.Decoder _piDecoder = new ProtocolInitiation.Decoder();
+
+ /** Flag to indicate whether this decoder needs to handle protocol initiation. */
+ private boolean _expectProtocolInitiation;
+
+ private boolean firstDecode = true;
+
+ /**
+ * Creates a new AMQP decoder.
+ *
+ * @param expectProtocolInitiation <tt>true</tt> if this decoder needs to handle protocol initiation.
+ */
+ public AMQDecoder(boolean expectProtocolInitiation)
+ {
+ _expectProtocolInitiation = expectProtocolInitiation;
+ }
+
+ /**
+ * Delegates decoding AMQP from the data buffer that Mina has retrieved from the wire, to the data or protocol
+ * intiation decoders.
+ *
+ * @param session The Mina session.
+ * @param in The raw byte buffer.
+ * @param out The Mina object output gatherer to write decoded objects to.
+ *
+ * @return <tt>true</tt> if the data was decoded, <tt>false<tt> if more is needed and the data should accumulate.
+ *
+ * @throws Exception If the data cannot be decoded for any reason.
+ */
+ public boolean doDecode(IoSession session, MessagingBuffer in, ProtocolDecoderOutput out) throws Exception
+ {
+ boolean decoded;
+ if (_expectProtocolInitiation || (firstDecode && (in.remaining() > 0) && (in.getByte(in.position()) == (byte)'A')))
+ {
+ decoded = doDecodePI(session, in, out);
+ if (decoded)
+ {
+ _expectProtocolInitiation = false;
+ }
+ }
+ else
+ {
+ decoded = doDecodeDataBlock(session, in, out);
+ }
+ if (firstDecode && decoded)
+ {
+ firstDecode = false;
+ }
+
+ return decoded;
+ }
+
+ /**
+ * Decodes AMQP data, delegating the decoding to an {@link AMQDataBlockDecoder}.
+ *
+ * @param session The Mina session.
+ * @param in The raw byte buffer.
+ * @param out The Mina object output gatherer to write decoded objects to.
+ *
+ * @return <tt>true</tt> if the data was decoded, <tt>false<tt> if more is needed and the data should accumulate.
+ *
+ * @throws Exception If the data cannot be decoded for any reason.
+ */
+ protected boolean doDecodeDataBlock(IoSession session, MessagingBuffer in, ProtocolDecoderOutput out) throws Exception
+ {
+ int pos = in.position();
+ boolean enoughData = _dataBlockDecoder.decodable(session, in);
+ in.position(pos);
+ if (!enoughData)
+ {
+ // returning false means it will leave the contents in the buffer and
+ // call us again when more data has been read
+ return false;
+ }
+ else
+ {
+ _dataBlockDecoder.decode(session, in, out);
+
+ return true;
+ }
+ }
+
+ /**
+ * Decodes an AMQP initiation, delegating the decoding to a {@link ProtocolInitiation.Decoder}.
+ *
+ * @param session The Mina session.
+ * @param in The raw byte buffer.
+ * @param out The Mina object output gatherer to write decoded objects to.
+ *
+ * @return <tt>true</tt> if the data was decoded, <tt>false<tt> if more is needed and the data should accumulate.
+ *
+ * @throws Exception If the data cannot be decoded for any reason.
+ */
+ private boolean doDecodePI(IoSession session, MessagingBuffer in, ProtocolDecoderOutput out) throws Exception
+ {
+ boolean enoughData = _piDecoder.decodable(session, in);
+ if (!enoughData)
+ {
+ // returning false means it will leave the contents in the buffer and
+ // call us again when more data has been read
+ return false;
+ }
+ else
+ {
+ _piDecoder.decode(session, in, out);
+
+ return true;
+ }
+ }
+
+ /**
+ * Sets the protocol initation flag, that determines whether decoding is handled by the data decoder of the protocol
+ * initation decoder. This method is expected to be called with <tt>false</tt> once protocol initation completes.
+ *
+ * @param expectProtocolInitiation <tt>true</tt> to use the protocol initiation decoder, <tt>false</tt> to use the
+ * data decoder.
+ */
+ public void setExpectProtocolInitiation(boolean expectProtocolInitiation)
+ {
+ _expectProtocolInitiation = expectProtocolInitiation;
+ }
+
+ /**
+ * Cumulates content of <tt>in</tt> into internal buffer and forwards
+ * decoding request to {@link #doDecode(IoSession, ByteBuffer, ProtocolDecoderOutput)}.
+ * <tt>doDecode()</tt> is invoked repeatedly until it returns <tt>false</tt>
+ * and the cumulative buffer is compacted after decoding ends.
+ *
+ * @throws IllegalStateException if your <tt>doDecode()</tt> returned
+ * <tt>true</tt> not consuming the cumulative buffer.
+ */
+ public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
+ {
+ IoBuffer buf = (IoBuffer)session.getAttribute(BUFFER);
+ // if we have a session buffer, append data to that otherwise
+ // use the buffer read from the network directly
+ if (buf != null)
+ {
+ buf.put(in);
+ buf.flip();
+ }
+ else
+ {
+ buf = in;
+ }
+ MessagingBuffer buffer = new IoBufferWrapper(buf);
+
+ for (;;)
+ {
+ int oldPos = buf.position();
+ boolean decoded = doDecode(session, buffer, out);
+ if (decoded)
+ {
+ if (buf.position() == oldPos)
+ {
+ throw new IllegalStateException("doDecode() can't return true when buffer is not consumed.");
+ }
+
+ if (!(buffer.remaining() > 0))
+ {
+ break;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // if there is any data left that cannot be decoded, we store
+ // it in a buffer in the session and next time this decoder is
+ // invoked the session buffer gets appended to
+ if (buf.remaining() > 0)
+ {
+ storeRemainingInSession(buf, session);
+ }
+ else
+ {
+ removeSessionBuffer(session);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.mina.filter.codec.ProtocolDecoder#finishDecode(org.apache.mina.core.session.IoSession, org.apache.mina.filter.codec.ProtocolDecoderOutput)
+ */
+ public void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dispose(IoSession session) throws Exception
+ {
+ removeSessionBuffer(session);
+ }
+
+ private void removeSessionBuffer(IoSession session)
+ {
+ IoBuffer buf = (IoBuffer)session.getAttribute(BUFFER);
+ if (buf != null)
+ {
+ session.removeAttribute(BUFFER);
+ }
+ }
+
+ private void storeRemainingInSession(IoBuffer buf, IoSession session)
+ {
+ IoBuffer remainingBuf = IoBuffer.allocate(buf.remaining(), false);
+ remainingBuf.setAutoExpand(true);
+ remainingBuf.put(buf);
+ session.setAttribute(BUFFER, remainingBuf);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQEncoder.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQEncoder.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQEncoder.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,68 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.codec;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.jboss.messaging.amq.framing.AMQDataBlockEncoder;
+
+/**
+ * AMQEncoder delegates encoding of AMQP to a data encoder.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Delegate AMQP encoding. <td> {@link AMQDataBlockEncoder}
+ * </table>
+ *
+ * @todo This class just delegates to another, so seems to be pointless. Unless it is going to handle some
+ * responsibilities in the future, then drop it.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQEncoder implements ProtocolEncoder
+{
+ /** The data encoder that is delegated to. */
+ private AMQDataBlockEncoder _dataBlockEncoder = new AMQDataBlockEncoder();
+
+ /**
+ * Encodes AMQP.
+ *
+ * @param session The Mina session.
+ * @param message The data object to encode.
+ * @param out The Mina writer to output the raw byte data to.
+ *
+ * @throws Exception If the data cannot be encoded for any reason.
+ */
+ public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception
+ {
+ _dataBlockEncoder.encode(session, message, out);
+ }
+
+ /**
+ * Does nothing. Called by Mina to allow this to clean up resources when it is no longer needed.
+ *
+ * @param session The Mina session.
+ */
+ public void dispose(IoSession session)
+ {
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQProtocolCodecFilter.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQProtocolCodecFilter.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/codec/AMQProtocolCodecFilter.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,259 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.jboss.messaging.amq.codec;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.IoFilter;
+import org.apache.mina.core.filterchain.IoFilterChain;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderException;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.jboss.messaging.core.logging.Logger;
+
+
+/**
+ * A AMQProtocolCodecFilter
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQProtocolCodecFilter extends CumulativeProtocolDecoder
+implements ProtocolEncoder, ProtocolCodecFactory
+{
+ private static final Logger log = Logger.getLogger(AMQProtocolCodecFilter.class);
+
+ public static final String ENCODER = AMQProtocolCodecFilter.class.getName() + ".encoder";
+ public static final String DECODER = AMQProtocolCodecFilter.class.getName() + ".decoder";
+
+ private static final Class[] EMPTY_PARAMS = new Class[0];
+ private static final IoBuffer EMPTY_BUFFER = IoBuffer.wrap( new byte[0] );
+
+ private final ProtocolCodecFactory factory;
+
+ public AMQProtocolCodecFilter( ProtocolCodecFactory factory )
+ {
+ if( factory == null )
+ {
+ throw new NullPointerException( "factory" );
+ }
+ this.factory = factory;
+ }
+
+ public AMQProtocolCodecFilter( final ProtocolEncoder encoder, final ProtocolDecoder decoder )
+ {
+ if( encoder == null )
+ {
+ throw new NullPointerException( "encoder" );
+ }
+ if( decoder == null )
+ {
+ throw new NullPointerException( "decoder" );
+ }
+
+ this.factory = new ProtocolCodecFactory()
+ {
+ public ProtocolEncoder getEncoder(IoSession session)
+ {
+ return encoder;
+ }
+
+ public ProtocolDecoder getDecoder(IoSession session)
+ {
+ return decoder;
+ }
+ };
+ }
+
+ public AMQProtocolCodecFilter( final Class encoderClass, final Class decoderClass )
+ {
+ if( encoderClass == null )
+ {
+ throw new NullPointerException( "encoderClass" );
+ }
+ if( decoderClass == null )
+ {
+ throw new NullPointerException( "decoderClass" );
+ }
+ if( !ProtocolEncoder.class.isAssignableFrom( encoderClass ) )
+ {
+ throw new IllegalArgumentException( "encoderClass: " + encoderClass.getName() );
+ }
+ if( !ProtocolDecoder.class.isAssignableFrom( decoderClass ) )
+ {
+ throw new IllegalArgumentException( "decoderClass: " + decoderClass.getName() );
+ }
+ try
+ {
+ encoderClass.getConstructor( EMPTY_PARAMS );
+ }
+ catch( NoSuchMethodException e )
+ {
+ throw new IllegalArgumentException( "encoderClass doesn't have a public default constructor." );
+ }
+ try
+ {
+ decoderClass.getConstructor( EMPTY_PARAMS );
+ }
+ catch( NoSuchMethodException e )
+ {
+ throw new IllegalArgumentException( "decoderClass doesn't have a public default constructor." );
+ }
+
+ this.factory = new ProtocolCodecFactory()
+ {
+ public ProtocolEncoder getEncoder(IoSession session) throws Exception
+ {
+ return ( ProtocolEncoder ) encoderClass.newInstance();
+ }
+
+ public ProtocolDecoder getDecoder(IoSession session) throws Exception
+ {
+ return ( ProtocolDecoder ) decoderClass.newInstance();
+ }
+ };
+ }
+
+ public void onPreAdd( IoFilterChain parent, String name, IoFilter.NextFilter nextFilter ) throws Exception
+ {
+ if( parent.contains( ProtocolCodecFilter.class ) )
+ {
+ throw new IllegalStateException( "A filter chain cannot contain more than one QpidProtocolCodecFilter." );
+ }
+ }
+
+ @Override
+ protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
+ {
+ ProtocolDecoder decoder = getDecoder( session );
+
+ try
+ {
+ decoder.decode( session, in, out );
+ return true;
+ }
+ catch( Throwable t )
+ {
+ ProtocolDecoderException pde;
+ if( t instanceof ProtocolDecoderException )
+ {
+ pde = ( ProtocolDecoderException ) t;
+ }
+ else
+ {
+ pde = new ProtocolDecoderException( t );
+ }
+ pde.setHexdump( in.getHexDump() );
+ throw pde;
+ }
+ finally
+ {
+ // Dispose the decoder if this session is connectionless.
+ if( session.getTransportMetadata().isConnectionless() )
+ {
+ disposeDecoder( session );
+ }
+
+ // Release the read buffer.
+ in.reset();
+
+ out.flush();
+ }
+ }
+
+
+ public ProtocolEncoder getEncoder( IoSession session ) throws Exception
+ {
+ ProtocolEncoder encoder = ( ProtocolEncoder ) session.getAttribute( ENCODER );
+ if( encoder == null )
+ {
+ encoder = factory.getEncoder(session);
+ session.setAttribute( ENCODER, encoder );
+ }
+ return encoder;
+ }
+
+ public ProtocolDecoder getDecoder( IoSession session ) throws Exception
+ {
+ ProtocolDecoder decoder = ( ProtocolDecoder ) session.getAttribute( DECODER );
+ if( decoder == null )
+ {
+ decoder = factory.getDecoder(session);
+ session.setAttribute( DECODER, decoder );
+ }
+ return decoder;
+ }
+
+
+ private void disposeEncoder( IoSession session )
+ {
+ ProtocolEncoder encoder = ( ProtocolEncoder ) session.removeAttribute( ENCODER );
+ if( encoder == null )
+ {
+ return;
+ }
+
+ try
+ {
+ encoder.dispose( session );
+ }
+ catch( Throwable t )
+ {
+ log.warn(
+ "Failed to dispose: " + encoder.getClass().getName() +
+ " (" + encoder + ')' );
+ }
+ }
+
+ private void disposeDecoder( IoSession session )
+ {
+ ProtocolDecoder decoder = ( ProtocolDecoder ) session.removeAttribute( DECODER );
+ if( decoder == null )
+ {
+ return;
+ }
+
+ try
+ {
+ decoder.dispose( session );
+ }
+ catch( Throwable t )
+ {
+ log.warn(
+ "Falied to dispose: " + decoder.getClass().getName() +
+ " (" + decoder + ')' );
+ }
+ }
+
+
+ public void encode(final IoSession session, final Object message,
+ final ProtocolEncoderOutput out) throws Exception
+ {
+ System.out.println("QpidProtocolCodecFilter.encode()");
+ out.write(message);
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/exchange/ExchangeDefaults.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/exchange/ExchangeDefaults.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/exchange/ExchangeDefaults.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,67 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.exchange;
+
+import org.jboss.messaging.amq.framing.AMQShortString;
+
+/**
+ * Defines the names of the standard AMQP exchanges that every AMQP broker should provide. These exchange names
+ * and type are given in the specification.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Defines the standard AMQP exchange names.
+ * <tr><td> Defines the standard AMQP exchange types.
+ * </table>
+ *
+ * @todo A type safe enum, might be more appropriate for the exchange types.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class ExchangeDefaults
+{
+ /** The default direct exchange, which is a special internal exchange that cannot be explicitly bound to. */
+ public static final AMQShortString DEFAULT_EXCHANGE_NAME = new AMQShortString("<<default>>");
+
+ /** The pre-defined topic exchange, the broker SHOULD provide this. */
+ public static final AMQShortString TOPIC_EXCHANGE_NAME = new AMQShortString("amq.topic");
+
+ /** Defines the identifying type name of topic exchanges. */
+ public static final AMQShortString TOPIC_EXCHANGE_CLASS = new AMQShortString("topic");
+
+ /** The pre-defined direct exchange, the broker MUST provide this. */
+ public static final AMQShortString DIRECT_EXCHANGE_NAME = new AMQShortString("amq.direct");
+
+ /** Defines the identifying type name of direct exchanges. */
+ public static final AMQShortString DIRECT_EXCHANGE_CLASS = new AMQShortString("direct");
+
+ /** The pre-defined headers exchange, the specification does not say this needs to be provided. */
+ public static final AMQShortString HEADERS_EXCHANGE_NAME = new AMQShortString("amq.match");
+
+ /** Defines the identifying type name of headers exchanges. */
+ public static final AMQShortString HEADERS_EXCHANGE_CLASS = new AMQShortString("headers");
+
+ /** The pre-defined fanout exchange, the boker MUST provide this. */
+ public static final AMQShortString FANOUT_EXCHANGE_NAME = new AMQShortString("amq.fanout");
+
+ /** Defines the identifying type name of fanout exchanges. */
+ public static final AMQShortString FANOUT_EXCHANGE_CLASS = new AMQShortString("fanout");
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public interface AMQBody
+{
+ public byte getFrameType();
+
+ /**
+ * Get the size of the body
+ * @return unsigned short
+ */
+ public abstract int getSize();
+
+ public void writePayload(MessagingBuffer buffer);
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlock.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlock.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlock.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,65 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.impl.amqp.IoBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A data block represents something that has a size in bytes and the ability to
+ * write itself to a byte buffer (similar to a byte array).
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public abstract class AMQDataBlock implements EncodableAMQDataBlock
+{
+ /**
+ * Get the size of buffer needed to store the byte representation of this
+ * frame.
+ * @return unsigned integer
+ */
+ public abstract long getSize();
+
+ /**
+ * Writes the datablock to the specified buffer.
+ * @param buffer
+ */
+ public abstract void writePayload(MessagingBuffer buffer);
+
+ public IoBuffer toIoBuffer()
+ {
+ final IoBuffer buffer = IoBuffer.allocate((int)getSize());
+ final MessagingBuffer b = new IoBufferWrapper(buffer);
+ writePayload(b);
+ buffer.flip();
+ return buffer;
+ }
+
+ public java.nio.ByteBuffer toNioByteBuffer()
+ {
+ final java.nio.ByteBuffer buffer = java.nio.ByteBuffer.allocate((int)getSize());
+
+ final MessagingBuffer buf = new ByteBufferWrapper(buffer);
+ writePayload(buf);
+ buffer.flip();
+ return buffer;
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockDecoder.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockDecoder.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockDecoder.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,121 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A AMQDataBlockDecoder
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQDataBlockDecoder
+{
+ private static final String SESSION_METHOD_BODY_FACTORY = "QPID_SESSION_METHOD_BODY_FACTORY";
+
+ private static final BodyFactory[] _bodiesSupported = new BodyFactory[Byte.MAX_VALUE];
+
+ static
+ {
+ _bodiesSupported[ContentHeaderBody.TYPE] = ContentHeaderBodyFactory.getInstance();
+ _bodiesSupported[ContentBody.TYPE] = ContentBodyFactory.getInstance();
+ _bodiesSupported[HeartbeatBody.TYPE] = new HeartbeatBodyFactory();
+ }
+
+ private static final Logger log = Logger.getLogger(AMQDataBlockDecoder.class);
+
+ public AMQDataBlockDecoder()
+ {
+ }
+
+ public boolean decodable(final IoSession session, final MessagingBuffer in) throws AMQFrameDecodingException
+ {
+ final int remainingAfterAttributes = in.remaining() - (1 + 2 + 4 + 1);
+ // type, channel, body length and end byte
+ if (remainingAfterAttributes < 0)
+ {
+ return false;
+ }
+
+ in.skip(1 + 2);
+ final long bodySize = in.getUnsignedInt();
+ return (remainingAfterAttributes >= bodySize);
+
+ }
+
+ protected Object createAndPopulateFrame(final IoSession session, final MessagingBuffer in) throws AMQFrameDecodingException,
+ AMQProtocolVersionException
+ {
+ final byte type = in.getByte();
+
+ BodyFactory bodyFactory;
+ if (type == AMQMethodBody.TYPE)
+ {
+ bodyFactory = null;
+ if (bodyFactory == null)
+ {
+ bodyFactory = new AMQMethodBodyFactory();
+ }
+
+ }
+ else
+ {
+ bodyFactory = _bodiesSupported[type];
+ }
+
+ if (bodyFactory == null)
+ {
+ throw new AMQFrameDecodingException(null, "Unsupported frame type: " + type, null);
+ }
+
+ final int channel = in.getUnsignedShort();
+ final long bodySize = in.getUnsignedInt();
+
+ // bodySize can be zero
+ if ((channel < 0) || (bodySize < 0))
+ {
+ throw new AMQFrameDecodingException(null, "Undecodable frame: type = " + type +
+ " channel = " +
+ channel +
+ " bodySize = " +
+ bodySize, null);
+ }
+
+ AMQFrame frame = new AMQFrame(in, channel, bodySize, bodyFactory);
+
+ byte marker = in.getByte();
+ if ((marker & 0xFF) != 0xCE)
+ {
+ throw new AMQFrameDecodingException(null, "End of frame marker not found. Read " + marker +
+ " length=" +
+ bodySize +
+ " type=" +
+ type, null);
+ }
+
+ return frame;
+ }
+
+ public void decode(final IoSession session, final MessagingBuffer in, final ProtocolDecoderOutput out) throws Exception
+ {
+ out.write(createAndPopulateFrame(session, in));
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockEncoder.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockEncoder.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQDataBlockEncoder.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,65 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.jboss.messaging.core.logging.Logger;
+
+/**
+ * A AMQDataBlockEncoder
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public final class AMQDataBlockEncoder
+{
+ private static final Logger _logger = Logger.getLogger(AMQDataBlockEncoder.class);
+
+ private final Set _messageTypes = Collections.singleton(EncodableAMQDataBlock.class);
+
+ public AMQDataBlockEncoder()
+ {
+ }
+
+ public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception
+ {
+ final AMQDataBlock frame = (AMQDataBlock)message;
+
+ final IoBuffer buffer = frame.toIoBuffer();
+
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Encoded frame byte-buffer is '" + EncodingUtils.convertToHexString(buffer.array()) + "'");
+ }
+
+ out.write(buffer);
+ }
+
+ public Set getMessageTypes()
+ {
+ return _messageTypes;
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrame.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrame.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrame.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,137 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A AMQFrame
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class AMQFrame extends AMQDataBlock implements EncodableAMQDataBlock
+{
+ private final int _channel;
+
+ private final AMQBody _bodyFrame;
+
+ public static final byte FRAME_END_BYTE = (byte)0xCE;
+
+ public AMQFrame(final int channel, final AMQBody bodyFrame)
+ {
+ _channel = channel;
+ _bodyFrame = bodyFrame;
+ }
+
+ public AMQFrame(final MessagingBuffer in, final int channel, final long bodySize, final BodyFactory bodyFactory) throws AMQFrameDecodingException
+ {
+ _channel = channel;
+ _bodyFrame = bodyFactory.createBody(in, bodySize);
+ }
+
+ @Override
+ public long getSize()
+ {
+ return 1 + 2 + 4 + _bodyFrame.getSize() + 1;
+ }
+
+ public static final int getFrameOverhead()
+ {
+ return 1 + 2 + 4 + 1;
+ }
+
+ @Override
+ public void writePayload(final MessagingBuffer buffer)
+ {
+ buffer.putByte(_bodyFrame.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, _channel);
+ EncodingUtils.writeUnsignedInteger(buffer, _bodyFrame.getSize());
+ _bodyFrame.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+ }
+
+ public final int getChannel()
+ {
+ return _channel;
+ }
+
+ public final AMQBody getBodyFrame()
+ {
+ return _bodyFrame;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Frame channelId: " + _channel + ", bodyFrame: " + String.valueOf(_bodyFrame);
+ }
+
+ public static void writeFrame(final MessagingBuffer buffer, final int channel, final AMQBody body)
+ {
+ buffer.putByte(body.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, channel);
+ EncodingUtils.writeUnsignedInteger(buffer, body.getSize());
+ body.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+
+ }
+
+ public static void writeFrames(final MessagingBuffer buffer,
+ final int channel,
+ final AMQBody body1,
+ final AMQBody body2)
+ {
+ buffer.putByte(body1.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, channel);
+ EncodingUtils.writeUnsignedInteger(buffer, body1.getSize());
+ body1.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+ buffer.putByte(body2.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, channel);
+ EncodingUtils.writeUnsignedInteger(buffer, body2.getSize());
+ body2.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+
+ }
+
+ public static void writeFrames(final MessagingBuffer buffer,
+ final int channel,
+ final AMQBody body1,
+ final AMQBody body2,
+ final AMQBody body3)
+ {
+ buffer.putByte(body1.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, channel);
+ EncodingUtils.writeUnsignedInteger(buffer, body1.getSize());
+ body1.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+ buffer.putByte(body2.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, channel);
+ EncodingUtils.writeUnsignedInteger(buffer, body2.getSize());
+ body2.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+ buffer.putByte(body3.getFrameType());
+ EncodingUtils.writeUnsignedShort(buffer, channel);
+ EncodingUtils.writeUnsignedInteger(buffer, body3.getSize());
+ body3.writePayload(buffer);
+ buffer.putByte(FRAME_END_BYTE);
+
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrameDecodingException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrameDecodingException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQFrameDecodingException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.amq.AMQException;
+import org.jboss.messaging.amq.protocol.AMQConstant;
+
+/**
+ * AMQFrameDecodingException indicates that an AMQP frame cannot be decoded because it does not have the correct
+ * format as defined by the protocol.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents a format error in a protocol frame.
+ * </table>
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQFrameDecodingException extends AMQException
+{
+ public AMQFrameDecodingException(AMQConstant errorCode, String message, Throwable cause)
+ {
+ super(errorCode, message, cause);
+ }
+
+ public AMQFrameDecodingException(AMQConstant errorCode, String message)
+ {
+ super(errorCode, message, null);
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,77 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.amq.AMQChannelException;
+import org.jboss.messaging.amq.AMQConnectionException;
+import org.jboss.messaging.amq.protocol.AMQConstant;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A AMQMethodBody
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface AMQMethodBody extends AMQBody
+{
+ public static final byte TYPE = 1;
+
+ /** AMQP version */
+ public byte getMajor();
+
+ public byte getMinor();
+
+ /** @return unsigned short */
+ public int getClazz();
+
+ /** @return unsigned short */
+ public int getMethod();
+
+ public void writeMethodPayload(MessagingBuffer buffer);
+
+ public int getSize();
+
+ public void writePayload(MessagingBuffer buffer);
+
+ // public abstract void populateMethodBodyFromBuffer(ByteBuffer buffer)
+ // throws AMQFrameDecodingException;
+
+ // public void populateFromBuffer(ByteBuffer buffer, long size) throws
+ // AMQFrameDecodingException;
+
+ public AMQFrame generateFrame(int channelId);
+
+ public String toString();
+
+ /**
+ * Convenience Method to create a channel not found exception
+ *
+ * @param channelId The channel id that is not found
+ *
+ * @return new AMQChannelException
+ */
+ public AMQChannelException getChannelNotFoundException(int channelId);
+
+ public AMQChannelException getChannelException(AMQConstant code, String message);
+
+ public AMQChannelException getChannelException(AMQConstant code, String message, Throwable cause);
+
+ public AMQConnectionException getConnectionException(AMQConstant code, String message);
+
+ public AMQConnectionException getConnectionException(AMQConstant code, String message, Throwable cause);
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A AMQMethodBodyFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQMethodBodyFactory implements BodyFactory
+{
+ private static final Logger log = Logger.getLogger(AMQMethodBodyFactory.class);
+
+ public AMQMethodBodyFactory()
+ {
+ }
+
+ public AMQBody createBody(MessagingBuffer in, long bodySize) throws AMQFrameDecodingException
+ {
+ return MethodRegistry.registry_0_9.convertToBody(in, bodySize);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.amq.AMQChannelException;
+import org.jboss.messaging.amq.AMQConnectionException;
+import org.jboss.messaging.amq.protocol.AMQConstant;
+
+/**
+ * A AMQMethodBodyImpl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public abstract class AMQMethodBodyImpl implements AMQMethodBody
+{
+ public static final byte TYPE = 1;
+
+ public AMQMethodBodyImpl()
+ {
+ }
+
+ public byte getFrameType()
+ {
+ return TYPE;
+ }
+
+ /** unsigned short */
+ abstract protected int getBodySize();
+
+ public AMQFrame generateFrame(int channelId)
+ {
+ return new AMQFrame(channelId, this);
+ }
+
+ /**
+ * Creates an AMQChannelException for the corresponding body type (a channel exception should include the class and
+ * method ids of the body it resulted from).
+ */
+
+ /**
+ * Convenience Method to create a channel not found exception
+ *
+ * @param channelId The channel id that is not found
+ *
+ * @return new AMQChannelException
+ */
+ public AMQChannelException getChannelNotFoundException(int channelId)
+ {
+ return getChannelException(AMQConstant.NOT_FOUND, "Channel not found for id:" + channelId);
+ }
+
+ public AMQChannelException getChannelException(AMQConstant code, String message)
+ {
+ return new AMQChannelException(code, message, getClazz(), getMethod(), getMajor(), getMinor(), null);
+ }
+
+ public AMQChannelException getChannelException(AMQConstant code, String message, Throwable cause)
+ {
+ return new AMQChannelException(code, message, getClazz(), getMethod(), getMajor(), getMinor(), cause);
+ }
+
+ public AMQConnectionException getConnectionException(AMQConstant code, String message)
+ {
+ return new AMQConnectionException(code, message, getClazz(), getMethod(), getMajor(), getMinor(), null);
+ }
+
+ public AMQConnectionException getConnectionException(AMQConstant code, String message, Throwable cause)
+ {
+ return new AMQConnectionException(code, message, getClazz(), getMethod(), getMajor(), getMinor(), cause);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyInstanceFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyInstanceFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodBodyInstanceFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+
+/**
+ * A AMQMethodBodyInstanceFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public abstract interface AMQMethodBodyInstanceFactory
+{
+ public AMQMethodBody newInstance(MessagingBuffer buffer, long size) throws AMQFrameDecodingException;
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQMethodFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,94 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.jboss.messaging.amq.framing;
+
+/**
+ * A AMQMethodFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface AMQMethodFactory
+{
+
+ // Connection Methods
+
+ ConnectionCloseBody createConnectionClose();
+
+ // Access Methods
+
+ AccessRequestBody createAccessRequest(boolean active, boolean exclusive, boolean passive, boolean read, AMQShortString realm, boolean write);
+
+
+ // Tx Methods
+
+ TxSelectBody createTxSelect();
+
+ TxCommitBody createTxCommit();
+
+ TxRollbackBody createTxRollback();
+
+ // Channel Methods
+
+ ChannelOpenBody createChannelOpen();
+
+ ChannelCloseBody createChannelClose(int replyCode, AMQShortString replyText);
+
+ ChannelFlowBody createChannelFlow(boolean active);
+
+
+ // Exchange Methods
+
+
+ ExchangeBoundBody createExchangeBound(AMQShortString exchangeName,
+ AMQShortString queueName,
+ AMQShortString routingKey);
+
+ ExchangeDeclareBody createExchangeDeclare(AMQShortString name, AMQShortString type, int ticket);
+
+
+ // Queue Methods
+
+ QueueDeclareBody createQueueDeclare(AMQShortString name, FieldTable arguments, boolean autoDelete, boolean durable, boolean exclusive, boolean passive, int ticket);
+
+ QueueBindBody createQueueBind(AMQShortString queueName, AMQShortString exchangeName, AMQShortString routingKey, FieldTable arguments, int ticket);
+
+ QueueDeleteBody createQueueDelete(AMQShortString queueName, boolean ifEmpty, boolean ifUnused, int ticket);
+
+
+ // Message Methods
+
+ // In different versions of the protocol we change the class used for message transfer
+ // abstract this out so the appropriate methods are created
+ AMQMethodBody createRecover(boolean requeue);
+
+ AMQMethodBody createConsumer(AMQShortString tag, AMQShortString queueName, FieldTable arguments, boolean noAck, boolean exclusive, boolean noLocal, int ticket);
+
+ AMQMethodBody createConsumerCancel(AMQShortString consumerTag);
+
+ AMQMethodBody createAcknowledge(long deliveryTag, boolean multiple);
+
+ AMQMethodBody createRejectBody(long deliveryTag, boolean requeue);
+
+ AMQMethodBody createMessageQos(int prefetchCount, int prefetchSize);
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolClassException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolClassException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolClassException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+/**
+ * AMQProtocolInstanceException indicates that the protocol class is incorrect in a header.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent incorrect protocol class in frame header.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQProtocolClassException extends AMQProtocolHeaderException
+{
+ public AMQProtocolClassException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolHeaderException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolHeaderException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolHeaderException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.amq.AMQException;
+
+/**
+ * AMQProtocolHeaderException indicates a format error in an AMQP frame header.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent format error in frame header.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQProtocolHeaderException extends AMQException
+{
+ public AMQProtocolHeaderException(String message, Throwable cause)
+ {
+ super(null, message, cause);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolInstanceException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolInstanceException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolInstanceException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+/**
+ * AMQProtocolInstanceException indicates that the protocol instance is incorrect in a header.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent incorrect protocol instance in frame header.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQProtocolInstanceException extends AMQProtocolHeaderException
+{
+ public AMQProtocolInstanceException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolVersionException.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolVersionException.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQProtocolVersionException.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,41 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+/**
+ * AMQProtocolInstanceException indicates that the client and server differ on expected protocol version in a header.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent incorrect protocol version in frame header.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQProtocolVersionException extends AMQProtocolHeaderException
+{
+ public AMQProtocolVersionException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortString.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortString.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortString.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,751 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A short string is a representation of an AMQ Short String
+ * Short strings differ from the Java String class by being limited to on ASCII characters (0-127)
+ * and thus can be held more effectively in a byte buffer.
+ *
+ *@author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public final class AMQShortString implements CharSequence, Comparable<AMQShortString>
+{
+ private static final byte MINUS = (byte)'-';
+
+ private static final byte ZERO = (byte)'0';
+
+ private final class TokenizerImpl implements AMQShortStringTokenizer
+ {
+ private final byte _delim;
+
+ private int _count = -1;
+
+ private int _pos = 0;
+
+ public TokenizerImpl(final byte delim)
+ {
+ _delim = delim;
+ }
+
+ public int countTokens()
+ {
+ if (_count == -1)
+ {
+ _count = 1 + AMQShortString.this.occurences(_delim);
+ }
+ return _count;
+ }
+
+ public AMQShortString nextToken()
+ {
+ if (_pos <= AMQShortString.this.length())
+ {
+ int nextDelim = AMQShortString.this.indexOf(_delim, _pos);
+ if (nextDelim == -1)
+ {
+ nextDelim = AMQShortString.this.length();
+ }
+
+ AMQShortString nextToken = AMQShortString.this.substring(_pos, nextDelim++);
+ _pos = nextDelim;
+ return nextToken;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public boolean hasMoreTokens()
+ {
+ return _pos <= AMQShortString.this.length();
+ }
+ }
+
+ private AMQShortString substring(final int from, final int to)
+ {
+ return new AMQShortString(_data, from + _offset, to + _offset);
+ }
+
+ private static final ThreadLocal<Map<AMQShortString, WeakReference<AMQShortString>>> _localInternMap = new ThreadLocal<Map<AMQShortString, WeakReference<AMQShortString>>>()
+ {
+ protected Map<AMQShortString, WeakReference<AMQShortString>> initialValue()
+ {
+ return new WeakHashMap<AMQShortString, WeakReference<AMQShortString>>();
+ };
+ };
+
+ private static final Map<AMQShortString, WeakReference<AMQShortString>> _globalInternMap = new WeakHashMap<AMQShortString, WeakReference<AMQShortString>>();
+
+ private static final Logger _logger = Logger.getLogger(AMQShortString.class);
+
+ private final byte[] _data;
+
+ private final int _offset;
+
+ private int _hashCode;
+
+ private String _asString = null;
+
+ private final int _length;
+
+ private static final char[] EMPTY_CHAR_ARRAY = new char[0];
+
+ public static final AMQShortString EMPTY_STRING = new AMQShortString((String)null);
+
+ public AMQShortString(byte[] data)
+ {
+
+ _data = data.clone();
+ _length = data.length;
+ _offset = 0;
+ }
+
+ public AMQShortString(byte[] data, int pos)
+ {
+ final int size = data[pos++];
+ final byte[] dataCopy = new byte[size];
+ System.arraycopy(data, pos, dataCopy, 0, size);
+ _length = size;
+ _data = dataCopy;
+ _offset = 0;
+ }
+
+ public AMQShortString(String data)
+ {
+ this((data == null) ? EMPTY_CHAR_ARRAY : data.toCharArray());
+ _asString = data;
+ }
+
+ public AMQShortString(char[] data)
+ {
+ if (data == null)
+ {
+ throw new NullPointerException("Cannot create AMQShortString with null char[]");
+ }
+
+ final int length = data.length;
+ final byte[] stringBytes = new byte[length];
+ int hash = 0;
+ for (int i = 0; i < length; i++)
+ {
+ stringBytes[i] = (byte)(0xFF & data[i]);
+ hash = (31 * hash) + stringBytes[i];
+ }
+ _hashCode = hash;
+ _data = stringBytes;
+
+ _length = length;
+ _offset = 0;
+
+ }
+
+ public AMQShortString(CharSequence charSequence)
+ {
+ final int length = charSequence.length();
+ final byte[] stringBytes = new byte[length];
+ int hash = 0;
+ for (int i = 0; i < length; i++)
+ {
+ stringBytes[i] = ((byte)(0xFF & charSequence.charAt(i)));
+ hash = (31 * hash) + stringBytes[i];
+
+ }
+
+ _data = stringBytes;
+ _hashCode = hash;
+ _length = length;
+ _offset = 0;
+
+ }
+
+ private AMQShortString(MessagingBuffer data, final int length)
+ {
+ byte[] dataBytes = new byte[length];
+ data.getBytes(dataBytes);
+ _data = dataBytes;
+ _offset = 0;
+ _length = length;
+
+ }
+
+ private AMQShortString(final byte[] data, final int from, final int to)
+ {
+ _offset = from;
+ _length = to - from;
+ _data = data;
+ }
+
+ public AMQShortString shrink()
+ {
+ if (_data.length != _length)
+ {
+ byte[] dataBytes = new byte[_length];
+ System.arraycopy(_data, _offset, dataBytes, 0, _length);
+ return new AMQShortString(dataBytes, 0, _length);
+ }
+ else
+ {
+ return this;
+ }
+ }
+
+ /**
+ * Get the length of the short string
+ * @return length of the underlying byte array
+ */
+ public int length()
+ {
+ return _length;
+ }
+
+ public char charAt(int index)
+ {
+
+ return (char)_data[_offset + index];
+
+ }
+
+ public CharSequence subSequence(int start, int end)
+ {
+ return new CharSubSequence(start, end);
+ }
+
+ public int writeToByteArray(byte[] encoding, int pos)
+ {
+ final int size = length();
+ encoding[pos++] = (byte)size;
+ System.arraycopy(_data, _offset, encoding, pos, size);
+ return pos + size;
+ }
+
+ public static AMQShortString readFromByteArray(byte[] byteEncodedDestination, int pos)
+ {
+
+ final AMQShortString shortString = new AMQShortString(byteEncodedDestination, pos);
+ if (shortString.length() == 0)
+ {
+ return null;
+ }
+ else
+ {
+ return shortString;
+ }
+ }
+
+ public static AMQShortString readFromBuffer(MessagingBuffer buffer)
+ {
+ final int length = buffer.getUnsignedByte();
+ if (length == 0)
+ {
+ return null;
+ }
+ else
+ {
+
+ return new AMQShortString(buffer, length);
+ }
+ }
+
+ public byte[] getBytes()
+ {
+ if (_offset == 0 && _length == _data.length)
+ {
+ return _data.clone();
+ }
+ else
+ {
+ byte[] data = new byte[_length];
+ System.arraycopy(_data, _offset, data, 0, _length);
+ return data;
+ }
+ }
+
+ public void writeToBuffer(MessagingBuffer buffer)
+ {
+
+ final int size = length();
+ // buffer.setAutoExpand(true);
+ buffer.putByte((byte)size);
+ buffer.putBytes(_data, _offset, size);
+
+ }
+
+ public boolean endsWith(String s)
+ {
+ return endsWith(new AMQShortString(s));
+ }
+
+ public boolean endsWith(AMQShortString otherString)
+ {
+
+ if (otherString.length() > length())
+ {
+ return false;
+ }
+
+ int thisLength = length();
+ int otherLength = otherString.length();
+
+ for (int i = 1; i <= otherLength; i++)
+ {
+ if (charAt(thisLength - i) != otherString.charAt(otherLength - i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean startsWith(String s)
+ {
+ return startsWith(new AMQShortString(s));
+ }
+
+ public boolean startsWith(AMQShortString otherString)
+ {
+
+ if (otherString.length() > length())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < otherString.length(); i++)
+ {
+ if (charAt(i) != otherString.charAt(i))
+ {
+ return false;
+ }
+ }
+
+ return true;
+
+ }
+
+ public boolean startsWith(CharSequence otherString)
+ {
+ if (otherString.length() > length())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < otherString.length(); i++)
+ {
+ if (charAt(i) != otherString.charAt(i))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private final class CharSubSequence implements CharSequence
+ {
+ private final int _sequenceOffset;
+
+ private final int _end;
+
+ public CharSubSequence(final int offset, final int end)
+ {
+ _sequenceOffset = offset;
+ _end = end;
+ }
+
+ public int length()
+ {
+ return _end - _sequenceOffset;
+ }
+
+ public char charAt(int index)
+ {
+ return AMQShortString.this.charAt(index + _sequenceOffset);
+ }
+
+ public CharSequence subSequence(int start, int end)
+ {
+ return new CharSubSequence(start + _sequenceOffset, end + _sequenceOffset);
+ }
+ }
+
+ public char[] asChars()
+ {
+ final int size = length();
+ final char[] chars = new char[size];
+
+ for (int i = 0; i < size; i++)
+ {
+ chars[i] = (char)_data[i + _offset];
+ }
+
+ return chars;
+ }
+
+ public String asString()
+ {
+ if (_asString == null)
+ {
+ _asString = new String(asChars());
+ }
+ return _asString;
+ }
+
+ public boolean equals(Object o)
+ {
+
+ if (o instanceof AMQShortString)
+ {
+ return equals((AMQShortString)o);
+ }
+ if (o instanceof CharSequence)
+ {
+ return equals((CharSequence)o);
+ }
+
+ if (o == null)
+ {
+ return false;
+ }
+
+ if (o == this)
+ {
+ return true;
+ }
+
+ return false;
+
+ }
+
+ public boolean equals(final AMQShortString otherString)
+ {
+ if (otherString == this)
+ {
+ return true;
+ }
+
+ if (otherString == null)
+ {
+ return false;
+ }
+
+ final int hashCode = _hashCode;
+
+ final int otherHashCode = otherString._hashCode;
+
+ if ((hashCode != 0) && (otherHashCode != 0) && (hashCode != otherHashCode))
+ {
+ return false;
+ }
+
+ final int length = _length;
+
+ if (length != otherString._length)
+ {
+ return false;
+ }
+
+ final byte[] data = _data;
+
+ final byte[] otherData = otherString._data;
+
+ final int offset = _offset;
+
+ final int otherOffset = otherString._offset;
+
+ if (offset == 0 && otherOffset == 0 && length == data.length && length == otherData.length)
+ {
+ return Arrays.equals(data, otherData);
+ }
+ else
+ {
+ int thisIdx = offset;
+ int otherIdx = otherOffset;
+ for (int i = length; i-- != 0;)
+ {
+ if (!(data[thisIdx++] == otherData[otherIdx++]))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+
+ }
+
+ public boolean equals(CharSequence s)
+ {
+ if (s instanceof AMQShortString)
+ {
+ return equals((AMQShortString)s);
+ }
+
+ if (s == null)
+ {
+ return false;
+ }
+
+ if (s.length() != length())
+ {
+ return false;
+ }
+
+ for (int i = 0; i < length(); i++)
+ {
+ if (charAt(i) != s.charAt(i))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int hash = _hashCode;
+ if (hash == 0)
+ {
+ final int size = length();
+
+ for (int i = 0; i < size; i++)
+ {
+ hash = (31 * hash) + _data[i + _offset];
+ }
+
+ _hashCode = hash;
+ }
+
+ return hash;
+ }
+
+ public void setDirty()
+ {
+ _hashCode = 0;
+ }
+
+ public String toString()
+ {
+ return asString();
+ }
+
+ public int compareTo(AMQShortString name)
+ {
+ if (name == null)
+ {
+ return 1;
+ }
+ else
+ {
+
+ if (name.length() < length())
+ {
+ return -name.compareTo(this);
+ }
+
+ for (int i = 0; i < length(); i++)
+ {
+ final byte d = _data[i + _offset];
+ final byte n = name._data[i + name._offset];
+ if (d < n)
+ {
+ return -1;
+ }
+
+ if (d > n)
+ {
+ return 1;
+ }
+ }
+
+ return (length() == name.length()) ? 0 : -1;
+ }
+ }
+
+ public AMQShortStringTokenizer tokenize(byte delim)
+ {
+ return new TokenizerImpl(delim);
+ }
+
+ public AMQShortString intern()
+ {
+
+ hashCode();
+
+ Map<AMQShortString, WeakReference<AMQShortString>> localMap = _localInternMap.get();
+
+ WeakReference<AMQShortString> ref = localMap.get(this);
+ AMQShortString internString;
+
+ if (ref != null)
+ {
+ internString = ref.get();
+ if (internString != null)
+ {
+ return internString;
+ }
+ }
+
+ synchronized (_globalInternMap)
+ {
+
+ ref = _globalInternMap.get(this);
+ if ((ref == null) || ((internString = ref.get()) == null))
+ {
+ internString = shrink();
+ ref = new WeakReference(internString);
+ _globalInternMap.put(internString, ref);
+ }
+
+ }
+ localMap.put(internString, ref);
+ return internString;
+
+ }
+
+ private int occurences(final byte delim)
+ {
+ int count = 0;
+ final int end = _offset + _length;
+ for (int i = _offset; i < end; i++)
+ {
+ if (_data[i] == delim)
+ {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ private int indexOf(final byte val, final int pos)
+ {
+
+ for (int i = pos; i < length(); i++)
+ {
+ if (_data[_offset + i] == val)
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public static AMQShortString join(final Collection<AMQShortString> terms, final AMQShortString delim)
+ {
+ if (terms.size() == 0)
+ {
+ return EMPTY_STRING;
+ }
+
+ int size = delim.length() * (terms.size() - 1);
+ for (AMQShortString term : terms)
+ {
+ size += term.length();
+ }
+
+ byte[] data = new byte[size];
+ int pos = 0;
+ final byte[] delimData = delim._data;
+ final int delimOffset = delim._offset;
+ final int delimLength = delim._length;
+
+ for (AMQShortString term : terms)
+ {
+
+ if (pos != 0)
+ {
+ System.arraycopy(delimData, delimOffset, data, pos, delimLength);
+ pos += delimLength;
+ }
+ System.arraycopy(term._data, term._offset, data, pos, term._length);
+ pos += term._length;
+ }
+
+ return new AMQShortString(data, 0, size);
+ }
+
+ public int toIntValue()
+ {
+ int pos = _offset;
+ int val = 0;
+
+ boolean isNegative = (_data[pos] == MINUS);
+ if (isNegative)
+ {
+ pos++;
+ }
+
+ final int end = _length + _offset;
+
+ while (pos < end)
+ {
+ int digit = (int)(_data[pos++] - ZERO);
+ if ((digit < 0) || (digit > 9))
+ {
+ throw new NumberFormatException("\"" + toString() + "\" is not a valid number");
+ }
+ val = val * 10;
+ val += digit;
+ }
+ if (isNegative)
+ {
+ val = val * -1;
+ }
+ return val;
+ }
+
+ public boolean contains(final byte b)
+ {
+ final int end = _length + _offset;
+ for (int i = _offset; i < end; i++)
+ {
+ if (_data[i] == b)
+ {
+ return true;
+ }
+ }
+ return false; // To change body of created methods use File | Settings | File Templates.
+ }
+
+ public static void main(String args[])
+ {
+ AMQShortString s = new AMQShortString("a.b.c.d.e.f.g.h.i.j.k");
+ AMQShortString s2 = s.substring(2, 7);
+
+ AMQShortStringTokenizer t = s2.tokenize((byte)'.');
+ while (t.hasMoreTokens())
+ {
+ System.err.println(t.nextToken());
+ }
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortStringTokenizer.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortStringTokenizer.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQShortStringTokenizer.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,36 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.jboss.messaging.amq.framing;
+
+/**
+ * A AMQShortStringTokenizer
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface AMQShortStringTokenizer
+{
+ int countTokens();
+
+ AMQShortString nextToken();
+
+ boolean hasMoreTokens();
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQType.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQType.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQType.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,820 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import java.math.BigDecimal;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * AMQType is a type that represents the different possible AMQP field table types. It provides operations for each
+ * of the types to perform tasks such as calculating the size of an instance of the type, converting types between AMQP
+ * and Java native types, and reading and writing instances of AMQP types in binary formats to and from byte buffers.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Get the equivalent one byte identifier for a type.
+ * <tr><td> Calculate the size of an instance of an AMQP parameter type. <td> {@link EncodingUtils}
+ * <tr><td> Convert an instance of an AMQP parameter into a compatable Java object tagged with its AMQP type.
+ * <td> {@link AMQTypedValue}
+ * <tr><td> Write an instance of an AMQP parameter type to a byte buffer. <td> {@link EncodingUtils}
+ * <tr><td> Read an instance of an AMQP parameter from a byte buffer. <td> {@link EncodingUtils}
+ * </table>
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public enum AMQType
+{
+ LONG_STRING('S')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedLongStringLength((String)value);
+ }
+
+ public String toNativeValue(Object value)
+ {
+ if (value != null)
+ {
+ return value.toString();
+ }
+ else
+ {
+ throw new NullPointerException("Cannot convert: null to String.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeLongStringBytes(buffer, (String)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readLongString(buffer);
+ }
+ },
+
+ INTEGER('i')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.unsignedIntegerLength();
+ }
+
+ public Long toNativeValue(Object value)
+ {
+ if (value instanceof Long)
+ {
+ return (Long)value;
+ }
+ else if (value instanceof Integer)
+ {
+ return ((Integer)value).longValue();
+ }
+ else if (value instanceof Short)
+ {
+ return ((Short)value).longValue();
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).longValue();
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Long.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName() + ") to int.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeUnsignedInteger(buffer, (Long)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readUnsignedInteger(buffer);
+ }
+ },
+
+ DECIMAL('D')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedByteLength() + EncodingUtils.encodedIntegerLength();
+ }
+
+ public Object toNativeValue(Object value)
+ {
+ if (value instanceof BigDecimal)
+ {
+ return (BigDecimal)value;
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to BigDecimal.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ BigDecimal bd = (BigDecimal)value;
+
+ byte places = new Integer(bd.scale()).byteValue();
+
+ int unscaled = bd.intValue();
+
+ EncodingUtils.writeByte(buffer, places);
+
+ EncodingUtils.writeInteger(buffer, unscaled);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ byte places = EncodingUtils.readByte(buffer);
+
+ int unscaled = EncodingUtils.readInteger(buffer);
+
+ BigDecimal bd = new BigDecimal(unscaled);
+
+ return bd.setScale(places);
+ }
+ },
+
+ TIMESTAMP('T')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedLongLength();
+ }
+
+ public Object toNativeValue(Object value)
+ {
+ if (value instanceof Long)
+ {
+ return (Long)value;
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to timestamp.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeLong(buffer, (Long)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readLong(buffer);
+ }
+ },
+
+ /**
+ * Implements the field table type. The native value of a field table type will be an instance of
+ * {@link FieldTable}, which itself may contain name/value pairs encoded as {@link AMQTypedValue}s.
+ */
+ FIELD_TABLE('F')
+ {
+ /**
+ * Calculates the size of an instance of the type in bytes.
+ *
+ * @param value An instance of the type.
+ *
+ * @return The size of the instance of the type in bytes.
+ */
+ public int getEncodingSize(Object value)
+ {
+ // Ensure that the value is a FieldTable.
+ if (!(value instanceof FieldTable))
+ {
+ throw new IllegalArgumentException("Value is not a FieldTable.");
+ }
+
+ FieldTable ftValue = (FieldTable)value;
+
+ // Loop over all name/value pairs adding up size of each. FieldTable itself keeps track of its encoded
+ // size as entries are added, so no need to loop over all explicitly.
+ // EncodingUtils calculation of the encoded field table lenth, will include 4 bytes for its 'size' field.
+ return EncodingUtils.encodedFieldTableLength(ftValue);
+ }
+
+ /**
+ * Converts an instance of the type to an equivalent Java native representation.
+ *
+ * @param value An instance of the type.
+ *
+ * @return An equivalent Java native representation.
+ */
+ public Object toNativeValue(Object value)
+ {
+ // Ensure that the value is a FieldTable.
+ if (!(value instanceof FieldTable))
+ {
+ throw new IllegalArgumentException("Value is not a FieldTable.");
+ }
+
+ return (FieldTable)value;
+ }
+
+ /**
+ * Writes an instance of the type to a specified byte buffer.
+ *
+ * @param value An instance of the type.
+ * @param buffer The byte buffer to write it to.
+ */
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ // Ensure that the value is a FieldTable.
+ if (!(value instanceof FieldTable))
+ {
+ throw new IllegalArgumentException("Value is not a FieldTable.");
+ }
+
+ FieldTable ftValue = (FieldTable)value;
+
+ // Loop over all name/values writing out into buffer.
+ ftValue.writeToBuffer(buffer);
+ }
+
+ /**
+ * Reads an instance of the type from a specified byte buffer.
+ *
+ * @param buffer The byte buffer to write it to.
+ *
+ * @return An instance of the type.
+ */
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ try
+ {
+ // Read size of field table then all name/value pairs.
+ return EncodingUtils.readFieldTable(buffer);
+ }
+ catch (AMQFrameDecodingException e)
+ {
+ throw new IllegalArgumentException("Unable to read field table from buffer.", e);
+ }
+ }
+ },
+
+ VOID('V')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return 0;
+ }
+
+ public Object toNativeValue(Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to null String.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return null;
+ }
+ },
+
+ BINARY('x')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedLongstrLength((byte[])value);
+ }
+
+ public Object toNativeValue(Object value)
+ {
+ if ((value instanceof byte[]) || (value == null))
+ {
+ return value;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Value: " + value +
+ " (" +
+ value.getClass().getName() +
+ ") cannot be converted to byte[]");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeLongstr(buffer, (byte[])value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readLongstr(buffer);
+ }
+ },
+
+ ASCII_STRING('c')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedLongStringLength((String)value);
+ }
+
+ public String toNativeValue(Object value)
+ {
+ if (value != null)
+ {
+ return value.toString();
+ }
+ else
+ {
+ throw new NullPointerException("Cannot convert: null to String.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeLongStringBytes(buffer, (String)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readLongString(buffer);
+ }
+ },
+
+ WIDE_STRING('C')
+ {
+ public int getEncodingSize(Object value)
+ {
+ // FIXME: use proper charset encoder
+ return EncodingUtils.encodedLongStringLength((String)value);
+ }
+
+ public String toNativeValue(Object value)
+ {
+ if (value != null)
+ {
+ return value.toString();
+ }
+ else
+ {
+ throw new NullPointerException("Cannot convert: null to String.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeLongStringBytes(buffer, (String)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readLongString(buffer);
+ }
+ },
+
+ BOOLEAN('t')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedBooleanLength();
+ }
+
+ public Object toNativeValue(Object value)
+ {
+ if (value instanceof Boolean)
+ {
+ return (Boolean)value;
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Boolean.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to boolean.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeBoolean(buffer, (Boolean)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readBoolean(buffer);
+ }
+ },
+
+ ASCII_CHARACTER('k')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedCharLength();
+ }
+
+ public Character toNativeValue(Object value)
+ {
+ if (value instanceof Character)
+ {
+ return (Character)value;
+ }
+ else if (value == null)
+ {
+ throw new NullPointerException("Cannot convert null into char");
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to char.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeChar(buffer, (Character)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readChar(buffer);
+ }
+ },
+
+ BYTE('b')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedByteLength();
+ }
+
+ public Byte toNativeValue(Object value)
+ {
+ if (value instanceof Byte)
+ {
+ return (Byte)value;
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Byte.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to byte.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeByte(buffer, (Byte)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readByte(buffer);
+ }
+ },
+
+ SHORT('s')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedShortLength();
+ }
+
+ public Short toNativeValue(Object value)
+ {
+ if (value instanceof Short)
+ {
+ return (Short)value;
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).shortValue();
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Short.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to short.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeShort(buffer, (Short)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readShort(buffer);
+ }
+ },
+
+ INT('I')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedIntegerLength();
+ }
+
+ public Integer toNativeValue(Object value)
+ {
+ if (value instanceof Integer)
+ {
+ return (Integer)value;
+ }
+ else if (value instanceof Short)
+ {
+ return ((Short)value).intValue();
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).intValue();
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Integer.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value + "(" + value.getClass().getName() + ") to int.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeInteger(buffer, (Integer)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readInteger(buffer);
+ }
+ },
+
+ LONG('l')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedLongLength();
+ }
+
+ public Object toNativeValue(Object value)
+ {
+ if (value instanceof Long)
+ {
+ return (Long)value;
+ }
+ else if (value instanceof Integer)
+ {
+ return ((Integer)value).longValue();
+ }
+ else if (value instanceof Short)
+ {
+ return ((Short)value).longValue();
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).longValue();
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Long.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to long.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeLong(buffer, (Long)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readLong(buffer);
+ }
+ },
+
+ FLOAT('f')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedFloatLength();
+ }
+
+ public Float toNativeValue(Object value)
+ {
+ if (value instanceof Float)
+ {
+ return (Float)value;
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Float.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to float.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeFloat(buffer, (Float)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readFloat(buffer);
+ }
+ },
+
+ DOUBLE('d')
+ {
+ public int getEncodingSize(Object value)
+ {
+ return EncodingUtils.encodedDoubleLength();
+ }
+
+ public Double toNativeValue(Object value)
+ {
+ if (value instanceof Double)
+ {
+ return (Double)value;
+ }
+ else if (value instanceof Float)
+ {
+ return ((Float)value).doubleValue();
+ }
+ else if ((value instanceof String) || (value == null))
+ {
+ return Double.valueOf((String)value);
+ }
+ else
+ {
+ throw new NumberFormatException("Cannot convert: " + value +
+ "(" +
+ value.getClass().getName() +
+ ") to double.");
+ }
+ }
+
+ public void writeValueImpl(Object value, MessagingBuffer buffer)
+ {
+ EncodingUtils.writeDouble(buffer, (Double)value);
+ }
+
+ public Object readValueFromBuffer(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readDouble(buffer);
+ }
+ };
+
+ /** Holds the defined one byte identifier for the type. */
+ private final byte _identifier;
+
+ /**
+ * Creates an instance of an AMQP type from its defined one byte identifier.
+ *
+ * @param identifier The one byte identifier for the type.
+ */
+ AMQType(char identifier)
+ {
+ _identifier = (byte)identifier;
+ }
+
+ /**
+ * Extracts the byte identifier for the typ.
+ *
+ * @return The byte identifier for the typ.
+ */
+ public final byte identifier()
+ {
+ return _identifier;
+ }
+
+ /**
+ * Calculates the size of an instance of the type in bytes.
+ *
+ * @param value An instance of the type.
+ *
+ * @return The size of the instance of the type in bytes.
+ */
+ public abstract int getEncodingSize(Object value);
+
+ /**
+ * Converts an instance of the type to an equivalent Java native representation.
+ *
+ * @param value An instance of the type.
+ *
+ * @return An equivalent Java native representation.
+ */
+ public abstract Object toNativeValue(Object value);
+
+ /**
+ * Converts an instance of the type to an equivalent Java native representation, packaged as an
+ * {@link AMQTypedValue} tagged with its AMQP type.
+ *
+ * @param value An instance of the type.
+ *
+ * @return An equivalent Java native representation, tagged with its AMQP type.
+ */
+ public AMQTypedValue asTypedValue(Object value)
+ {
+ return new AMQTypedValue(this, toNativeValue(value));
+ }
+
+ /**
+ * Writes an instance of the type to a specified byte buffer, preceded by its one byte identifier. As the type and
+ * value are both written, this provides a fully encoded description of a parameters type and value.
+ *
+ * @param value An instance of the type.
+ * @param buffer The byte buffer to write it to.
+ */
+ public void writeToBuffer(Object value, MessagingBuffer buffer)
+ {
+ buffer.putByte(identifier());
+ writeValueImpl(value, buffer);
+ }
+
+ /**
+ * Writes an instance of the type to a specified byte buffer.
+ *
+ * @param value An instance of the type.
+ * @param buffer The byte buffer to write it to.
+ */
+ abstract void writeValueImpl(Object value, MessagingBuffer buffer);
+
+ /**
+ * Reads an instance of the type from a specified byte buffer.
+ *
+ * @param buffer The byte buffer to write it to.
+ *
+ * @return An instance of the type.
+ */
+ abstract Object readValueFromBuffer(MessagingBuffer buffer);
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypeMap.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypeMap.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypeMap.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A AMQTypeMap
+ *
+ * @author @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQTypeMap
+{
+ public static Map<Byte, AMQType> _reverseTypeMap = new HashMap<Byte, AMQType>();
+
+ static
+ {
+ for(AMQType type : AMQType.values())
+ {
+ _reverseTypeMap.put(type.identifier(), type);
+ }
+ }
+
+ public static AMQType getType(Byte identifier)
+ {
+ AMQType result = _reverseTypeMap.get(identifier);
+ if (result == null) {
+ throw new IllegalArgumentException
+ ("no such type code: " + Integer.toHexString(identifier.intValue()));
+ }
+ return result;
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypedValue.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypedValue.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AMQTypedValue.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,117 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * AMQTypedValue combines together a native Java Object value, and an {@link AMQType}, as a fully typed AMQP parameter
+ * value. It provides the ability to read and write fully typed parameters to and from byte buffers. It also provides
+ * the ability to create such parameters from Java native value and a type tag or to extract the native value and type
+ * from one.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Create a fully typed AMQP value from a native type and a type tag. <td> {@link AMQType}
+ * <tr><td> Create a fully typed AMQP value from a binary representation in a byte buffer. <td> {@link AMQType}
+ * <tr><td> Write a fully typed AMQP value to a binary representation in a byte buffer. <td> {@link AMQType}
+ * <tr><td> Extract the type from a fully typed AMQP value.
+ * <tr><td> Extract the value from a fully typed AMQP value.
+ * </table>
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQTypedValue
+{
+ /** The type of the value. */
+ private final AMQType _type;
+
+ /** The Java native representation of the AMQP typed value. */
+ private final Object _value;
+
+ public AMQTypedValue(AMQType type, Object value)
+ {
+ if (type == null)
+ {
+ throw new NullPointerException("Cannot create a typed value with null type");
+ }
+
+ _type = type;
+ _value = type.toNativeValue(value);
+ }
+
+ private AMQTypedValue(AMQType type, MessagingBuffer buffer)
+ {
+ _type = type;
+ _value = type.readValueFromBuffer(buffer);
+ }
+
+ public AMQType getType()
+ {
+ return _type;
+ }
+
+ public Object getValue()
+ {
+ return _value;
+ }
+
+ public void writeToBuffer(MessagingBuffer buffer)
+ {
+ _type.writeToBuffer(_value, buffer);
+ }
+
+ public int getEncodingSize()
+ {
+ return _type.getEncodingSize(_value);
+ }
+
+ public static AMQTypedValue readFromBuffer(MessagingBuffer buffer)
+ {
+ AMQType type = AMQTypeMap.getType(buffer.getByte());
+
+ return new AMQTypedValue(type, buffer);
+ }
+
+ public String toString()
+ {
+ return "[" + getType() + ": " + getValue() + "]";
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o instanceof AMQTypedValue)
+ {
+ AMQTypedValue other = (AMQTypedValue)o;
+ return _type == other._type && (_value == null ? other._value == null : _value.equals(other._value));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ return _type.hashCode() ^ (_value == null ? 0 : _value.hashCode());
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,46 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+package org.jboss.messaging.amq.framing;
+
+public interface AccessRequestBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+ public boolean getActive();
+
+ public boolean getExclusive();
+
+ public boolean getPassive();
+
+ public boolean getRead();
+
+ public AMQShortString getRealm();
+
+ public boolean getWrite();
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/AccessRequestOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+package org.jboss.messaging.amq.framing;
+
+public interface AccessRequestOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+ public int getTicket();
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicAckBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicAckBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicAckBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,44 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicAckBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getDeliveryTag();
+
+ public boolean getMultiple();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicCancelBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getConsumerTag();
+
+ public boolean getNowait();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicCancelOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicCancelOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getConsumerTag();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,61 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicConsumeBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getArguments();
+
+ public AMQShortString getConsumerTag();
+
+ public boolean getExclusive();
+
+ public boolean getNoAck();
+
+ public boolean getNoLocal();
+
+ public boolean getNowait();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicConsumeOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicConsumeOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getConsumerTag();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicContentHeaderProperties.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicContentHeaderProperties.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicContentHeaderProperties.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,839 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A BasicContentHeaderProperties
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class BasicContentHeaderProperties implements CommonContentHeaderProperties
+{
+ private static final Logger _logger = Logger.getLogger(BasicContentHeaderProperties.class);
+
+ private static final AMQShortString ZERO_STRING = null;
+
+ /**
+ * We store the encoded form when we decode the content header so that if we need to write it out without modifying
+ * it we can do so without incurring the expense of reencoding it
+ */
+ private byte[] _encodedForm;
+
+ /** Flag indicating whether the entire content header has been decoded yet */
+ private boolean _decoded = true;
+
+ /**
+ * We have some optimisations for partial decoding for maximum performance. The headers are used in the broker for
+ * routing in some cases so we can decode that separately.
+ */
+ private boolean _decodedHeaders = true;
+
+ /**
+ * We have some optimisations for partial decoding for maximum performance. The content type is used by all clients
+ * to determine the message type
+ */
+ private boolean _decodedContentType = true;
+
+ private AMQShortString _contentType;
+
+ private AMQShortString _encoding;
+
+ private FieldTable _headers;
+
+ private byte _deliveryMode;
+
+ private byte _priority;
+
+ private AMQShortString _correlationId;
+
+ private AMQShortString _replyTo;
+
+ private long _expiration;
+
+ private AMQShortString _messageId;
+
+ private long _timestamp;
+
+ private AMQShortString _type;
+
+ private AMQShortString _userId;
+
+ private AMQShortString _appId;
+
+ private AMQShortString _clusterId;
+
+ private int _propertyFlags = 0;
+ private static final int CONTENT_TYPE_MASK = 1 << 15;
+ private static final int ENCONDING_MASK = 1 << 14;
+ private static final int HEADERS_MASK = 1 << 13;
+ private static final int DELIVERY_MODE_MASK = 1 << 12;
+ private static final int PROPRITY_MASK = 1 << 11;
+ private static final int CORRELATION_ID_MASK = 1 << 10;
+ private static final int REPLY_TO_MASK = 1 << 9;
+ private static final int EXPIRATION_MASK = 1 << 8;
+ private static final int MESSAGE_ID_MASK = 1 << 7;
+ private static final int TIMESTAMP_MASK = 1 << 6;
+ private static final int TYPE_MASK = 1 << 5;
+ private static final int USER_ID_MASK = 1 << 4;
+ private static final int APPLICATION_ID_MASK = 1 << 3;
+ private static final int CLUSTER_ID_MASK = 1 << 2;
+
+
+ /**
+ * This is 0_10 specific. We use this property to check if some message properties have been changed.
+ */
+ private boolean _hasBeenUpdated = false;
+
+ public boolean reset()
+ {
+ boolean result = _hasBeenUpdated;
+ _hasBeenUpdated = false;
+ return result;
+ }
+
+ public void updated()
+ {
+ _hasBeenUpdated = true;
+ }
+
+ public BasicContentHeaderProperties()
+ { }
+
+ public int getPropertyListSize()
+ {
+ if (_encodedForm != null)
+ {
+ return _encodedForm.length;
+ }
+ else
+ {
+ int size = 0;
+
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_contentType);
+ }
+
+ if ((_propertyFlags & ENCONDING_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_encoding);
+ }
+
+ if ((_propertyFlags & HEADERS_MASK) > 0)
+ {
+ size += EncodingUtils.encodedFieldTableLength(_headers);
+ }
+
+ if ((_propertyFlags & DELIVERY_MODE_MASK) > 0)
+ {
+ size += 1;
+ }
+
+ if ((_propertyFlags & PROPRITY_MASK) > 0)
+ {
+ size += 1;
+ }
+
+ if ((_propertyFlags & CORRELATION_ID_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_correlationId);
+ }
+
+ if ((_propertyFlags & REPLY_TO_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_replyTo);
+ }
+
+ if ((_propertyFlags & EXPIRATION_MASK) > 0)
+ {
+ if (_expiration == 0L)
+ {
+ size += EncodingUtils.encodedShortStringLength(ZERO_STRING);
+ }
+ else
+ {
+ size += EncodingUtils.encodedShortStringLength(_expiration);
+ }
+ }
+
+ if ((_propertyFlags & MESSAGE_ID_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_messageId);
+ }
+
+ if ((_propertyFlags & TIMESTAMP_MASK) > 0)
+ {
+ size += 8;
+ }
+
+ if ((_propertyFlags & TYPE_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_type);
+ }
+
+ if ((_propertyFlags & USER_ID_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_userId);
+ }
+
+ if ((_propertyFlags & APPLICATION_ID_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_appId);
+ }
+
+ if ((_propertyFlags & CLUSTER_ID_MASK) > 0)
+ {
+ size += EncodingUtils.encodedShortStringLength(_clusterId);
+ }
+
+ return size;
+ }
+ }
+
+ private void clearEncodedForm()
+ {
+ if (!_decoded && (_encodedForm != null))
+ {
+ // decode();
+ }
+
+ _encodedForm = null;
+ }
+
+ public void setPropertyFlags(int propertyFlags)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags = propertyFlags;
+ }
+
+ public int getPropertyFlags()
+ {
+ return _propertyFlags;
+ }
+
+ public void writePropertyListPayload(MessagingBuffer buffer)
+ {
+ if (_encodedForm != null)
+ {
+ buffer.putBytes(_encodedForm);
+ }
+ else
+ {
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _contentType);
+ }
+
+ if ((_propertyFlags & ENCONDING_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _encoding);
+ }
+
+ if ((_propertyFlags & HEADERS_MASK) != 0)
+ {
+ EncodingUtils.writeFieldTableBytes(buffer, _headers);
+ }
+
+ if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
+ {
+ buffer.putByte(_deliveryMode);
+ }
+
+ if ((_propertyFlags & PROPRITY_MASK) != 0)
+ {
+ buffer.putByte(_priority);
+ }
+
+ if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _correlationId);
+ }
+
+ if ((_propertyFlags & REPLY_TO_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _replyTo);
+ }
+
+ if ((_propertyFlags & EXPIRATION_MASK) != 0)
+ {
+ if (_expiration == 0L)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, ZERO_STRING);
+ }
+ else
+ {
+ EncodingUtils.writeShortStringBytes(buffer, String.valueOf(_expiration));
+ }
+ }
+
+ if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _messageId);
+ }
+
+ if ((_propertyFlags & TIMESTAMP_MASK) != 0)
+ {
+ EncodingUtils.writeTimestamp(buffer, _timestamp);
+ }
+
+ if ((_propertyFlags & TYPE_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _type);
+ }
+
+ if ((_propertyFlags & USER_ID_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _userId);
+ }
+
+ if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _appId);
+ }
+
+ if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, _clusterId);
+ }
+ }
+ }
+
+ public void populatePropertiesFromBuffer(MessagingBuffer buffer, int propertyFlags, int size) throws AMQFrameDecodingException
+ {
+ _propertyFlags = propertyFlags;
+
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Property flags: " + _propertyFlags);
+ }
+
+ decode(buffer);
+ /*_encodedForm = new byte[size];
+ buffer.get(_encodedForm, 0, size);
+ _decoded = false;
+ _decodedHeaders = false;
+ _decodedContentType = false;*/
+ }
+
+ private void decode(MessagingBuffer buffer)
+ {
+ // ByteBuffer buffer = ByteBuffer.wrap(_encodedForm);
+ int pos = buffer.position();
+ try
+ {
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
+ {
+ _contentType = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & ENCONDING_MASK) != 0)
+ {
+ _encoding = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & HEADERS_MASK) != 0)
+ {
+ _headers = EncodingUtils.readFieldTable(buffer);
+ }
+
+ if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
+ {
+ _deliveryMode = buffer.getByte();
+ }
+
+ if ((_propertyFlags & PROPRITY_MASK) != 0)
+ {
+ _priority = buffer.getByte();
+ }
+
+ if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
+ {
+ _correlationId = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & REPLY_TO_MASK) != 0)
+ {
+ _replyTo = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & EXPIRATION_MASK) != 0)
+ {
+ _expiration = EncodingUtils.readLongAsShortString(buffer);
+ }
+
+ if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
+ {
+ _messageId = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & TIMESTAMP_MASK) != 0)
+ {
+ _timestamp = EncodingUtils.readTimestamp(buffer);
+ }
+
+ if ((_propertyFlags & TYPE_MASK) != 0)
+ {
+ _type = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & USER_ID_MASK) != 0)
+ {
+ _userId = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
+ {
+ _appId = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
+ {
+ _clusterId = EncodingUtils.readAMQShortString(buffer);
+ }
+ }
+ catch (AMQFrameDecodingException e)
+ {
+ throw new RuntimeException("Error in content header data: " + e, e);
+ }
+
+ final int endPos = buffer.position();
+ buffer.position(pos);
+ final int len = endPos - pos;
+ _encodedForm = new byte[len];
+ final int limit = buffer.limit();
+ buffer.limit(endPos);
+ buffer.getBytes(_encodedForm, 0, len);
+ buffer.limit(limit);
+ buffer.position(endPos);
+ _decoded = true;
+ }
+
+ private void decodeUpToHeaders()
+ {
+ MessagingBuffer buffer = new ByteBufferWrapper(java.nio.ByteBuffer.wrap(_encodedForm));
+ try
+ {
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
+ {
+ byte length = buffer.getByte();
+ buffer.skip(length);
+ }
+
+ if ((_propertyFlags & ENCONDING_MASK) != 0)
+ {
+ byte length = buffer.getByte();
+ buffer.skip(length);
+ }
+
+ if ((_propertyFlags & HEADERS_MASK) != 0)
+ {
+ _headers = EncodingUtils.readFieldTable(buffer);
+
+ }
+
+ _decodedHeaders = true;
+ }
+ catch (AMQFrameDecodingException e)
+ {
+ throw new RuntimeException("Error in content header data: " + e, e);
+ }
+ }
+
+ private void decodeUpToContentType()
+ {
+ MessagingBuffer buffer = new ByteBufferWrapper(java.nio.ByteBuffer.wrap(_encodedForm));
+
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
+ {
+ _contentType = EncodingUtils.readAMQShortString(buffer);
+ }
+
+ _decodedContentType = true;
+ }
+
+ private void decodeIfNecessary()
+ {
+ if (!_decoded)
+ {
+ // decode();
+ }
+ }
+
+ private void decodeHeadersIfNecessary()
+ {
+ if (!_decoded && !_decodedHeaders)
+ {
+ decodeUpToHeaders();
+ }
+ }
+
+ private void decodeContentTypeIfNecessary()
+ {
+ if (!_decoded && !_decodedContentType)
+ {
+ decodeUpToContentType();
+ }
+ }
+
+ public AMQShortString getContentType()
+ {
+ decodeContentTypeIfNecessary();
+
+ return _contentType;
+ }
+
+ public String getContentTypeAsString()
+ {
+ decodeContentTypeIfNecessary();
+
+ return (_contentType == null) ? null : _contentType.toString();
+ }
+
+ public void setContentType(AMQShortString contentType)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= (CONTENT_TYPE_MASK);
+ _contentType = contentType;
+ }
+
+ public void setContentType(String contentType)
+ {
+ _hasBeenUpdated = true;
+ setContentType((contentType == null) ? null : new AMQShortString(contentType));
+ }
+
+ public String getEncodingAsString()
+ {
+
+ return (getEncoding() == null) ? null : getEncoding().toString();
+ }
+
+ public AMQShortString getEncoding()
+ {
+ decodeIfNecessary();
+
+ return _encoding;
+ }
+
+ public void setEncoding(String encoding)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= ENCONDING_MASK;
+ _encoding = (encoding == null) ? null : new AMQShortString(encoding);
+ }
+
+ public void setEncoding(AMQShortString encoding)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= ENCONDING_MASK;
+ _encoding = encoding;
+ }
+
+ public FieldTable getHeaders()
+ {
+ decodeHeadersIfNecessary();
+
+ if (_headers == null)
+ {
+ setHeaders(FieldTableFactory.newFieldTable());
+ }
+
+ return _headers;
+ }
+
+ public void setHeaders(FieldTable headers)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= HEADERS_MASK;
+ _headers = headers;
+ }
+
+ public byte getDeliveryMode()
+ {
+ decodeIfNecessary();
+
+ return _deliveryMode;
+ }
+
+ public void setDeliveryMode(byte deliveryMode)
+ {
+ clearEncodedForm();
+ _propertyFlags |= DELIVERY_MODE_MASK;
+ _deliveryMode = deliveryMode;
+ }
+
+ public byte getPriority()
+ {
+ decodeIfNecessary();
+
+ return _priority;
+ }
+
+ public void setPriority(byte priority)
+ {
+ clearEncodedForm();
+ _propertyFlags |= PROPRITY_MASK;
+ _priority = priority;
+ }
+
+ public AMQShortString getCorrelationId()
+ {
+ decodeIfNecessary();
+
+ return _correlationId;
+ }
+
+ public String getCorrelationIdAsString()
+ {
+ decodeIfNecessary();
+
+ return (_correlationId == null) ? null : _correlationId.toString();
+ }
+
+ public void setCorrelationId(String correlationId)
+ {
+ _hasBeenUpdated = true;
+ setCorrelationId((correlationId == null) ? null : new AMQShortString(correlationId));
+ }
+
+ public void setCorrelationId(AMQShortString correlationId)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= CORRELATION_ID_MASK;
+ _correlationId = correlationId;
+ }
+
+ public String getReplyToAsString()
+ {
+ decodeIfNecessary();
+
+ return (_replyTo == null) ? null : _replyTo.toString();
+ }
+
+ public AMQShortString getReplyTo()
+ {
+ decodeIfNecessary();
+
+ return _replyTo;
+ }
+
+ public void setReplyTo(String replyTo)
+ {
+ _hasBeenUpdated = true;
+ setReplyTo((replyTo == null) ? null : new AMQShortString(replyTo));
+ }
+
+ public void setReplyTo(AMQShortString replyTo)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= REPLY_TO_MASK;
+ _replyTo = replyTo;
+ }
+
+ public long getExpiration()
+ {
+ decodeIfNecessary();
+ return _expiration;
+ }
+
+ public void setExpiration(long expiration)
+ {
+ clearEncodedForm();
+ _propertyFlags |= EXPIRATION_MASK;
+ _expiration = expiration;
+ }
+
+ public AMQShortString getMessageId()
+ {
+ decodeIfNecessary();
+
+ return _messageId;
+ }
+
+ public String getMessageIdAsString()
+ {
+ decodeIfNecessary();
+
+ return (_messageId == null) ? null : _messageId.toString();
+ }
+
+ public void setMessageId(String messageId)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= MESSAGE_ID_MASK;
+ _messageId = (messageId == null) ? null : new AMQShortString(messageId);
+ }
+
+ public void setMessageId(AMQShortString messageId)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= MESSAGE_ID_MASK;
+ _messageId = messageId;
+ }
+
+ public long getTimestamp()
+ {
+ decodeIfNecessary();
+ return _timestamp;
+ }
+
+ public void setTimestamp(long timestamp)
+ {
+ clearEncodedForm();
+ _propertyFlags |= TIMESTAMP_MASK;
+ _timestamp = timestamp;
+ }
+
+ public String getTypeAsString()
+ {
+ decodeIfNecessary();
+
+ return (_type == null) ? null : _type.toString();
+ }
+
+ public AMQShortString getType()
+ {
+ decodeIfNecessary();
+
+ return _type;
+ }
+
+ public void setType(String type)
+ {
+ _hasBeenUpdated = true;
+ setType((type == null) ? null : new AMQShortString(type));
+ }
+
+ public void setType(AMQShortString type)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= TYPE_MASK;
+ _type = type;
+ }
+
+ public String getUserIdAsString()
+ {
+ decodeIfNecessary();
+
+ return (_userId == null) ? null : _userId.toString();
+ }
+
+ public AMQShortString getUserId()
+ {
+ decodeIfNecessary();
+
+ return _userId;
+ }
+
+ public void setUserId(String userId)
+ {
+ setUserId((userId == null) ? null : new AMQShortString(userId));
+ }
+
+ public void setUserId(AMQShortString userId)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= USER_ID_MASK;
+ _userId = userId;
+ }
+
+ public String getAppIdAsString()
+ {
+ decodeIfNecessary();
+
+ return (_appId == null) ? null : _appId.toString();
+ }
+
+ public AMQShortString getAppId()
+ {
+ decodeIfNecessary();
+
+ return _appId;
+ }
+
+ public void setAppId(String appId)
+ {
+ _hasBeenUpdated = true;
+ setAppId((appId == null) ? null : new AMQShortString(appId));
+ }
+
+ public void setAppId(AMQShortString appId)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= APPLICATION_ID_MASK;
+ _appId = appId;
+ _hasBeenUpdated = true;
+ }
+
+ public String getClusterIdAsString()
+ {
+ _hasBeenUpdated = true;
+ decodeIfNecessary();
+ return (_clusterId == null) ? null : _clusterId.toString();
+ }
+
+ public AMQShortString getClusterId()
+ {
+ _hasBeenUpdated = true;
+ decodeIfNecessary();
+ return _clusterId;
+ }
+
+ public void setClusterId(String clusterId)
+ {
+ _hasBeenUpdated = true;
+ setClusterId((clusterId == null) ? null : new AMQShortString(clusterId));
+ }
+
+ public void setClusterId(AMQShortString clusterId)
+ {
+ _hasBeenUpdated = true;
+ clearEncodedForm();
+ _propertyFlags |= CLUSTER_ID_MASK;
+ _clusterId = clusterId;
+ }
+
+ public String toString()
+ {
+ return "reply-to = " + _replyTo + ",propertyFlags = " + _propertyFlags + ",ApplicationID = " + _appId
+ + ",ClusterID = " + _clusterId + ",UserId = " + _userId + ",JMSMessageID = " + _messageId
+ + ",JMSCorrelationID = " + _correlationId + ",JMSDeliveryMode = " + _deliveryMode + ",JMSExpiration = "
+ + _expiration + ",JMSPriority = " + _priority + ",JMSTimestamp = " + _timestamp + ",JMSType = " + _type;
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicDeliverBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicDeliverBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicDeliverBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicDeliverBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getConsumerTag();
+
+ public long getDeliveryTag();
+
+ public AMQShortString getExchange();
+
+ public boolean getRedelivered();
+
+ public AMQShortString getRoutingKey();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicGetBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getNoAck();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetEmptyBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetEmptyBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetEmptyBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicGetEmptyBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getClusterId();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicGetOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicGetOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getDeliveryTag();
+
+ public AMQShortString getExchange();
+
+ public long getMessageCount();
+
+ public boolean getRedelivered();
+
+ public AMQShortString getRoutingKey();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicPublishBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicPublishBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicPublishBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicPublishBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getExchange();
+
+ public boolean getImmediate();
+
+ public boolean getMandatory();
+
+ public AMQShortString getRoutingKey();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicQosBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getGlobal();
+
+ public int getPrefetchCount();
+
+ public long getPrefetchSize();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicQosOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicQosOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicRecoverBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getRequeue();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicRecoverOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicRecoverSyncBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getRequeue();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRecoverSyncOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicRecoverSyncOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRejectBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRejectBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicRejectBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicRejectBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getDeliveryTag();
+
+ public boolean getRequeue();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicReturnBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicReturnBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BasicReturnBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface BasicReturnBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getExchange();
+
+ public int getReplyCode();
+
+ public AMQShortString getReplyText();
+
+ public AMQShortString getRoutingKey();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BodyFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BodyFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/BodyFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/*
+ * Any class that is capable of turning a stream of bytes into an AMQ structure
+ * must implement this interface.
+ */
+public interface BodyFactory
+{
+ AMQBody createBody(MessagingBuffer in, long bodySize) throws AMQFrameDecodingException;
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelAlertBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelAlertBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelAlertBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelAlertBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getDetails();
+
+ public int getReplyCode();
+
+ public AMQShortString getReplyText();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelCloseBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public int getClassId();
+
+ public int getMethodId();
+
+ public int getReplyCode();
+
+ public AMQShortString getReplyText();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelCloseOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelCloseOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelFlowBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getActive();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelFlowOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelFlowOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getActive();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelOpenBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getOutOfBand();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelOpenOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,46 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelOpenOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPingBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPingBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPingBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelPingBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPongBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPongBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelPongBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelPongBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelResumeBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelResumeBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ChannelResumeBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ChannelResumeBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getChannelId();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ClientMethodDispatcher.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ClientMethodDispatcher.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ClientMethodDispatcher.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,93 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.amq.AMQException;
+
+/**
+ * A ClientMethodDispatcher
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface ClientMethodDispatcher
+{
+
+ // public boolean dispatchAccessRequestOk(AccessRequestOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicCancelOk(BasicCancelOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicConsumeOk(BasicConsumeOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicDeliver(BasicDeliverBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicGetEmpty(BasicGetEmptyBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicGetOk(BasicGetOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicQosOk(BasicQosOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicReturn(BasicReturnBody body, int channelId) throws AMQException;
+ public boolean dispatchChannelClose(ChannelCloseBody body, int channelId) throws AMQException;
+
+ public boolean dispatchChannelCloseOk(ChannelCloseOkBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchChannelFlow(ChannelFlowBody body, int channelId) throws AMQException;
+ // public boolean dispatchChannelFlowOk(ChannelFlowOkBody body, int channelId) throws AMQException;
+ public boolean dispatchChannelOpenOk(ChannelOpenOkBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchConnectionClose(ConnectionCloseBody body, int channelId) throws AMQException;
+ // public boolean dispatchConnectionCloseOk(ConnectionCloseOkBody body, int channelId) throws AMQException;
+ public boolean dispatchConnectionOpenOk(ConnectionOpenOkBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchConnectionRedirect(ConnectionRedirectBody body, int channelId) throws AMQException;
+ // public boolean dispatchConnectionSecure(ConnectionSecureBody body, int channelId) throws AMQException;
+ public boolean dispatchConnectionStart(ConnectionStartBody body, int channelId) throws AMQException;
+
+ public boolean dispatchConnectionTune(ConnectionTuneBody body, int channelId) throws AMQException;
+ // public boolean dispatchDtxSelectOk(DtxSelectOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchDtxStartOk(DtxStartOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchExchangeBoundOk(ExchangeBoundOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchExchangeDeclareOk(ExchangeDeclareOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchExchangeDeleteOk(ExchangeDeleteOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileCancelOk(FileCancelOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileConsumeOk(FileConsumeOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileDeliver(FileDeliverBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileOpen(FileOpenBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileOpenOk(FileOpenOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileQosOk(FileQosOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileReturn(FileReturnBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileStage(FileStageBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueueBindOk(QueueBindOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueueDeclareOk(QueueDeclareOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueueDeleteOk(QueueDeleteOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueuePurgeOk(QueuePurgeOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamCancelOk(StreamCancelOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamConsumeOk(StreamConsumeOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamDeliver(StreamDeliverBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamQosOk(StreamQosOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamReturn(StreamReturnBody body, int channelId) throws AMQException;
+ // public boolean dispatchTxCommitOk(TxCommitOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchTxRollbackOk(TxRollbackOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchTxSelectOk(TxSelectOkBody body, int channelId) throws AMQException;
+
+}
\ No newline at end of file
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CommonContentHeaderProperties.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CommonContentHeaderProperties.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CommonContentHeaderProperties.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,87 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.jboss.messaging.amq.framing;
+
+/**
+ * A CommonContentHeaderProperties
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface CommonContentHeaderProperties extends ContentHeaderProperties
+{
+ AMQShortString getContentType();
+
+ void setContentType(AMQShortString contentType);
+
+ FieldTable getHeaders();
+
+ void setHeaders(FieldTable headers);
+
+ byte getDeliveryMode();
+
+ void setDeliveryMode(byte deliveryMode);
+
+ byte getPriority();
+
+ void setPriority(byte priority);
+
+ AMQShortString getCorrelationId();
+
+ void setCorrelationId(AMQShortString correlationId);
+
+ AMQShortString getReplyTo();
+
+ void setReplyTo(AMQShortString replyTo);
+
+ long getExpiration();
+
+ void setExpiration(long expiration);
+
+ AMQShortString getMessageId();
+
+ void setMessageId(AMQShortString messageId);
+
+ long getTimestamp();
+
+ void setTimestamp(long timestamp);
+
+ AMQShortString getType();
+
+ void setType(AMQShortString type);
+
+ AMQShortString getUserId();
+
+ void setUserId(AMQShortString userId);
+
+ AMQShortString getAppId();
+
+ void setAppId(AMQShortString appId);
+
+ AMQShortString getClusterId();
+
+ void setClusterId(AMQShortString clusterId);
+
+ AMQShortString getEncoding();
+
+ void setEncoding(AMQShortString encoding);
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CompositeAMQDataBlock.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CompositeAMQDataBlock.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/CompositeAMQDataBlock.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,84 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A CompositeAMQDataBlock
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class CompositeAMQDataBlock extends AMQDataBlock implements EncodableAMQDataBlock
+{
+
+ private AMQDataBlock[] _blocks;
+
+ public CompositeAMQDataBlock(AMQDataBlock[] blocks)
+ {
+ _blocks = blocks;
+ }
+
+
+ public AMQDataBlock[] getBlocks()
+ {
+ return _blocks;
+ }
+
+
+ public long getSize()
+ {
+ long frameSize = 0;
+ for (int i = 0; i < _blocks.length; i++)
+ {
+ frameSize += _blocks[i].getSize();
+ }
+ return frameSize;
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ for (int i = 0; i < _blocks.length; i++)
+ {
+ _blocks[i].writePayload(buffer);
+ }
+ }
+
+ public String toString()
+ {
+ if (_blocks == null)
+ {
+ return "No blocks contained in composite frame";
+ }
+ else
+ {
+ StringBuilder buf = new StringBuilder(this.getClass().getName());
+ buf.append("{");
+ for (int i = 0 ; i < _blocks.length; i++)
+ {
+ buf.append(" ").append(i).append("=[").append(_blocks[i].toString()).append("]");
+ }
+ buf.append("}");
+ return buf.toString();
+ }
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionCloseBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public int getClassId();
+
+ public int getMethodId();
+
+ public int getReplyCode();
+
+ public AMQShortString getReplyText();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionCloseOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionCloseOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionOpenBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getCapabilities();
+
+ public boolean getInsist();
+
+ public AMQShortString getVirtualHost();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionOpenOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionOpenOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getKnownHosts();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionRedirectBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionRedirectBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionRedirectBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionRedirectBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getHost();
+
+ public AMQShortString getKnownHosts();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionSecureBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getChallenge();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionSecureOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionSecureOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getResponse();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionStartBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getLocales();
+
+ public byte[] getMechanisms();
+
+ public FieldTable getServerProperties();
+
+ public short getVersionMajor();
+
+ public short getVersionMinor();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionStartOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionStartOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getClientProperties();
+
+ public AMQShortString getLocale();
+
+ public AMQShortString getMechanism();
+
+ public byte[] getResponse();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionTuneBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public int getChannelMax();
+
+ public long getFrameMax();
+
+ public int getHeartbeat();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ConnectionTuneOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ConnectionTuneOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public int getChannelMax();
+
+ public long getFrameMax();
+
+ public int getHeartbeat();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/Content.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/Content.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/Content.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,26 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+public interface Content
+{
+ // TODO: New Content class required for AMQP 0-9.
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,95 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A ContentBody
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class ContentBody implements AMQBody
+{
+ public static final byte TYPE = 3;
+
+ public MessagingBuffer payload;
+
+ public ContentBody()
+ {
+ }
+
+ public ContentBody(MessagingBuffer buffer, long size) throws AMQFrameDecodingException
+ {
+ if (size > 0)
+ {
+ payload = buffer.slice();
+ payload.limit((int)size);
+ buffer.skip((int)size);
+ }
+
+ }
+
+ public ContentBody(MessagingBuffer payload)
+ {
+ this.payload = payload;
+ }
+
+ public byte getFrameType()
+ {
+ return TYPE;
+ }
+
+ public int getSize()
+ {
+ return (payload == null ? 0 : payload.limit());
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ if (payload != null)
+ {
+ buffer.putBytes(payload.array());
+ }
+ }
+
+ protected void populateFromBuffer(MessagingBuffer buffer, long size) throws AMQFrameDecodingException
+ {
+ if (size > 0)
+ {
+ payload = buffer.slice();
+ payload.limit((int)size);
+ buffer.skip((int)size);
+ }
+
+ }
+
+ public void reduceBufferToFit()
+ {
+ // FIXME
+ }
+
+ public static AMQFrame createAMQFrame(int channelId, ContentBody body)
+ {
+ final AMQFrame frame = new AMQFrame(channelId, body);
+ return frame;
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBodyFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBodyFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentBodyFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,52 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A ContentBodyFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ContentBodyFactory implements BodyFactory
+{
+ private static final Logger _log = Logger.getLogger(AMQMethodBodyFactory.class);
+
+ private static final ContentBodyFactory _instance = new ContentBodyFactory();
+
+ public static ContentBodyFactory getInstance()
+ {
+ return _instance;
+ }
+
+ private ContentBodyFactory()
+ {
+ _log.debug("Creating content body factory");
+ }
+
+ public AMQBody createBody(MessagingBuffer in, long bodySize) throws AMQFrameDecodingException
+ {
+ return new ContentBody(in, bodySize);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,129 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A ContentHeaderBody
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ContentHeaderBody implements AMQBody
+{
+ public static final byte TYPE = 2;
+
+ public int classId;
+
+ public int weight;
+
+ /** unsigned long but java can't handle that anyway when allocating byte array */
+ public long bodySize;
+
+ /** must never be null */
+ public ContentHeaderProperties properties;
+
+ public ContentHeaderBody()
+ {
+ }
+
+ public ContentHeaderBody(MessagingBuffer buffer, long size) throws AMQFrameDecodingException
+ {
+ classId = buffer.getUnsignedShort();
+ weight = buffer.getUnsignedShort();
+ bodySize = buffer.getLong();
+ int propertyFlags = buffer.getUnsignedShort();
+ ContentHeaderPropertiesFactory factory = ContentHeaderPropertiesFactory.getInstance();
+ properties = factory.createContentHeaderProperties(classId, propertyFlags, buffer, (int)size - 14);
+
+ }
+
+
+ public ContentHeaderBody(ContentHeaderProperties props, int classId)
+ {
+ properties = props;
+ this.classId = classId;
+ }
+
+ public ContentHeaderBody(int classId, int weight, ContentHeaderProperties props, long bodySize)
+ {
+ this(props, classId);
+ this.weight = weight;
+ this.bodySize = bodySize;
+ }
+
+ public byte getFrameType()
+ {
+ return TYPE;
+ }
+
+ protected void populateFromBuffer(MessagingBuffer buffer, long size)
+ throws AMQFrameDecodingException, AMQProtocolVersionException
+ {
+ classId = buffer.getUnsignedShort();
+ weight = buffer.getUnsignedShort();
+ bodySize = buffer.getLong();
+ int propertyFlags = buffer.getUnsignedShort();
+ ContentHeaderPropertiesFactory factory = ContentHeaderPropertiesFactory.getInstance();
+ properties = factory.createContentHeaderProperties(classId, propertyFlags, buffer, (int)size - 14);
+ }
+
+ /**
+ * Helper method that is used currently by the persistence layer (by BDB at the moment).
+ * @param buffer
+ * @param size
+ * @return
+ * @throws AMQFrameDecodingException
+ */
+ public static ContentHeaderBody createFromBuffer(MessagingBuffer buffer, long size)
+ throws AMQFrameDecodingException, AMQProtocolVersionException
+ {
+ ContentHeaderBody body = new ContentHeaderBody(buffer, size);
+
+ return body;
+ }
+
+ public int getSize()
+ {
+ return 2 + 2 + 8 + 2 + properties.getPropertyListSize();
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ EncodingUtils.writeUnsignedShort(buffer, classId);
+ EncodingUtils.writeUnsignedShort(buffer, weight);
+ buffer.putLong(bodySize);
+ EncodingUtils.writeUnsignedShort(buffer, properties.getPropertyFlags());
+ properties.writePropertyListPayload(buffer);
+ }
+
+ public static AMQFrame createAMQFrame(int channelId, int classId, int weight, BasicContentHeaderProperties properties,
+ long bodySize)
+ {
+ return new AMQFrame(channelId, new ContentHeaderBody(classId, weight, properties, bodySize));
+ }
+
+ public static AMQFrame createAMQFrame(int channelId, ContentHeaderBody body)
+ {
+ return new AMQFrame(channelId, body);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBodyFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBodyFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderBodyFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A ContentHeaderBodyFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class ContentHeaderBodyFactory implements BodyFactory
+{
+ private static final Logger _log = Logger.getLogger(AMQMethodBodyFactory.class);
+
+ private static final ContentHeaderBodyFactory _instance = new ContentHeaderBodyFactory();
+
+ public static ContentHeaderBodyFactory getInstance()
+ {
+ return _instance;
+ }
+
+ private ContentHeaderBodyFactory()
+ {
+ _log.debug("Creating content header body factory");
+ }
+
+ public AMQBody createBody(MessagingBuffer in, long bodySize) throws AMQFrameDecodingException
+ {
+ // all content headers are the same - it is only the properties that differ.
+ // the content header body further delegates construction of properties
+ return new ContentHeaderBody(in, bodySize);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderProperties.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderProperties.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderProperties.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,62 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * There will be an implementation of this interface for each content type. All content types have associated
+ * header properties and this provides a way to encode and decode them.
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface ContentHeaderProperties
+{
+ /**
+ * Writes the property list to the buffer, in a suitably encoded form.
+ * @param buffer The buffer to write to
+ */
+ void writePropertyListPayload(MessagingBuffer buffer);
+
+ /**
+ * Populates the properties from buffer.
+ * @param buffer The buffer to read from.
+ * @param propertyFlags he property flags.
+ * @throws AMQFrameDecodingException when the buffer does not contain valid data
+ */
+ void populatePropertiesFromBuffer(MessagingBuffer buffer, int propertyFlags, int size) throws AMQFrameDecodingException;
+
+ /**
+ * @return the size of the encoded property list in bytes.
+ */
+ int getPropertyListSize();
+
+ /**
+ * Gets the property flags. Property flags indicate which properties are set in the list. The
+ * position and meaning of each flag is defined in the protocol specification for the particular
+ * content type with which these properties are associated.
+ * @return flags
+ */
+ int getPropertyFlags();
+
+ void updated();
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderPropertiesFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderPropertiesFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ContentHeaderPropertiesFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,65 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A ContentHeaderPropertiesFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class ContentHeaderPropertiesFactory
+{
+ private static final ContentHeaderPropertiesFactory _instance = new ContentHeaderPropertiesFactory();
+
+ public static ContentHeaderPropertiesFactory getInstance()
+ {
+ return _instance;
+ }
+
+ private ContentHeaderPropertiesFactory()
+ {
+ }
+
+ public ContentHeaderProperties createContentHeaderProperties(int classId,
+ int propertyFlags,
+ MessagingBuffer buffer,
+ int size) throws AMQFrameDecodingException
+ {
+ ContentHeaderProperties properties;
+ // AMQP version change: "Hardwired" version to major=8, minor=0
+ // TODO: Change so that the actual version is obtained from
+ // the ProtocolInitiation object for this session.
+ int CLASS_ID = 60;
+
+ if (classId == CLASS_ID)
+ {
+ properties = new BasicContentHeaderProperties();
+ }
+ else
+ {
+ throw new AMQFrameDecodingException(null, "Unsupport content header class id: " + classId, null);
+ }
+ properties.populatePropertiesFromBuffer(buffer, propertyFlags, size);
+ return properties;
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DeferredDataBlock.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DeferredDataBlock.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DeferredDataBlock.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A DeferredDataBlock
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public abstract class DeferredDataBlock extends AMQDataBlock
+{
+ private AMQDataBlock _underlyingDataBlock;
+
+ public long getSize()
+ {
+ if (_underlyingDataBlock == null)
+ {
+ _underlyingDataBlock = createAMQDataBlock();
+ }
+ return _underlyingDataBlock.getSize();
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ if (_underlyingDataBlock == null)
+ {
+ _underlyingDataBlock = createAMQDataBlock();
+ }
+ _underlyingDataBlock.writePayload(buffer);
+ }
+
+ abstract protected AMQDataBlock createAMQDataBlock();
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface DtxSelectBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxSelectOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface DtxSelectOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface DtxStartBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getDtxIdentifier();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/DtxStartOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface DtxStartOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodableAMQDataBlock.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodableAMQDataBlock.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodableAMQDataBlock.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+/**
+ * Marker interface to indicate to MINA that a data block should be encoded with the
+ * single encoder/decoder that we have defined.
+ *
+ * Note that due to a bug in MINA all classes must directly implement this interface, even if
+ * a superclass implements it.
+ * TODO: fix MINA so that this is not necessary
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface EncodableAMQDataBlock
+{
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodingUtils.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodingUtils.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/EncodingUtils.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,1065 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.jboss.messaging.amq.framing;
+
+import java.nio.charset.Charset;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A EncodingUtils
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class EncodingUtils
+{
+ private static final Logger _logger = Logger.getLogger(EncodingUtils.class);
+
+ private static final Charset _charset = Charset.forName("iso8859-15");
+
+ public static final int SIZEOF_UNSIGNED_SHORT = 2;
+
+ public static final int SIZEOF_UNSIGNED_INT = 4;
+
+ private static final boolean[] ALL_FALSE_ARRAY = new boolean[8];
+
+ public static int encodedShortStringLength(final String s)
+ {
+ if (s == null)
+ {
+ return 1;
+ }
+ else
+ {
+ return (short)(1 + s.length());
+ }
+ }
+
+ public static int encodedShortStringLength(short s)
+ {
+ if (s == 0)
+ {
+ return 1 + 1;
+ }
+
+ if (s < 0)
+ {
+ // sloppy - doesn't work of Integer.MIN_VALUE
+ s = (short)-s;
+ }
+
+ if (s > 9999)
+ {
+ return 1 + 5;
+ }
+ else if (s > 999)
+ {
+ return 1 + 4;
+ }
+ else if (s > 99)
+ {
+ return 1 + 3;
+ }
+ else if (s > 9)
+ {
+ return 1 + 2;
+ }
+ else
+ {
+ return 1 + 1;
+ }
+
+ }
+
+ public static int encodedShortStringLength(int i)
+ {
+ if (i == 0)
+ {
+ return 1 + 1;
+ }
+
+ int len = 0;
+ if (i < 0)
+ {
+ len = 1;
+ // sloppy - doesn't work of Integer.MIN_VALUE
+ i = -i;
+ }
+
+ // range is now 1 - 2147483647
+ if (i < Short.MAX_VALUE)
+ {
+ return len + encodedShortStringLength((short)i);
+ }
+ else if (i > 999999)
+ {
+ return len + 6 + encodedShortStringLength((short)(i / 1000000));
+ }
+ else
+ // if (i > 99999)
+ {
+ return len + 5 + encodedShortStringLength((short)(i / 100000));
+ }
+
+ }
+
+ public static int encodedShortStringLength(long l)
+ {
+ if (l == 0)
+ {
+ return 1 + 1;
+ }
+
+ int len = 0;
+ if (l < 0)
+ {
+ len = 1;
+ // sloppy - doesn't work of Long.MIN_VALUE
+ l = -l;
+ }
+
+ if (l < Integer.MAX_VALUE)
+ {
+ return len + encodedShortStringLength((int)l);
+ }
+ else if (l > 9999999999L)
+ {
+ return len + 10 + encodedShortStringLength((int)(l / 10000000000L));
+ }
+ else
+ {
+ return len + 1 + encodedShortStringLength((int)(l / 10L));
+ }
+
+ }
+
+ public static int encodedShortStringLength(final AMQShortString s)
+ {
+ if (s == null)
+ {
+ return 1;
+ }
+ else
+ {
+ return (1 + s.length());
+ }
+ }
+
+ public static int encodedLongStringLength(final String s)
+ {
+ if (s == null)
+ {
+ return 4;
+ }
+ else
+ {
+ return 4 + s.length();
+ }
+ }
+
+ public static int encodedLongStringLength(final char[] s)
+ {
+ if (s == null)
+ {
+ return 4;
+ }
+ else
+ {
+ return 4 + s.length;
+ }
+ }
+
+ public static int encodedLongstrLength(final byte[] bytes)
+ {
+ if (bytes == null)
+ {
+ return 4;
+ }
+ else
+ {
+ return 4 + bytes.length;
+ }
+ }
+
+ public static int encodedFieldTableLength(final FieldTable table)
+ {
+ if (table == null)
+ {
+ // length is encoded as 4 octets
+ return 4;
+ }
+ else
+ {
+ // length of the table plus 4 octets for the length
+ return (int)table.getEncodedSize() + 4;
+ }
+ }
+
+ public static int encodedContentLength(final Content table)
+ {
+ // TODO: New Content class required for AMQP 0-9.
+ return 0;
+ }
+
+ public static void writeShortStringBytes(final MessagingBuffer buffer, final String s)
+ {
+ if (s != null)
+ {
+ byte[] encodedString = new byte[s.length()];
+ char[] cha = s.toCharArray();
+ for (int i = 0; i < cha.length; i++)
+ {
+ encodedString[i] = (byte)cha[i];
+ }
+
+ // TODO: check length fits in an unsigned byte
+ writeUnsignedByte(buffer, (short)encodedString.length);
+ buffer.putBytes(encodedString);
+
+ }
+ else
+ {
+ // really writing out unsigned byte
+ buffer.putByte((byte)0);
+ }
+ }
+
+ public static void writeShortStringBytes(final MessagingBuffer buffer, final AMQShortString s)
+ {
+ if (s != null)
+ {
+
+ s.writeToBuffer(buffer);
+ }
+ else
+ {
+ // really writing out unsigned byte
+ buffer.putByte((byte)0);
+ }
+ }
+
+ public static void writeLongStringBytes(final MessagingBuffer buffer, final String s)
+ {
+ assert (s == null) || (s.length() <= 0xFFFE);
+ if (s != null)
+ {
+ int len = s.length();
+ writeUnsignedInteger(buffer, s.length());
+ byte[] encodedString = new byte[len];
+ char[] cha = s.toCharArray();
+ for (int i = 0; i < cha.length; i++)
+ {
+ encodedString[i] = (byte)cha[i];
+ }
+
+ buffer.putBytes(encodedString);
+ }
+ else
+ {
+ writeUnsignedInteger(buffer, 0);
+ }
+ }
+
+ public static void writeLongStringBytes(final MessagingBuffer buffer, final char[] s)
+ {
+ assert (s == null) || (s.length <= 0xFFFE);
+ if (s != null)
+ {
+ int len = s.length;
+ writeUnsignedInteger(buffer, s.length);
+ byte[] encodedString = new byte[len];
+ for (int i = 0; i < s.length; i++)
+ {
+ encodedString[i] = (byte)s[i];
+ }
+
+ buffer.putBytes(encodedString);
+ }
+ else
+ {
+ writeUnsignedInteger(buffer, 0);
+ }
+ }
+
+ public static void writeLongStringBytes(final MessagingBuffer buffer, final byte[] bytes)
+ {
+ assert (bytes == null) || (bytes.length <= 0xFFFE);
+ if (bytes != null)
+ {
+ writeUnsignedInteger(buffer, bytes.length);
+ buffer.putBytes(bytes);
+ }
+ else
+ {
+ writeUnsignedInteger(buffer, 0);
+ }
+ }
+
+ public static void writeUnsignedByte(final MessagingBuffer buffer, final short b)
+ {
+ byte bv = (byte)b;
+ buffer.putByte(bv);
+ }
+
+ public static void writeUnsignedShort(final MessagingBuffer buffer, final int s)
+ {
+ // TODO: Is this comparison safe? Do I need to cast RHS to long?
+ if (s < Short.MAX_VALUE)
+ {
+ buffer.putShort((short)s);
+ }
+ else
+ {
+ short sv = (short)s;
+ buffer.putByte((byte)(0xFF & (sv >> 8)));
+ buffer.putByte((byte)(0xFF & sv));
+ }
+ }
+
+ public static int unsignedIntegerLength()
+ {
+ return 4;
+ }
+
+ public static void writeUnsignedInteger(final MessagingBuffer buffer, final long l)
+ {
+ // TODO: Is this comparison safe? Do I need to cast RHS to long?
+ if (l < Integer.MAX_VALUE)
+ {
+ buffer.putInt((int)l);
+ }
+ else
+ {
+ int iv = (int)l;
+
+ // FIXME: This *may* go faster if we build this into a local 4-byte
+ // array and then
+ // put the array in a single call.
+ buffer.putByte((byte)(0xFF & (iv >> 24)));
+ buffer.putByte((byte)(0xFF & (iv >> 16)));
+ buffer.putByte((byte)(0xFF & (iv >> 8)));
+ buffer.putByte((byte)(0xFF & iv));
+ }
+ }
+
+ public static void writeFieldTableBytes(final MessagingBuffer buffer, final FieldTable table)
+ {
+ if (table != null)
+ {
+ table.writeToBuffer(buffer);
+ }
+ else
+ {
+ EncodingUtils.writeUnsignedInteger(buffer, 0);
+ }
+ }
+
+ public static void writeContentBytes(final MessagingBuffer buffer, final Content content)
+ {
+ // TODO: New Content class required for AMQP 0-9.
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer, final boolean[] values)
+ {
+ byte packedValue = 0;
+ for (int i = 0; i < values.length; i++)
+ {
+ if (values[i])
+ {
+ packedValue = (byte)(packedValue | (1 << i));
+ }
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer, final boolean value)
+ {
+
+ buffer.putByte(value ? (byte)1 : (byte)0);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer, final boolean value0, final boolean value1)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer,
+ final boolean value0,
+ final boolean value1,
+ final boolean value2)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ if (value2)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 2));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer,
+ final boolean value0,
+ final boolean value1,
+ final boolean value2,
+ final boolean value3)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ if (value2)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 2));
+ }
+
+ if (value3)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 3));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer,
+ final boolean value0,
+ final boolean value1,
+ final boolean value2,
+ final boolean value3,
+ final boolean value4)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ if (value2)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 2));
+ }
+
+ if (value3)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 3));
+ }
+
+ if (value4)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 4));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer,
+ final boolean value0,
+ final boolean value1,
+ final boolean value2,
+ final boolean value3,
+ final boolean value4,
+ final boolean value5)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ if (value2)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 2));
+ }
+
+ if (value3)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 3));
+ }
+
+ if (value4)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 4));
+ }
+
+ if (value5)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 5));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer,
+ final boolean value0,
+ final boolean value1,
+ final boolean value2,
+ final boolean value3,
+ final boolean value4,
+ final boolean value5,
+ final boolean value6)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ if (value2)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 2));
+ }
+
+ if (value3)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 3));
+ }
+
+ if (value4)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 4));
+ }
+
+ if (value5)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 5));
+ }
+
+ if (value6)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 6));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ public static void writeBooleans(final MessagingBuffer buffer,
+ final boolean value0,
+ final boolean value1,
+ final boolean value2,
+ final boolean value3,
+ final boolean value4,
+ final boolean value5,
+ final boolean value6,
+ final boolean value7)
+ {
+ byte packedValue = value0 ? (byte)1 : (byte)0;
+
+ if (value1)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 1));
+ }
+
+ if (value2)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 2));
+ }
+
+ if (value3)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 3));
+ }
+
+ if (value4)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 4));
+ }
+
+ if (value5)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 5));
+ }
+
+ if (value6)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 6));
+ }
+
+ if (value7)
+ {
+ packedValue = (byte)(packedValue | (byte)(1 << 7));
+ }
+
+ buffer.putByte(packedValue);
+ }
+
+ /**
+ * This is used for writing longstrs.
+ *
+ * @param buffer
+ * @param data
+ */
+ public static void writeLongstr(final MessagingBuffer buffer, final byte[] data)
+ {
+ if (data != null)
+ {
+ writeUnsignedInteger(buffer, data.length);
+ buffer.putBytes(data);
+ }
+ else
+ {
+ writeUnsignedInteger(buffer, 0);
+ }
+ }
+
+ public static void writeTimestamp(final MessagingBuffer buffer, final long timestamp)
+ {
+ writeLong(buffer, timestamp);
+ }
+
+ public static boolean[] readBooleans(final MessagingBuffer buffer)
+ {
+ final byte packedValue = buffer.getByte();
+ if (packedValue == 0)
+ {
+ return ALL_FALSE_ARRAY;
+ }
+
+ final boolean[] result = new boolean[8];
+
+ result[0] = ((packedValue & 1) != 0);
+ result[1] = ((packedValue & (1 << 1)) != 0);
+ result[2] = ((packedValue & (1 << 2)) != 0);
+ result[3] = ((packedValue & (1 << 3)) != 0);
+ if ((packedValue & 0xF0) == 0)
+ {
+ result[0] = ((packedValue & 1) != 0);
+ }
+
+ result[4] = ((packedValue & (1 << 4)) != 0);
+ result[5] = ((packedValue & (1 << 5)) != 0);
+ result[6] = ((packedValue & (1 << 6)) != 0);
+ result[7] = ((packedValue & (1 << 7)) != 0);
+
+ return result;
+ }
+
+ public static FieldTable readFieldTable(final MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ long length = buffer.getUnsignedInt();
+ if (length == 0)
+ {
+ return null;
+ }
+ else
+ {
+ return FieldTableFactory.newFieldTable(buffer, length);
+ }
+ }
+
+ public static Content readContent(final MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ // TODO: New Content class required for AMQP 0-9.
+ return null;
+ }
+
+ public static AMQShortString readAMQShortString(final MessagingBuffer buffer)
+ {
+ return AMQShortString.readFromBuffer(buffer);
+
+ }
+
+ public static String readShortString(final MessagingBuffer buffer)
+ {
+ int length = buffer.getUnsignedShort();
+ if (length == 0)
+ {
+ return null;
+ }
+ else
+ {
+ // this may seem rather odd to declare two array but testing has shown
+ // that constructing a string from a byte array is 5 (five) times
+ // slower
+ // than constructing one from a char array.
+ // this approach here is valid since we know that all the chars are
+ // ASCII (0-127)
+ byte[] stringBytes = new byte[length];
+ buffer.getBytes(stringBytes, 0, length);
+ char[] stringChars = new char[length];
+ for (int i = 0; i < stringChars.length; i++)
+ {
+ stringChars[i] = (char)stringBytes[i];
+ }
+
+ return new String(stringChars);
+ }
+ }
+
+ public static String readLongString(final MessagingBuffer buffer)
+ {
+ long length = buffer.getUnsignedInt();
+ if (length == 0)
+ {
+ return "";
+ }
+ else
+ {
+ // this may seem rather odd to declare two array but testing has shown
+ // that constructing a string from a byte array is 5 (five) times
+ // slower
+ // than constructing one from a char array.
+ // this approach here is valid since we know that all the chars are
+ // ASCII (0-127)
+ byte[] stringBytes = new byte[(int)length];
+ buffer.getBytes(stringBytes, 0, (int)length);
+ char[] stringChars = new char[(int)length];
+ for (int i = 0; i < stringChars.length; i++)
+ {
+ stringChars[i] = (char)stringBytes[i];
+ }
+
+ return new String(stringChars);
+ }
+ }
+
+ public static byte[] readLongstr(final MessagingBuffer buffer)
+ {
+ long length = buffer.getUnsignedInt();
+ if (length == 0)
+ {
+ return null;
+ }
+ else
+ {
+ byte[] result = new byte[(int)length];
+ buffer.getBytes(result);
+
+ return result;
+ }
+ }
+
+ public static long readTimestamp(final MessagingBuffer buffer)
+ {
+ // Discard msb from AMQ timestamp
+ // buffer.getUnsignedInt();
+ return buffer.getLong();
+ }
+
+ static byte[] hexToByteArray(final String id)
+ {
+ // Should check param for null, long enough for this check, upper-case and
+ // trailing char
+ String s = (id.charAt(1) == 'x') ? id.substring(2) : id; // strip 0x
+
+ int len = s.length();
+ int byte_len = len / 2;
+ byte[] b = new byte[byte_len];
+
+ for (int i = 0; i < byte_len; i++)
+ {
+ // fixme: refine these repetitive subscript calcs.
+ int ch = i * 2;
+
+ byte b1 = Byte.parseByte(s.substring(ch, ch + 1), 16);
+ byte b2 = Byte.parseByte(s.substring(ch + 1, ch + 2), 16);
+
+ b[i] = (byte)((b1 * 16) + b2);
+ }
+
+ return (b);
+ }
+
+ public static char[] convertToHexCharArray(final byte[] from)
+ {
+ int length = from.length;
+ char[] result_buff = new char[(length * 2) + 2];
+
+ result_buff[0] = '0';
+ result_buff[1] = 'x';
+
+ int bite;
+ int dest = 2;
+
+ for (int i = 0; i < length; i++)
+ {
+ bite = from[i];
+
+ if (bite < 0)
+ {
+ bite += 256;
+ }
+
+ result_buff[dest++] = hex_chars[bite >> 4];
+ result_buff[dest++] = hex_chars[bite & 0x0f];
+ }
+
+ return (result_buff);
+ }
+
+ public static String convertToHexString(final byte[] from)
+ {
+ return (new String(convertToHexCharArray(from)));
+ }
+
+ public static String convertToHexString(final MessagingBuffer bb)
+ {
+ int size = bb.limit();
+
+ byte[] from = new byte[size];
+
+ // Is this not the same.
+ // bb.get(from, 0, length);
+ for (int i = 0; i < size; i++)
+ {
+ bb.getBytes(from, 0, from.length);
+ }
+
+ return (new String(convertToHexCharArray(from)));
+ }
+
+ private static char[] hex_chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+ // **** new methods
+
+ // AMQP_BOOLEAN_PROPERTY_PREFIX
+
+ public static void writeBoolean(final MessagingBuffer buffer, final Boolean aBoolean)
+ {
+ buffer.putByte((byte)(aBoolean ? 1 : 0));
+ }
+
+ public static boolean readBoolean(final MessagingBuffer buffer)
+ {
+ byte packedValue = buffer.getByte();
+
+ return (packedValue == 1);
+ }
+
+ public static int encodedBooleanLength()
+ {
+ return 1;
+ }
+
+ // AMQP_BYTE_PROPERTY_PREFIX
+ public static void writeByte(final MessagingBuffer buffer, final Byte aByte)
+ {
+ buffer.putByte(aByte);
+ }
+
+ public static byte readByte(final MessagingBuffer buffer)
+ {
+ return buffer.getByte();
+ }
+
+ public static int encodedByteLength()
+ {
+ return 1;
+ }
+
+ // AMQP_SHORT_PROPERTY_PREFIX
+ public static void writeShort(final MessagingBuffer buffer, final Short aShort)
+ {
+ buffer.putShort(aShort);
+ }
+
+ public static short readShort(final MessagingBuffer buffer)
+ {
+ return buffer.getShort();
+ }
+
+ public static int encodedShortLength()
+ {
+ return 2;
+ }
+
+ // INTEGER_PROPERTY_PREFIX
+ public static void writeInteger(final MessagingBuffer buffer, final Integer aInteger)
+ {
+ buffer.putInt(aInteger);
+ }
+
+ public static int readInteger(final MessagingBuffer buffer)
+ {
+ return buffer.getInt();
+ }
+
+ public static int encodedIntegerLength()
+ {
+ return 4;
+ }
+
+ // AMQP_LONG_PROPERTY_PREFIX
+ public static void writeLong(final MessagingBuffer buffer, final Long aLong)
+ {
+ buffer.putLong(aLong);
+ }
+
+ public static long readLong(final MessagingBuffer buffer)
+ {
+ return buffer.getLong();
+ }
+
+ public static int encodedLongLength()
+ {
+ return 8;
+ }
+
+ // Float_PROPERTY_PREFIX
+ public static void writeFloat(final MessagingBuffer buffer, final Float aFloat)
+ {
+ buffer.putFloat(aFloat);
+ }
+
+ public static float readFloat(final MessagingBuffer buffer)
+ {
+ return buffer.getFloat();
+ }
+
+ public static int encodedFloatLength()
+ {
+ return 4;
+ }
+
+ // Double_PROPERTY_PREFIX
+ public static void writeDouble(final MessagingBuffer buffer, final Double aDouble)
+ {
+ buffer.putDouble(aDouble);
+ }
+
+ public static double readDouble(final MessagingBuffer buffer)
+ {
+ return buffer.getDouble();
+ }
+
+ public static int encodedDoubleLength()
+ {
+ return 8;
+ }
+
+ public static byte[] readBytes(final MessagingBuffer buffer)
+ {
+ long length = buffer.getUnsignedInt();
+ if (length == 0)
+ {
+ return null;
+ }
+ else
+ {
+ byte[] dataBytes = new byte[(int)length];
+ buffer.getBytes(dataBytes, 0, (int)length);
+
+ return dataBytes;
+ }
+ }
+
+ public static void writeBytes(final MessagingBuffer buffer, final byte[] data)
+ {
+ if (data != null)
+ {
+ // TODO: check length fits in an unsigned byte
+ writeUnsignedInteger(buffer, data.length);
+ buffer.putBytes(data);
+ }
+ else
+ {
+ // really writing out unsigned byte
+ // buffer.putByte((byte) 0);
+ writeUnsignedInteger(buffer, 0L);
+ }
+ }
+
+ // CHAR_PROPERTY
+ public static int encodedCharLength()
+ {
+ return encodedByteLength();
+ }
+
+ public static char readChar(final MessagingBuffer buffer)
+ {
+ // This is valid as we know that the Character is ASCII 0..127
+ return (char)buffer.getByte();
+ }
+
+ public static void writeChar(final MessagingBuffer buffer, final char character)
+ {
+ // This is valid as we know that the Character is ASCII 0..127
+ writeByte(buffer, (byte)character);
+ }
+
+ public static long readLongAsShortString(final MessagingBuffer buffer)
+ {
+ int length = buffer.getUnsignedShort();
+ short pos = 0;
+ if (length == 0)
+ {
+ return 0L;
+ }
+
+ byte digit = buffer.getByte();
+ boolean isNegative;
+ long result = 0;
+ if (digit == (byte)'-')
+ {
+ isNegative = true;
+ pos++;
+ digit = buffer.getByte();
+ }
+ else
+ {
+ isNegative = false;
+ }
+
+ result = digit - (byte)'0';
+ pos++;
+
+ while (pos < length)
+ {
+ pos++;
+ digit = buffer.getByte();
+ result = (result << 3) + (result << 1);
+ result += digit - (byte)'0';
+ }
+
+ return result;
+ }
+
+ public static long readUnsignedInteger(final MessagingBuffer buffer)
+ {
+ long l = 0xFF & buffer.getByte();
+ l <<= 8;
+ l = l | (0xFF & buffer.getByte());
+ l <<= 8;
+ l = l | (0xFF & buffer.getByte());
+ l <<= 8;
+ l = l | (0xFF & buffer.getByte());
+
+ return l;
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ExchangeBoundBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getExchange();
+
+ public AMQShortString getQueue();
+
+ public AMQShortString getRoutingKey();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeBoundOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ExchangeBoundOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public int getReplyCode();
+
+ public AMQShortString getReplyText();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,63 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ExchangeDeclareBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getArguments();
+
+ public boolean getAutoDelete();
+
+ public boolean getDurable();
+
+ public AMQShortString getExchange();
+
+ public boolean getInternal();
+
+ public boolean getNowait();
+
+ public boolean getPassive();
+
+ public int getTicket();
+
+ public AMQShortString getType();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeclareOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ExchangeDeclareOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ExchangeDeleteBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getExchange();
+
+ public boolean getIfUnused();
+
+ public boolean getNowait();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ExchangeDeleteOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface ExchangeDeleteOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTable.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTable.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTable.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,1193 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.messaging.amq.AMQPInvalidClassException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A FieldTable
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class FieldTable
+{
+ private static final Logger _logger = Logger.getLogger(FieldTable.class);
+
+ private static final String STRICT_AMQP = "STRICT_AMQP";
+
+ private final boolean _strictAMQP = Boolean.valueOf(System.getProperty(STRICT_AMQP, "false"));
+
+ private MessagingBuffer _encodedForm;
+
+ private LinkedHashMap<AMQShortString, AMQTypedValue> _properties;
+
+ private long _encodedSize;
+
+ private static final int INITIAL_HASHMAP_CAPACITY = 16;
+
+ private static final int INITIAL_ENCODED_FORM_SIZE = 256;
+
+ public FieldTable()
+ {
+ super();
+ // _encodedForm = ByteBuffer.allocate(INITIAL_ENCODED_FORM_SIZE);
+ // _encodedForm.setAutoExpand(true);
+ // _encodedForm.limit(0);
+ }
+
+ /**
+ * Construct a new field table.
+ *
+ * @param buffer the buffer from which to read data. The length byte must be read already
+ * @param length the length of the field table. Must be > 0.
+ *
+ * @throws AMQFrameDecodingException if there is an error decoding the table
+ */
+ public FieldTable(MessagingBuffer buffer, long length) throws AMQFrameDecodingException
+ {
+ this();
+ _encodedForm = buffer.slice();
+ _encodedForm.limit((int)length);
+ _encodedSize = length;
+ buffer.skip((int)length);
+ }
+
+ public AMQTypedValue getProperty(AMQShortString string)
+ {
+ checkPropertyName(string);
+
+ synchronized (this)
+ {
+ if (_properties == null)
+ {
+ if (_encodedForm == null)
+ {
+ return null;
+ }
+ else
+ {
+ populateFromBuffer();
+ }
+ }
+ }
+
+ if (_properties == null)
+ {
+ return null;
+ }
+ else
+ {
+ return _properties.get(string);
+ }
+ }
+
+ private void populateFromBuffer()
+ {
+ try
+ {
+ setFromBuffer(_encodedForm, _encodedSize);
+ }
+ catch (AMQFrameDecodingException e)
+ {
+ _logger.error("Error decoding FieldTable in deferred decoding mode ", e);
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ private AMQTypedValue setProperty(AMQShortString key, AMQTypedValue val)
+ {
+ checkPropertyName(key);
+ initMapIfNecessary();
+ if (_properties.containsKey(key))
+ {
+ _encodedForm = null;
+
+ if (val == null)
+ {
+ return removeKey(key);
+ }
+ }
+ else if ((_encodedForm != null) && (val != null))
+ {
+ EncodingUtils.writeShortStringBytes(_encodedForm, key);
+ val.writeToBuffer(_encodedForm);
+
+ }
+ else if (val == null)
+ {
+ return null;
+ }
+
+ AMQTypedValue oldVal = _properties.put(key, val);
+ if (oldVal != null)
+ {
+ _encodedSize -= oldVal.getEncodingSize();
+ }
+ else
+ {
+ _encodedSize += EncodingUtils.encodedShortStringLength(key) + 1;
+ }
+
+ _encodedSize += val.getEncodingSize();
+
+ return oldVal;
+ }
+
+ private void initMapIfNecessary()
+ {
+ synchronized (this)
+ {
+ if (_properties == null)
+ {
+ if ((_encodedForm == null) || (_encodedSize == 0))
+ {
+ _properties = new LinkedHashMap<AMQShortString, AMQTypedValue>();
+ }
+ else
+ {
+ populateFromBuffer();
+ }
+ }
+
+ }
+ }
+
+ public Boolean getBoolean(String string)
+ {
+ return getBoolean(new AMQShortString(string));
+ }
+
+ public Boolean getBoolean(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.BOOLEAN))
+ {
+ return (Boolean)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Byte getByte(String string)
+ {
+ return getByte(new AMQShortString(string));
+ }
+
+ public Byte getByte(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.BYTE))
+ {
+ return (Byte)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Short getShort(String string)
+ {
+ return getShort(new AMQShortString(string));
+ }
+
+ public Short getShort(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.SHORT))
+ {
+ return (Short)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Integer getInteger(String string)
+ {
+ return getInteger(new AMQShortString(string));
+ }
+
+ public Integer getInteger(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.INT))
+ {
+ return (Integer)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Long getLong(String string)
+ {
+ return getLong(new AMQShortString(string));
+ }
+
+ public Long getLong(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.LONG))
+ {
+ return (Long)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Float getFloat(String string)
+ {
+ return getFloat(new AMQShortString(string));
+ }
+
+ public Float getFloat(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.FLOAT))
+ {
+ return (Float)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Double getDouble(String string)
+ {
+ return getDouble(new AMQShortString(string));
+ }
+
+ public Double getDouble(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.DOUBLE))
+ {
+ return (Double)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String getString(String string)
+ {
+ return getString(new AMQShortString(string));
+ }
+
+ public String getString(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && ((value.getType() == AMQType.WIDE_STRING) || (value.getType() == AMQType.ASCII_STRING)))
+ {
+ return (String)value.getValue();
+ }
+ else if ((value != null) && (value.getValue() != null) && !(value.getValue() instanceof byte[]))
+ {
+ return String.valueOf(value.getValue());
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+
+ public Character getCharacter(String string)
+ {
+ return getCharacter(new AMQShortString(string));
+ }
+
+ public Character getCharacter(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.ASCII_CHARACTER))
+ {
+ return (Character)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public byte[] getBytes(String string)
+ {
+ return getBytes(new AMQShortString(string));
+ }
+
+ public byte[] getBytes(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if ((value != null) && (value.getType() == AMQType.BINARY))
+ {
+ return (byte[])value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Extracts a value from the field table that is itself a FieldTable associated with the specified parameter name.
+ *
+ * @param string The name of the parameter to get the associated FieldTable value for.
+ *
+ * @return The associated FieldTable value, or <tt>null</tt> if the associated value is not of FieldTable type or
+ * not present in the field table at all.
+ */
+ public FieldTable getFieldTable(String string)
+ {
+ return getFieldTable(new AMQShortString(string));
+ }
+
+ /**
+ * Extracts a value from the field table that is itself a FieldTable associated with the specified parameter name.
+ *
+ * @param string The name of the parameter to get the associated FieldTable value for.
+ *
+ * @return The associated FieldTable value, or <tt>null</tt> if the associated value is not of FieldTable type or
+ * not present in the field table at all.
+ */
+ public FieldTable getFieldTable(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+
+ if ((value != null) && (value.getType() == AMQType.FIELD_TABLE))
+ {
+ return (FieldTable)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Object getObject(String string)
+ {
+ return getObject(new AMQShortString(string));
+ }
+
+ public Object getObject(AMQShortString string)
+ {
+ AMQTypedValue value = getProperty(string);
+ if (value != null)
+ {
+ return value.getValue();
+ }
+ else
+ {
+ return value;
+ }
+
+ }
+
+ public Long getTimestamp(AMQShortString name)
+ {
+ AMQTypedValue value = getProperty(name);
+ if ((value != null) && (value.getType() == AMQType.TIMESTAMP))
+ {
+ return (Long)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public BigDecimal getDecimal(AMQShortString propertyName)
+ {
+ AMQTypedValue value = getProperty(propertyName);
+ if ((value != null) && (value.getType() == AMQType.DECIMAL))
+ {
+ return (BigDecimal)value.getValue();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ // ************ Setters
+ public Object setBoolean(String string, Boolean b)
+ {
+ return setBoolean(new AMQShortString(string), b);
+ }
+
+ public Object setBoolean(AMQShortString string, Boolean b)
+ {
+ return setProperty(string, AMQType.BOOLEAN.asTypedValue(b));
+ }
+
+ public Object setByte(String string, Byte b)
+ {
+ return setByte(new AMQShortString(string), b);
+ }
+
+ public Object setByte(AMQShortString string, Byte b)
+ {
+ return setProperty(string, AMQType.BYTE.asTypedValue(b));
+ }
+
+ public Object setShort(String string, Short i)
+ {
+ return setShort(new AMQShortString(string), i);
+ }
+
+ public Object setShort(AMQShortString string, Short i)
+ {
+ return setProperty(string, AMQType.SHORT.asTypedValue(i));
+ }
+
+ public Object setInteger(String string, Integer i)
+ {
+ return setInteger(new AMQShortString(string), i);
+ }
+
+ public Object setInteger(AMQShortString string, Integer i)
+ {
+ return setProperty(string, AMQType.INT.asTypedValue(i));
+ }
+
+ public Object setLong(String string, Long l)
+ {
+ return setLong(new AMQShortString(string), l);
+ }
+
+ public Object setLong(AMQShortString string, Long l)
+ {
+ return setProperty(string, AMQType.LONG.asTypedValue(l));
+ }
+
+ public Object setFloat(String string, Float f)
+ {
+ return setFloat(new AMQShortString(string), f);
+ }
+
+ public Object setFloat(AMQShortString string, Float v)
+ {
+ return setProperty(string, AMQType.FLOAT.asTypedValue(v));
+ }
+
+ public Object setDouble(String string, Double d)
+ {
+ return setDouble(new AMQShortString(string), d);
+ }
+
+ public Object setDouble(AMQShortString string, Double v)
+ {
+ return setProperty(string, AMQType.DOUBLE.asTypedValue(v));
+ }
+
+ public Object setString(String string, String s)
+ {
+ return setString(new AMQShortString(string), s);
+ }
+
+ public Object setAsciiString(AMQShortString string, String value)
+ {
+ if (value == null)
+ {
+ return setProperty(string, AMQType.VOID.asTypedValue(null));
+ }
+ else
+ {
+ return setProperty(string, AMQType.ASCII_STRING.asTypedValue(value));
+ }
+ }
+
+ public Object setString(AMQShortString string, String value)
+ {
+ if (value == null)
+ {
+ return setProperty(string, AMQType.VOID.asTypedValue(null));
+ }
+ else
+ {
+ return setProperty(string, AMQType.LONG_STRING.asTypedValue(value));
+ }
+ }
+
+ public Object setChar(String string, char c)
+ {
+ return setChar(new AMQShortString(string), c);
+ }
+
+ public Object setChar(AMQShortString string, char c)
+ {
+ return setProperty(string, AMQType.ASCII_CHARACTER.asTypedValue(c));
+ }
+
+ public Object setBytes(String string, byte[] b)
+ {
+ return setBytes(new AMQShortString(string), b);
+ }
+
+ public Object setBytes(AMQShortString string, byte[] bytes)
+ {
+ return setProperty(string, AMQType.BINARY.asTypedValue(bytes));
+ }
+
+ public Object setBytes(String string, byte[] bytes, int start, int length)
+ {
+ return setBytes(new AMQShortString(string), bytes, start, length);
+ }
+
+ public Object setBytes(AMQShortString string, byte[] bytes, int start, int length)
+ {
+ byte[] newBytes = new byte[length];
+ System.arraycopy(bytes, start, newBytes, 0, length);
+
+ return setBytes(string, bytes);
+ }
+
+ public Object setObject(String string, Object o)
+ {
+ return setObject(new AMQShortString(string), o);
+ }
+
+ public Object setTimestamp(AMQShortString string, long datetime)
+ {
+ return setProperty(string, AMQType.TIMESTAMP.asTypedValue(datetime));
+ }
+
+ public Object setDecimal(AMQShortString string, BigDecimal decimal)
+ {
+ if (decimal.longValue() > Integer.MAX_VALUE)
+ {
+ throw new UnsupportedOperationException("AMQP doesnot support decimals larger than " + Integer.MAX_VALUE);
+ }
+
+ if (decimal.scale() > Byte.MAX_VALUE)
+ {
+ throw new UnsupportedOperationException("AMQP doesnot support decimal scales larger than " + Byte.MAX_VALUE);
+ }
+
+ return setProperty(string, AMQType.DECIMAL.asTypedValue(decimal));
+ }
+
+ public Object setVoid(AMQShortString string)
+ {
+ return setProperty(string, AMQType.VOID.asTypedValue(null));
+ }
+
+ /**
+ * Associates a nested field table with the specified parameter name.
+ *
+ * @param string The name of the parameter to store in the table.
+ * @param ftValue The field table value to associate with the parameter name.
+ *
+ * @return The stored value.
+ */
+ public Object setFieldTable(String string, FieldTable ftValue)
+ {
+ return setFieldTable(new AMQShortString(string), ftValue);
+ }
+
+ /**
+ * Associates a nested field table with the specified parameter name.
+ *
+ * @param string The name of the parameter to store in the table.
+ * @param ftValue The field table value to associate with the parameter name.
+ *
+ * @return The stored value.
+ */
+ public Object setFieldTable(AMQShortString string, FieldTable ftValue)
+ {
+ return setProperty(string, AMQType.FIELD_TABLE.asTypedValue(ftValue));
+ }
+
+ public Object setObject(AMQShortString string, Object object)
+ {
+ if (object instanceof Boolean)
+ {
+ return setBoolean(string, (Boolean)object);
+ }
+ else if (object instanceof Byte)
+ {
+ return setByte(string, (Byte)object);
+ }
+ else if (object instanceof Short)
+ {
+ return setShort(string, (Short)object);
+ }
+ else if (object instanceof Integer)
+ {
+ return setInteger(string, (Integer)object);
+ }
+ else if (object instanceof Long)
+ {
+ return setLong(string, (Long)object);
+ }
+ else if (object instanceof Float)
+ {
+ return setFloat(string, (Float)object);
+ }
+ else if (object instanceof Double)
+ {
+ return setDouble(string, (Double)object);
+ }
+ else if (object instanceof String)
+ {
+ return setString(string, (String)object);
+ }
+ else if (object instanceof Character)
+ {
+ return setChar(string, (Character)object);
+ }
+ else if (object instanceof byte[])
+ {
+ return setBytes(string, (byte[])object);
+ }
+
+ throw new AMQPInvalidClassException("Only Primatives objects allowed Object is:" + object.getClass());
+ }
+
+ public boolean isNullStringValue(String name)
+ {
+ AMQTypedValue value = getProperty(new AMQShortString(name));
+
+ return (value != null) && (value.getType() == AMQType.VOID);
+ }
+
+ // ***** Methods
+
+ public Enumeration getPropertyNames()
+ {
+ return Collections.enumeration(keys());
+ }
+
+ public boolean propertyExists(AMQShortString propertyName)
+ {
+ return itemExists(propertyName);
+ }
+
+ public boolean propertyExists(String propertyName)
+ {
+ return itemExists(propertyName);
+ }
+
+ public boolean itemExists(AMQShortString propertyName)
+ {
+ checkPropertyName(propertyName);
+ initMapIfNecessary();
+
+ return _properties.containsKey(propertyName);
+ }
+
+ public boolean itemExists(String string)
+ {
+ return itemExists(new AMQShortString(string));
+ }
+
+ public String toString()
+ {
+ initMapIfNecessary();
+
+ return _properties.toString();
+ }
+
+ private void checkPropertyName(AMQShortString propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("Property name must not be null");
+ }
+ else if (propertyName.length() == 0)
+ {
+ throw new IllegalArgumentException("Property name must not be the empty string");
+ }
+
+ if (_strictAMQP)
+ {
+ checkIdentiferFormat(propertyName);
+ }
+ }
+
+ protected static void checkIdentiferFormat(AMQShortString propertyName)
+ {
+ // AMQP Spec: 4.2.5.5 Field Tables
+ // Guidelines for implementers:
+ // * Field names MUST start with a letter, '$' or '#' and may continue with
+ // letters, '$' or '#', digits, or underlines, to a maximum length of 128
+ // characters.
+ // * The server SHOULD validate field names and upon receiving an invalid
+ // field name, it SHOULD signal a connection exception with reply code
+ // 503 (syntax error). Conformance test: amq_wlp_table_01.
+ // * A peer MUST handle duplicate fields by using only the first instance.
+
+ // AMQP length limit
+ if (propertyName.length() > 128)
+ {
+ throw new IllegalArgumentException("AMQP limits property names to 128 characters");
+ }
+
+ // AMQ start character
+ if (!(Character.isLetter(propertyName.charAt(0)) || (propertyName.charAt(0) == '$') ||
+ (propertyName.charAt(0) == '#') || (propertyName.charAt(0) == '_'))) // Not official AMQP added for JMS.
+ {
+ throw new IllegalArgumentException("Identifier '" + propertyName +
+ "' does not start with a valid AMQP start character");
+ }
+ }
+
+ // ************************* Byte Buffer Processing
+
+ public void writeToBuffer(MessagingBuffer buffer)
+ {
+ final boolean trace = _logger.isDebugEnabled();
+
+ if (trace)
+ {
+ _logger.debug("FieldTable::writeToBuffer: Writing encoded length of " + getEncodedSize() + "...");
+ if (_properties != null)
+ {
+ _logger.debug(_properties.toString());
+ }
+ }
+
+ EncodingUtils.writeUnsignedInteger(buffer, getEncodedSize());
+
+ putDataInBuffer(buffer);
+ }
+
+ public byte[] getDataAsBytes()
+ {
+ final int encodedSize = (int)getEncodedSize();
+ final MessagingBuffer buffer = new ByteBufferWrapper(ByteBuffer.allocate(encodedSize)); // FIXME XXX: Is cast a
+ // problem?
+
+ putDataInBuffer(buffer);
+
+ final byte[] result = new byte[encodedSize];
+ buffer.flip();
+ buffer.getBytes(result);
+ // FIXME
+ // buffer.release();
+
+ return result;
+ }
+
+ public long getEncodedSize()
+ {
+ return _encodedSize;
+ }
+
+ private void recalculateEncodedSize()
+ {
+
+ int encodedSize = 0;
+ if (_properties != null)
+ {
+ for (Map.Entry<AMQShortString, AMQTypedValue> e : _properties.entrySet())
+ {
+ encodedSize += EncodingUtils.encodedShortStringLength(e.getKey());
+ encodedSize++; // the byte for the encoding Type
+ encodedSize += e.getValue().getEncodingSize();
+
+ }
+ }
+
+ _encodedSize = encodedSize;
+ }
+
+ public void addAll(FieldTable fieldTable)
+ {
+ initMapIfNecessary();
+ _encodedForm = null;
+ _properties.putAll(fieldTable._properties);
+ recalculateEncodedSize();
+ }
+
+ public static interface FieldTableElementProcessor
+ {
+ public boolean processElement(String propertyName, AMQTypedValue value);
+
+ public Object getResult();
+ }
+
+ public Object processOverElements(FieldTableElementProcessor processor)
+ {
+ initMapIfNecessary();
+ if (_properties != null)
+ {
+ for (Map.Entry<AMQShortString, AMQTypedValue> e : _properties.entrySet())
+ {
+ boolean result = processor.processElement(e.getKey().toString(), e.getValue());
+ if (!result)
+ {
+ break;
+ }
+ }
+ }
+
+ return processor.getResult();
+
+ }
+
+ public int size()
+ {
+ initMapIfNecessary();
+
+ return _properties.size();
+
+ }
+
+ public boolean isEmpty()
+ {
+ return size() == 0;
+ }
+
+ public boolean containsKey(AMQShortString key)
+ {
+ initMapIfNecessary();
+
+ return _properties.containsKey(key);
+ }
+
+ public boolean containsKey(String key)
+ {
+ return containsKey(new AMQShortString(key));
+ }
+
+ public Set<String> keys()
+ {
+ initMapIfNecessary();
+ Set<String> keys = new LinkedHashSet<String>();
+ for (AMQShortString key : _properties.keySet())
+ {
+ keys.add(key.toString());
+ }
+
+ return keys;
+ }
+
+ public Iterator<Map.Entry<AMQShortString, AMQTypedValue>> iterator()
+ {
+ if (_encodedForm != null)
+ {
+ return new FieldTableIterator(_encodedForm.slice(), (int)_encodedSize);
+ }
+ else
+ {
+ initMapIfNecessary();
+ return _properties.entrySet().iterator();
+ }
+ }
+
+ public Object get(AMQShortString key)
+ {
+
+ return getObject(key);
+ }
+
+ public Object put(AMQShortString key, Object value)
+ {
+ return setObject(key, value);
+ }
+
+ public Object remove(String key)
+ {
+
+ return remove(new AMQShortString(key));
+
+ }
+
+ public Object remove(AMQShortString key)
+ {
+ AMQTypedValue val = removeKey(key);
+
+ return (val == null) ? null : val.getValue();
+
+ }
+
+ public AMQTypedValue removeKey(AMQShortString key)
+ {
+ initMapIfNecessary();
+ _encodedForm = null;
+ AMQTypedValue value = _properties.remove(key);
+ if (value == null)
+ {
+ return null;
+ }
+ else
+ {
+ _encodedSize -= EncodingUtils.encodedShortStringLength(key);
+ _encodedSize--;
+ _encodedSize -= value.getEncodingSize();
+
+ return value;
+ }
+
+ }
+
+ public void clear()
+ {
+ initMapIfNecessary();
+ _encodedForm = null;
+ _properties.clear();
+ _encodedSize = 0;
+ }
+
+ public Set<AMQShortString> keySet()
+ {
+ initMapIfNecessary();
+
+ return _properties.keySet();
+ }
+
+ private void putDataInBuffer(MessagingBuffer buffer)
+ {
+
+ if (_encodedForm != null)
+ {
+ buffer.putBytes(_encodedForm.array(), _encodedForm.position(), (int)_encodedSize);
+ }
+ else if (_properties != null)
+ {
+ final Iterator<Map.Entry<AMQShortString, AMQTypedValue>> it = _properties.entrySet().iterator();
+
+ // If there are values then write out the encoded Size... could check _encodedSize != 0
+ // write out the total length, which we have kept up to date as data is added
+
+ while (it.hasNext())
+ {
+ final Map.Entry<AMQShortString, AMQTypedValue> me = it.next();
+ try
+ {
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Writing Property:" + me.getKey() +
+ " Type:" +
+ me.getValue().getType() +
+ " Value:" +
+ me.getValue().getValue());
+ _logger.debug("Buffer Position:" + buffer.position() + " Remaining:" + buffer.remaining());
+ }
+
+ // Write the actual parameter name
+ EncodingUtils.writeShortStringBytes(buffer, me.getKey());
+ me.getValue().writeToBuffer(buffer);
+ }
+ catch (Exception e)
+ {
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Exception thrown:" + e);
+ _logger.debug("Writing Property:" + me.getKey() +
+ " Type:" +
+ me.getValue().getType() +
+ " Value:" +
+ me.getValue().getValue());
+ _logger.debug("Buffer Position:" + buffer.position() + " Remaining:" + buffer.remaining());
+ }
+
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void setFromBuffer(MessagingBuffer buffer, long length) throws AMQFrameDecodingException
+ {
+
+ final boolean trace = _logger.isDebugEnabled();
+ if (length > 0)
+ {
+
+ final int expectedRemaining = buffer.remaining() - (int)length;
+
+ _properties = new LinkedHashMap<AMQShortString, AMQTypedValue>(INITIAL_HASHMAP_CAPACITY);
+
+ do
+ {
+
+ final AMQShortString key = EncodingUtils.readAMQShortString(buffer);
+ AMQTypedValue value = AMQTypedValue.readFromBuffer(buffer);
+
+ if (trace)
+ {
+ _logger.debug("FieldTable::PropFieldTable(buffer," + length +
+ "): Read type '" +
+ value.getType() +
+ "', key '" +
+ key +
+ "', value '" +
+ value.getValue() +
+ "'");
+ }
+
+ _properties.put(key, value);
+
+ }
+ while (buffer.remaining() > expectedRemaining);
+
+ }
+
+ _encodedSize = length;
+
+ if (trace)
+ {
+ _logger.debug("FieldTable::FieldTable(buffer," + length + "): Done.");
+ }
+ }
+
+ private static final class FieldTableEntry implements Map.Entry<AMQShortString, AMQTypedValue>
+ {
+ private final AMQTypedValue _value;
+
+ private final AMQShortString _key;
+
+ public FieldTableEntry(final AMQShortString key, final AMQTypedValue value)
+ {
+ _key = key;
+ _value = value;
+ }
+
+ public AMQShortString getKey()
+ {
+ return _key;
+ }
+
+ public AMQTypedValue getValue()
+ {
+ return _value;
+ }
+
+ public AMQTypedValue setValue(final AMQTypedValue value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o instanceof FieldTableEntry)
+ {
+ FieldTableEntry other = (FieldTableEntry)o;
+ return (_key == null ? other._key == null : _key.equals(other._key)) && (_value == null ? other._value == null
+ : _value.equals(other._value));
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ return (getKey() == null ? 0 : getKey().hashCode()) ^ (getValue() == null ? 0 : getValue().hashCode());
+ }
+
+ }
+
+ private static final class FieldTableIterator implements Iterator<Map.Entry<AMQShortString, AMQTypedValue>>
+ {
+
+ private final MessagingBuffer _buffer;
+
+ private int _expectedRemaining;
+
+ public FieldTableIterator(MessagingBuffer buffer, int length)
+ {
+ _buffer = buffer;
+ _expectedRemaining = buffer.remaining() - length;
+ }
+
+ public boolean hasNext()
+ {
+ return (_buffer.remaining() > _expectedRemaining);
+ }
+
+ public Map.Entry<AMQShortString, AMQTypedValue> next()
+ {
+ if (hasNext())
+ {
+ final AMQShortString key = EncodingUtils.readAMQShortString(_buffer);
+ AMQTypedValue value = AMQTypedValue.readFromBuffer(_buffer);
+ return new FieldTableEntry(key, value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public int hashCode()
+ {
+ initMapIfNecessary();
+
+ return _properties.hashCode();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+
+ if (o == null)
+ {
+ return false;
+ }
+
+ if (!(o instanceof FieldTable))
+ {
+ return false;
+ }
+
+ initMapIfNecessary();
+
+ FieldTable f = (FieldTable)o;
+ f.initMapIfNecessary();
+
+ return _properties.equals(f._properties);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTableFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTableFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/FieldTableFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A FieldTableFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class FieldTableFactory
+{
+ public static FieldTable newFieldTable()
+ {
+ return new FieldTable();
+ }
+
+ public static FieldTable newFieldTable(MessagingBuffer byteBuffer, long length) throws AMQFrameDecodingException
+ {
+ return new FieldTable(byteBuffer, length);
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,77 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A HeartbeatBody
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class HeartbeatBody implements AMQBody
+{
+ public static final byte TYPE = 8;
+ public static AMQFrame FRAME = new HeartbeatBody().toFrame();
+
+ public HeartbeatBody()
+ {
+
+ }
+
+ public HeartbeatBody(MessagingBuffer buffer, long size)
+ {
+ if(size > 0)
+ {
+ //allow other implementations to have a payload, but ignore it:
+ buffer.skip((int) size);
+ }
+ }
+
+ public byte getFrameType()
+ {
+ return TYPE;
+ }
+
+ public int getSize()
+ {
+ return 0;//heartbeats we generate have no payload
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ }
+
+ protected void populateFromBuffer(MessagingBuffer buffer, long size) throws AMQFrameDecodingException
+ {
+ if(size > 0)
+ {
+ //allow other implementations to have a payload, but ignore it:
+ buffer.skip((int) size);
+ }
+ }
+
+ public AMQFrame toFrame()
+ {
+ return new AMQFrame(0, this);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBodyFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBodyFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/HeartbeatBodyFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A HeartbeatBodyFactory
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class HeartbeatBodyFactory implements BodyFactory
+{
+ public AMQBody createBody(MessagingBuffer in, long bodySize) throws AMQFrameDecodingException
+ {
+ return new HeartbeatBody();
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageAppendBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageAppendBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageAppendBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageAppendBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getBytes();
+
+ public byte[] getReference();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCancelBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCancelBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCancelBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageCancelBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getDestination();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCheckpointBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCheckpointBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCheckpointBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageCheckpointBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getIdentifier();
+
+ public byte[] getReference();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCloseBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCloseBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageCloseBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageCloseBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getReference();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageConsumeBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageConsumeBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageConsumeBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,59 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageConsumeBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getDestination();
+
+ public boolean getExclusive();
+
+ public FieldTable getFilter();
+
+ public boolean getNoAck();
+
+ public boolean getNoLocal();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageEmptyBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageEmptyBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageEmptyBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageEmptyBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageGetBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageGetBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageGetBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,53 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageGetBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getDestination();
+
+ public boolean getNoAck();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOffsetBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOffsetBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOffsetBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageOffsetBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getValue();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOpenBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOpenBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageOpenBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageOpenBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getReference();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageQosBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageQosBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageQosBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageQosBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getGlobal();
+
+ public int getPrefetchCount();
+
+ public long getPrefetchSize();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRecoverBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRecoverBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRecoverBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageRecoverBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getRequeue();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRejectBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRejectBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageRejectBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageRejectBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public int getCode();
+
+ public AMQShortString getText();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageResumeBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageResumeBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageResumeBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageResumeBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getIdentifier();
+
+ public byte[] getReference();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageTransferBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageTransferBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MessageTransferBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,89 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface MessageTransferBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public AMQShortString getAppId();
+
+ public FieldTable getApplicationHeaders();
+
+ public Content getBody();
+
+ public AMQShortString getContentEncoding();
+
+ public AMQShortString getContentType();
+
+ public AMQShortString getCorrelationId();
+
+ public short getDeliveryMode();
+
+ public AMQShortString getDestination();
+
+ public AMQShortString getExchange();
+
+ public long getExpiration();
+
+ public boolean getImmediate();
+
+ public AMQShortString getMessageId();
+
+ public short getPriority();
+
+ public boolean getRedelivered();
+
+ public AMQShortString getReplyTo();
+
+ public AMQShortString getRoutingKey();
+
+ public byte[] getSecurityToken();
+
+ public int getTicket();
+
+ public long getTimestamp();
+
+ public AMQShortString getTransactionId();
+
+ public long getTtl();
+
+ public AMQShortString getUserId();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MethodRegistry.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MethodRegistry.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/MethodRegistry.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,330 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify. Supported
+ * AMQP version: 0-9 8-0
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.messaging.amq.framing.amqp_0_9.MethodRegistry_0_9;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A MethodRegistry
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public abstract class MethodRegistry
+{
+ private static final Map<ProtocolVersion, MethodRegistry> _registries = new HashMap<ProtocolVersion, MethodRegistry>();
+
+ // FIXME
+ public static final MethodRegistry registry_0_9 = new MethodRegistry_0_9();
+
+ public abstract AMQMethodBody convertToBody(MessagingBuffer in, long size) throws AMQFrameDecodingException;
+
+ public abstract int getMaxClassId();
+
+ public abstract int getMaxMethodId(int classId);
+
+ protected MethodRegistry(final ProtocolVersion pv)
+ {
+ _registries.put(pv, this);
+ }
+
+ public static MethodRegistry getMethodRegistry(final ProtocolVersion pv)
+ {
+ return _registries.get(pv);
+ }
+
+ /*
+ public abstract AccessRequestOkBody createAccessRequestOkBody(final int ticket);
+
+ public abstract BasicAckBody createBasicAckBody(final long deliveryTag, final boolean multiple);
+
+ public abstract BasicCancelBody createBasicCancelBody(final AMQShortString consumerTag, final boolean nowait);
+
+ public abstract BasicCancelOkBody createBasicCancelOkBody(final AMQShortString consumerTag);
+
+ public abstract BasicConsumeBody createBasicConsumeBody(final int ticket,
+ final AMQShortString queue,
+ final AMQShortString consumerTag,
+ final boolean noLocal,
+ final boolean noAck,
+ final boolean exclusive,
+ final boolean nowait,
+ final FieldTable arguments);
+
+ public abstract BasicConsumeOkBody createBasicConsumeOkBody(final AMQShortString consumerTag);
+
+ public abstract BasicDeliverBody createBasicDeliverBody(final AMQShortString consumerTag,
+ final long deliveryTag,
+ final boolean redelivered,
+ final AMQShortString exchange,
+ final AMQShortString routingKey);
+
+ public abstract BasicGetBody createBasicGetBody(final int ticket, final AMQShortString queue, final boolean noAck);
+
+ public abstract BasicGetEmptyBody createBasicGetEmptyBody(final AMQShortString clusterId);
+
+ public abstract BasicGetOkBody createBasicGetOkBody(final long deliveryTag,
+ final boolean redelivered,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final long messageCount);
+
+ public abstract BasicPublishBody createBasicPublishBody(final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean mandatory,
+ final boolean immediate);
+
+ public abstract BasicQosBody createBasicQosBody(final long prefetchSize,
+ final int prefetchCount,
+ final boolean global);
+
+ public abstract BasicQosOkBody createBasicQosOkBody();
+
+ public abstract BasicRecoverBody createBasicRecoverBody(final boolean requeue);
+
+ public abstract BasicRejectBody createBasicRejectBody(final long deliveryTag, final boolean requeue);
+
+ public abstract BasicReturnBody createBasicReturnBody(final int replyCode,
+ final AMQShortString replyText,
+ final AMQShortString exchange,
+ final AMQShortString routingKey);
+
+ public abstract ChannelCloseBody createChannelCloseBody(final int replyCode,
+ final AMQShortString replyText,
+ final int classId,
+ final int methodId);
+
+ */public abstract ChannelCloseOkBody createChannelCloseOkBody();
+
+ /*
+ public abstract ChannelFlowBody createChannelFlowBody(final boolean active);
+
+ public abstract ChannelFlowOkBody createChannelFlowOkBody(final boolean active);
+
+ public abstract ChannelOpenBody createChannelOpenBody(final AMQShortString outOfBand);
+
+ */
+ public abstract ConnectionCloseBody createConnectionCloseBody(final int replyCode,
+ final AMQShortString replyText,
+ final int classId,
+ final int methodId);
+
+ /*
+ public abstract ConnectionCloseOkBody createConnectionCloseOkBody();
+
+ public abstract ConnectionOpenBody createConnectionOpenBody(final AMQShortString virtualHost,
+ final AMQShortString capabilities,
+ final boolean insist);
+
+ */
+ public abstract ConnectionOpenOkBody createConnectionOpenOkBody(final AMQShortString knownHosts);
+
+ /*
+ public abstract ConnectionRedirectBody createConnectionRedirectBody(final AMQShortString host,
+ final AMQShortString knownHosts);
+
+ public abstract ConnectionSecureBody createConnectionSecureBody(final byte[] challenge);
+
+ public abstract ConnectionSecureOkBody createConnectionSecureOkBody(final byte[] response);
+
+ */
+ public abstract ConnectionStartBody createConnectionStartBody(final short versionMajor,
+ final short versionMinor,
+ final FieldTable serverProperties,
+ final byte[] mechanisms,
+ final byte[] locales);
+
+ public abstract ConnectionStartOkBody createConnectionStartOkBody(final FieldTable clientProperties,
+ final AMQShortString mechanism,
+ final byte[] response,
+ final AMQShortString locale);
+
+ public abstract ConnectionTuneBody createConnectionTuneBody(final int channelMax,
+ final long frameMax,
+ final int heartbeat);
+
+ /*
+ public abstract ConnectionTuneOkBody createConnectionTuneOkBody(final int channelMax,
+ final long frameMax,
+ final int heartbeat);
+
+ public abstract DtxSelectBody createDtxSelectBody();
+
+ public abstract DtxSelectOkBody createDtxSelectOkBody();
+
+ public abstract DtxStartBody createDtxStartBody(final AMQShortString dtxIdentifier);
+
+ public abstract DtxStartOkBody createDtxStartOkBody();
+
+ public abstract ExchangeBoundBody createExchangeBoundBody(final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final AMQShortString queue);
+
+ public abstract ExchangeBoundOkBody createExchangeBoundOkBody(final int replyCode, final AMQShortString replyText);
+
+ public abstract ExchangeDeclareBody createExchangeDeclareBody(final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString type,
+ final boolean passive,
+ final boolean durable,
+ final boolean autoDelete,
+ final boolean internal,
+ final boolean nowait,
+ final FieldTable arguments);
+
+ public abstract ExchangeDeclareOkBody createExchangeDeclareOkBody();
+
+ public abstract ExchangeDeleteBody createExchangeDeleteBody(final int ticket,
+ final AMQShortString exchange,
+ final boolean ifUnused,
+ final boolean nowait);
+
+ public abstract ExchangeDeleteOkBody createExchangeDeleteOkBody();
+
+ public abstract FileAckBody createFileAckBody(final long deliveryTag, final boolean multiple);
+
+ public abstract FileCancelBody createFileCancelBody(final AMQShortString consumerTag, final boolean nowait);
+
+ public abstract FileCancelOkBody createFileCancelOkBody(final AMQShortString consumerTag);
+
+ public abstract FileConsumeOkBody createFileConsumeOkBody(final AMQShortString consumerTag);
+
+ public abstract FileDeliverBody createFileDeliverBody(final AMQShortString consumerTag,
+ final long deliveryTag,
+ final boolean redelivered,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final AMQShortString identifier);
+
+ public abstract FileOpenBody createFileOpenBody(final AMQShortString identifier, final long contentSize);
+
+ public abstract FileOpenOkBody createFileOpenOkBody(final long stagedSize);
+
+ public abstract FilePublishBody createFilePublishBody(final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean mandatory,
+ final boolean immediate,
+ final AMQShortString identifier);
+
+ public abstract FileQosBody createFileQosBody(final long prefetchSize, final int prefetchCount, final boolean global);
+
+ public abstract FileQosOkBody createFileQosOkBody();
+
+ public abstract FileRejectBody createFileRejectBody(final long deliveryTag, final boolean requeue);
+
+ public abstract FileReturnBody createFileReturnBody(final int replyCode,
+ final AMQShortString replyText,
+ final AMQShortString exchange,
+ final AMQShortString routingKey);
+
+ public abstract FileStageBody createFileStageBody();
+
+ public abstract QueueBindBody createQueueBindBody(final int ticket,
+ final AMQShortString queue,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean nowait,
+ final FieldTable arguments);
+
+ public abstract QueueBindOkBody createQueueBindOkBody();
+
+ public abstract QueueDeclareBody createQueueDeclareBody(final int ticket,
+ final AMQShortString queue,
+ final boolean passive,
+ final boolean durable,
+ final boolean exclusive,
+ final boolean autoDelete,
+ final boolean nowait,
+ final FieldTable arguments);
+
+ public abstract QueueDeclareOkBody createQueueDeclareOkBody(final AMQShortString queue,
+ final long messageCount,
+ final long consumerCount);
+
+ public abstract QueueDeleteBody createQueueDeleteBody(final int ticket,
+ final AMQShortString queue,
+ final boolean ifUnused,
+ final boolean ifEmpty,
+ final boolean nowait);
+
+ public abstract QueueDeleteOkBody createQueueDeleteOkBody(final long messageCount);
+
+ public abstract QueuePurgeBody createQueuePurgeBody(final int ticket,
+ final AMQShortString queue,
+ final boolean nowait);
+
+ public abstract QueuePurgeOkBody createQueuePurgeOkBody(final long messageCount);
+
+ public abstract StreamCancelBody createStreamCancelBody(final AMQShortString consumerTag, final boolean nowait);
+
+ public abstract StreamCancelOkBody createStreamCancelOkBody(final AMQShortString consumerTag);
+
+ public abstract StreamConsumeOkBody createStreamConsumeOkBody(final AMQShortString consumerTag);
+
+ public abstract StreamDeliverBody createStreamDeliverBody(final AMQShortString consumerTag,
+ final long deliveryTag,
+ final AMQShortString exchange,
+ final AMQShortString queue);
+
+ public abstract StreamPublishBody createStreamPublishBody(final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean mandatory,
+ final boolean immediate);
+
+ public abstract StreamQosBody createStreamQosBody(final long prefetchSize,
+ final int prefetchCount,
+ final long consumeRate,
+ final boolean global);
+
+ public abstract StreamQosOkBody createStreamQosOkBody();
+
+ public abstract StreamReturnBody createStreamReturnBody(final int replyCode,
+ final AMQShortString replyText,
+ final AMQShortString exchange,
+ final AMQShortString routingKey);
+
+ public abstract TunnelRequestBody createTunnelRequestBody(final FieldTable metaData);
+
+ public abstract TxCommitBody createTxCommitBody();
+
+ public abstract TxCommitOkBody createTxCommitOkBody();
+
+ public abstract TxRollbackBody createTxRollbackBody();
+
+ public abstract TxRollbackOkBody createTxRollbackOkBody();
+
+ public abstract TxSelectBody createTxSelectBody();
+
+ public abstract TxSelectOkBody createTxSelectOkBody();
+
+ */
+
+}
\ No newline at end of file
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolInitiation.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolInitiation.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolInitiation.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,201 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.framing;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.jboss.messaging.amq.AMQException;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A ProtocolInitiation
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ProtocolInitiation extends AMQDataBlock implements EncodableAMQDataBlock
+{
+
+ // TODO: generate these constants automatically from the xml protocol spec file
+ public static final byte[] AMQP_HEADER = new byte[]{(byte)'A',(byte)'M',(byte)'Q',(byte)'P'};
+
+ private static final byte CURRENT_PROTOCOL_CLASS = 1;
+ private static final byte TCP_PROTOCOL_INSTANCE = 1;
+
+ public final byte[] _protocolHeader;
+ public final byte _protocolClass;
+ public final byte _protocolInstance;
+ public final byte _protocolMajor;
+ public final byte _protocolMinor;
+
+
+// public ProtocolInitiation() {}
+
+ public ProtocolInitiation(byte[] protocolHeader, byte protocolClass, byte protocolInstance, byte protocolMajor, byte protocolMinor)
+ {
+ _protocolHeader = protocolHeader;
+ _protocolClass = protocolClass;
+ _protocolInstance = protocolInstance;
+ _protocolMajor = protocolMajor;
+ _protocolMinor = protocolMinor;
+ }
+
+ public ProtocolInitiation(ProtocolVersion pv)
+ {
+ this(AMQP_HEADER, CURRENT_PROTOCOL_CLASS, TCP_PROTOCOL_INSTANCE, pv.getMajorVersion(), pv.getMinorVersion());
+ }
+
+
+ public ProtocolInitiation(MessagingBuffer in)
+ {
+ _protocolHeader = new byte[4];
+ in.getBytes(_protocolHeader);
+
+ _protocolClass = in.getByte();
+ _protocolInstance = in.getByte();
+ _protocolMajor = in.getByte();
+ _protocolMinor = in.getByte();
+ }
+
+ public long getSize()
+ {
+ return 4 + 1 + 1 + 1 + 1;
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+
+ buffer.putBytes(_protocolHeader);
+ buffer.putByte(_protocolClass);
+ buffer.putByte(_protocolInstance);
+ buffer.putByte(_protocolMajor);
+ buffer.putByte(_protocolMinor);
+ }
+
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof ProtocolInitiation))
+ {
+ return false;
+ }
+
+ ProtocolInitiation pi = (ProtocolInitiation) o;
+ if (pi._protocolHeader == null)
+ {
+ return false;
+ }
+
+ if (_protocolHeader.length != pi._protocolHeader.length)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < _protocolHeader.length; i++)
+ {
+ if (_protocolHeader[i] != pi._protocolHeader[i])
+ {
+ return false;
+ }
+ }
+
+ return (_protocolClass == pi._protocolClass &&
+ _protocolInstance == pi._protocolInstance &&
+ _protocolMajor == pi._protocolMajor &&
+ _protocolMinor == pi._protocolMinor);
+ }
+
+ public static class Decoder //implements MessageDecoder
+ {
+ /**
+ *
+ * @param session the session
+ * @param in input buffer
+ * @return true if we have enough data to decode the PI frame fully, false if more
+ * data is required
+ */
+ public boolean decodable(IoSession session, MessagingBuffer in)
+ {
+ return (in.remaining() >= 8);
+ }
+
+ public void decode(IoSession session, MessagingBuffer in, ProtocolDecoderOutput out)
+ {
+ ProtocolInitiation pi = new ProtocolInitiation(in);
+ out.write(pi);
+ }
+ }
+
+ public ProtocolVersion checkVersion() throws AMQException
+ {
+
+ if(_protocolHeader.length != 4)
+ {
+ throw new AMQProtocolHeaderException("Protocol header should have exactly four octets", null);
+ }
+ for(int i = 0; i < 4; i++)
+ {
+ if(_protocolHeader[i] != AMQP_HEADER[i])
+ {
+ try
+ {
+ throw new AMQProtocolHeaderException("Protocol header is not correct: Got " + new String(_protocolHeader,"ISO-8859-1") + " should be: " + new String(AMQP_HEADER, "ISO-8859-1"), null);
+ }
+ catch (UnsupportedEncodingException e)
+ {
+
+ }
+ }
+ }
+ if (_protocolClass != CURRENT_PROTOCOL_CLASS)
+ {
+ throw new AMQProtocolClassException("Protocol class " + CURRENT_PROTOCOL_CLASS + " was expected; received " +
+ _protocolClass, null);
+ }
+ if (_protocolInstance != TCP_PROTOCOL_INSTANCE)
+ {
+ throw new AMQProtocolInstanceException("Protocol instance " + TCP_PROTOCOL_INSTANCE + " was expected; received " +
+ _protocolInstance, null);
+ }
+
+ ProtocolVersion pv = new ProtocolVersion(_protocolMajor, _protocolMinor);
+
+
+ if (!pv.isSupported())
+ {
+ // TODO: add list of available versions in list to msg...
+ throw new AMQProtocolVersionException("Protocol version " +
+ _protocolMajor + "." + _protocolMinor + " not suppoerted by this version of the Qpid broker.", null);
+ }
+ return pv;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer(new String(_protocolHeader));
+ buffer.append(Integer.toHexString(_protocolClass));
+ buffer.append(Integer.toHexString(_protocolInstance));
+ buffer.append(Integer.toHexString(_protocolMajor));
+ buffer.append(Integer.toHexString(_protocolMinor));
+ return buffer.toString();
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolVersion.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolVersion.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ProtocolVersion.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,179 @@
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+/*
+* This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+* Supported AMQP versions:
+* 0-9
+* 8-0
+*/
+
+package org.jboss.messaging.amq.framing;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+
+/**
+ * A ProtocolVersion
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ProtocolVersion implements Comparable
+{
+ private final byte _majorVersion;
+ private final byte _minorVersion;
+
+
+ public ProtocolVersion(byte majorVersion, byte minorVersion)
+ {
+ _majorVersion = majorVersion;
+ _minorVersion = minorVersion;
+ }
+
+ public byte getMajorVersion()
+ {
+ return _majorVersion;
+ }
+
+ public byte getMinorVersion()
+ {
+ return _minorVersion;
+ }
+
+
+ public int compareTo(Object o)
+ {
+ ProtocolVersion pv = (ProtocolVersion) o;
+
+ /*
+ * 0-8 has it's major and minor numbers the wrong way round (it's actually 8-0)...
+ * so we need to deal with that case specially
+ */
+
+ if((_majorVersion == (byte) 8) && (_minorVersion == (byte) 0))
+ {
+ ProtocolVersion fixedThis = new ProtocolVersion(_minorVersion, _majorVersion);
+ return fixedThis.compareTo(pv);
+ }
+
+ if((pv.getMajorVersion() == (byte) 8) && (pv.getMinorVersion() == (byte) 0))
+ {
+ ProtocolVersion fixedOther = new ProtocolVersion(pv.getMinorVersion(), pv.getMajorVersion());
+ return this.compareTo(fixedOther);
+ }
+
+ if(_majorVersion > pv.getMajorVersion())
+ {
+ return 1;
+ }
+ else if(_majorVersion < pv.getMajorVersion())
+ {
+ return -1;
+ }
+ else if(_minorVersion > pv.getMinorVersion())
+ {
+ return 1;
+ }
+ else if(getMinorVersion() < pv.getMinorVersion())
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+
+ }
+
+ public boolean equals(Object o)
+ {
+ return o != null && (o == this || (compareTo(o) == 0));
+ }
+
+ public int hashCode()
+ {
+ return (0xFF & (int)_minorVersion) | ((0xFF & (int)_majorVersion) << 8);
+ }
+
+
+ public boolean isSupported()
+ {
+ return _supportedVersions.contains(this);
+ }
+
+ public static ProtocolVersion getLatestSupportedVersion()
+ {
+ return _supportedVersions.last();
+ }
+
+ private static final SortedSet<ProtocolVersion> _supportedVersions;
+ private static final Map<String, ProtocolVersion> _nameToVersionMap =
+ new HashMap<String, ProtocolVersion>();
+ private static final ProtocolVersion _defaultVersion;
+
+
+ public static final ProtocolVersion v0_9 = new ProtocolVersion((byte)0,(byte)9);
+ public static final ProtocolVersion v8_0 = new ProtocolVersion((byte)8,(byte)0);
+
+ static
+ {
+ SortedSet<ProtocolVersion> versions = new TreeSet<ProtocolVersion>();
+
+ versions.add(v0_9);
+ _nameToVersionMap.put("0-9", v0_9);
+ versions.add(v8_0);
+ _nameToVersionMap.put("8-0", v8_0);
+ _supportedVersions = Collections.unmodifiableSortedSet(versions);
+
+
+ ProtocolVersion systemDefinedVersion =
+ _nameToVersionMap.get(System.getProperty("org.apache.qpid.amqp_version"));
+
+ _defaultVersion = (systemDefinedVersion == null)
+ ? getLatestSupportedVersion()
+ : systemDefinedVersion;
+ }
+
+
+ public static SortedSet<ProtocolVersion> getSupportedProtocolVersions()
+ {
+ return _supportedVersions;
+ }
+
+
+
+ public static ProtocolVersion parse(String name)
+ {
+ return _nameToVersionMap.get(name);
+ }
+
+ public static ProtocolVersion defaultProtocolVersion()
+ {
+ return _defaultVersion;
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,57 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueBindBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getArguments();
+
+ public AMQShortString getExchange();
+
+ public boolean getNowait();
+
+ public AMQShortString getQueue();
+
+ public AMQShortString getRoutingKey();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueBindOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueBindOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,61 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueDeclareBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getArguments();
+
+ public boolean getAutoDelete();
+
+ public boolean getDurable();
+
+ public boolean getExclusive();
+
+ public boolean getNowait();
+
+ public boolean getPassive();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeclareOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueDeclareOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getConsumerCount();
+
+ public long getMessageCount();
+
+ public AMQShortString getQueue();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueDeleteBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getIfEmpty();
+
+ public boolean getIfUnused();
+
+ public boolean getNowait();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueDeleteOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueDeleteOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getMessageCount();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueuePurgeBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public boolean getNowait();
+
+ public AMQShortString getQueue();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueuePurgeOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueuePurgeOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getMessageCount();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueUnbindBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getArguments();
+
+ public AMQShortString getExchange();
+
+ public AMQShortString getQueue();
+
+ public AMQShortString getRoutingKey();
+
+ public int getTicket();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/QueueUnbindOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface QueueUnbindOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ServerMethodDispatcher.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ServerMethodDispatcher.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/ServerMethodDispatcher.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,93 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.amq.AMQException;
+
+/**
+ * A ServerMethodDispatcher
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface ServerMethodDispatcher
+{
+ //
+ // public boolean dispatchAccessRequest(AccessRequestBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicAck(BasicAckBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicCancel(BasicCancelBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicConsume(BasicConsumeBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicGet(BasicGetBody body, int channelId) throws AMQException;
+ public boolean dispatchBasicPublish(BasicPublishBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchBasicQos(BasicQosBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicRecover(BasicRecoverBody body, int channelId) throws AMQException;
+ // public boolean dispatchBasicReject(BasicRejectBody body, int channelId) throws AMQException;
+ public boolean dispatchChannelClose(ChannelCloseBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchChannelCloseOk(ChannelCloseOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchChannelFlow(ChannelFlowBody body, int channelId) throws AMQException;
+ // public boolean dispatchChannelFlowOk(ChannelFlowOkBody body, int channelId) throws AMQException;
+ public boolean dispatchChannelOpen(ChannelOpenBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchConnectionClose(ConnectionCloseBody body, int channelId) throws AMQException;
+ // public boolean dispatchConnectionCloseOk(ConnectionCloseOkBody body, int channelId) throws AMQException;
+ public boolean dispatchConnectionOpen(ConnectionOpenBody body, int channelId) throws AMQException;
+
+ // public boolean dispatchConnectionSecureOk(ConnectionSecureOkBody body, int channelId) throws AMQException;
+ public boolean dispatchConnectionStartOk(ConnectionStartOkBody body, int channelId) throws AMQException;
+
+ public boolean dispatchConnectionTuneOk(ConnectionTuneOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchDtxSelect(DtxSelectBody body, int channelId) throws AMQException;
+ // public boolean dispatchDtxStart(DtxStartBody body, int channelId) throws AMQException;
+ // public boolean dispatchExchangeBound(ExchangeBoundBody body, int channelId) throws AMQException;
+ // public boolean dispatchExchangeDeclare(ExchangeDeclareBody body, int channelId) throws AMQException;
+ // public boolean dispatchExchangeDelete(ExchangeDeleteBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileAck(FileAckBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileCancel(FileCancelBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileConsume(FileConsumeBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileOpen(FileOpenBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileOpenOk(FileOpenOkBody body, int channelId) throws AMQException;
+ // public boolean dispatchFilePublish(FilePublishBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileQos(FileQosBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileReject(FileRejectBody body, int channelId) throws AMQException;
+ // public boolean dispatchFileStage(FileStageBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueueBind(QueueBindBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueueDeclare(QueueDeclareBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueueDelete(QueueDeleteBody body, int channelId) throws AMQException;
+ // public boolean dispatchQueuePurge(QueuePurgeBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamCancel(StreamCancelBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamConsume(StreamConsumeBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamPublish(StreamPublishBody body, int channelId) throws AMQException;
+ // public boolean dispatchStreamQos(StreamQosBody body, int channelId) throws AMQException;
+ // public boolean dispatchTunnelRequest(TunnelRequestBody body, int channelId) throws AMQException;
+ // public boolean dispatchTxCommit(TxCommitBody body, int channelId) throws AMQException;
+ // public boolean dispatchTxRollback(TxRollbackBody body, int channelId) throws AMQException;
+ // public boolean dispatchTxSelect(TxSelectBody body, int channelId) throws AMQException;
+
+}
\ No newline at end of file
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/SmallCompositeAMQDataBlock.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/SmallCompositeAMQDataBlock.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/SmallCompositeAMQDataBlock.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,103 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.jboss.messaging.amq.framing;
+
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A SmallCompositeAMQDataBlock
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class SmallCompositeAMQDataBlock extends AMQDataBlock implements EncodableAMQDataBlock
+{
+ private AMQDataBlock _firstFrame;
+
+ private AMQDataBlock _block;
+
+ public SmallCompositeAMQDataBlock(AMQDataBlock block)
+ {
+ _block = block;
+ }
+
+ /**
+ * The encoded block will be logically first before the AMQDataBlocks which are encoded
+ * into the buffer afterwards.
+ * @param encodedBlock already-encoded data
+ * @param block a block to be encoded.
+ */
+ public SmallCompositeAMQDataBlock(AMQDataBlock encodedBlock, AMQDataBlock block)
+ {
+ this(block);
+ _firstFrame = encodedBlock;
+ }
+
+ public AMQDataBlock getBlock()
+ {
+ return _block;
+ }
+
+ public AMQDataBlock getFirstFrame()
+ {
+ return _firstFrame;
+ }
+
+ public long getSize()
+ {
+ long frameSize = _block.getSize();
+
+ if (_firstFrame != null)
+ {
+
+ frameSize += _firstFrame.getSize();
+ }
+ return frameSize;
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ if (_firstFrame != null)
+ {
+ _firstFrame.writePayload(buffer);
+ }
+ _block.writePayload(buffer);
+
+ }
+
+ public String toString()
+ {
+ if (_block == null)
+ {
+ return "No blocks contained in composite frame";
+ }
+ else
+ {
+ StringBuilder buf = new StringBuilder(this.getClass().getName());
+ buf.append("{encodedBlock=").append(_firstFrame);
+
+ buf.append(" _block=[").append(_block.toString()).append("]");
+
+ buf.append("}");
+ return buf.toString();
+ }
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestContentBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestContentOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestContentOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getContentChecksum();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,55 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestIntegerBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public short getInteger1();
+
+ public int getInteger2();
+
+ public long getInteger3();
+
+ public long getInteger4();
+
+ public short getOperation();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestIntegerOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestIntegerOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getResult();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestStringBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public short getOperation();
+
+ public AMQShortString getString1();
+
+ public byte[] getString2();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestStringOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestStringOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public byte[] getResult();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,51 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestTableBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public short getIntegerOp();
+
+ public short getStringOp();
+
+ public FieldTable getTable();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TestTableOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TestTableOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public long getIntegerResult();
+
+ public byte[] getStringResult();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TunnelRequestBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TunnelRequestBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TunnelRequestBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TunnelRequestBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+ public FieldTable getMetaData();
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TxCommitBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxCommitOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TxCommitOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TxRollbackBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxRollbackOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TxRollbackOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TxSelectBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectOkBody.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectOkBody.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/TxSelectOkBody.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,45 @@
+
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ * 8-0
+ */
+
+
+package org.jboss.messaging.amq.framing;
+
+
+public interface TxSelectOkBody extends EncodableAMQDataBlock, AMQMethodBody
+{
+
+
+
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/AMQMethodBody_0_9.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/AMQMethodBody_0_9.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/AMQMethodBody_0_9.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,214 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.Content;
+import org.jboss.messaging.amq.framing.EncodingUtils;
+import org.jboss.messaging.amq.framing.FieldTable;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A AMQMethodBody_0_9
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public abstract class AMQMethodBody_0_9 extends org.jboss.messaging.amq.framing.AMQMethodBodyImpl
+{
+
+ public byte getMajor()
+ {
+ return 0;
+ }
+
+ public byte getMinor()
+ {
+ return 9;
+ }
+
+ public int getSize()
+ {
+ return 2 + 2 + getBodySize();
+ }
+
+ public void writePayload(MessagingBuffer buffer)
+ {
+ EncodingUtils.writeUnsignedShort(buffer, getClazz());
+ EncodingUtils.writeUnsignedShort(buffer, getMethod());
+ writeMethodPayload(buffer);
+ }
+
+
+ protected byte readByte(MessagingBuffer buffer)
+ {
+ return buffer.getByte();
+ }
+
+ protected AMQShortString readAMQShortString(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readAMQShortString(buffer);
+ }
+
+ protected int getSizeOf(AMQShortString string)
+ {
+ return EncodingUtils.encodedShortStringLength(string);
+ }
+
+ protected void writeByte(MessagingBuffer buffer, byte b)
+ {
+ buffer.putByte(b);
+ }
+
+ protected void writeAMQShortString(MessagingBuffer buffer, AMQShortString string)
+ {
+ EncodingUtils.writeShortStringBytes(buffer, string);
+ }
+
+ protected int readInt(MessagingBuffer buffer)
+ {
+ return buffer.getInt();
+ }
+
+ protected void writeInt(MessagingBuffer buffer, int i)
+ {
+ buffer.putInt(i);
+ }
+
+ protected FieldTable readFieldTable(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ return EncodingUtils.readFieldTable(buffer);
+ }
+
+ protected int getSizeOf(FieldTable table)
+ {
+ return EncodingUtils.encodedFieldTableLength(table); //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected void writeFieldTable(MessagingBuffer buffer, FieldTable table)
+ {
+ EncodingUtils.writeFieldTableBytes(buffer, table);
+ }
+
+ protected long readLong(MessagingBuffer buffer)
+ {
+ return buffer.getLong();
+ }
+
+ protected void writeLong(MessagingBuffer buffer, long l)
+ {
+ buffer.putLong(l);
+ }
+
+ protected int getSizeOf(byte[] response)
+ {
+ return (response == null) ? 4 :response.length + 4;
+ }
+
+ protected void writeBytes(MessagingBuffer buffer, byte[] data)
+ {
+ EncodingUtils.writeBytes(buffer,data);
+ }
+
+ protected byte[] readBytes(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readBytes(buffer);
+ }
+
+ protected short readShort(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readShort(buffer);
+ }
+
+ protected void writeShort(MessagingBuffer buffer, short s)
+ {
+ EncodingUtils.writeShort(buffer, s);
+ }
+
+ protected Content readContent(MessagingBuffer buffer)
+ {
+ return null; //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected int getSizeOf(Content body)
+ {
+ return 0; //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected void writeContent(MessagingBuffer buffer, Content body)
+ {
+ //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected byte readBitfield(MessagingBuffer buffer)
+ {
+ return readByte(buffer); //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected int readUnsignedShort(MessagingBuffer buffer)
+ {
+ return buffer.getUnsignedShort(); //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected void writeBitfield(MessagingBuffer buffer, byte bitfield0)
+ {
+ buffer.putByte(bitfield0);
+ }
+
+ protected void writeUnsignedShort(MessagingBuffer buffer, int s)
+ {
+ EncodingUtils.writeUnsignedShort(buffer, s);
+ }
+
+ protected long readUnsignedInteger(MessagingBuffer buffer)
+ {
+ return buffer.getUnsignedInt();
+ }
+ protected void writeUnsignedInteger(MessagingBuffer buffer, long i)
+ {
+ EncodingUtils.writeUnsignedInteger(buffer, i);
+ }
+
+
+ protected short readUnsignedByte(MessagingBuffer buffer)
+ {
+ return buffer.getUnsignedByte();
+ }
+
+ protected void writeUnsignedByte(MessagingBuffer buffer, short unsignedByte)
+ {
+ EncodingUtils.writeUnsignedByte(buffer, unsignedByte);
+ }
+
+ protected long readTimestamp(MessagingBuffer buffer)
+ {
+ return EncodingUtils.readTimestamp(buffer);
+ }
+
+ protected void writeTimestamp(MessagingBuffer buffer, long t)
+ {
+ EncodingUtils.writeTimestamp(buffer, t);
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/BasicPublishBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/BasicPublishBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/BasicPublishBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,178 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.BasicPublishBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class BasicPublishBodyImpl extends AMQMethodBody_0_9 implements BasicPublishBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new BasicPublishBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 60;
+
+ public static int METHOD_ID = 40;
+
+
+
+ // Fields declared in specification
+ private final int _ticket; // [ticket]
+ private final AMQShortString _exchange; // [exchange]
+ private final AMQShortString _routingKey; // [routingKey]
+ private final byte _bitfield0; // [mandatory, immediate]
+
+
+ // Constructor
+
+ public BasicPublishBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _ticket = readUnsignedShort( buffer );
+ _exchange = readAMQShortString( buffer );
+ _routingKey = readAMQShortString( buffer );
+ _bitfield0 = readBitfield( buffer );
+ }
+
+ public BasicPublishBodyImpl(
+ int ticket,
+ AMQShortString exchange,
+ AMQShortString routingKey,
+ boolean mandatory,
+ boolean immediate
+ )
+ {
+ _ticket = ticket;
+ _exchange = exchange;
+ _routingKey = routingKey;
+ byte bitfield0 = (byte)0;
+ if( mandatory )
+ {
+ bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
+ }
+
+ if( immediate )
+ {
+ bitfield0 = (byte) (((int) bitfield0) | (1 << 1));
+ }
+ _bitfield0 = bitfield0;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final int getTicket()
+ {
+ return _ticket;
+ }
+ public final AMQShortString getExchange()
+ {
+ return _exchange;
+ }
+ public final AMQShortString getRoutingKey()
+ {
+ return _routingKey;
+ }
+ public final boolean getMandatory()
+ {
+ return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
+ }
+ public final boolean getImmediate()
+ {
+ return (((int)(_bitfield0)) & ( 1 << 1)) != 0;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 3;
+ size += getSizeOf( _exchange );
+ size += getSizeOf( _routingKey );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeUnsignedShort( buffer, _ticket );
+ writeAMQShortString( buffer, _exchange );
+ writeAMQShortString( buffer, _routingKey );
+ writeBitfield( buffer, _bitfield0 );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[BasicPublishBodyImpl: ");
+ buf.append( "ticket=" );
+ buf.append( getTicket() );
+ buf.append( ", " );
+ buf.append( "exchange=" );
+ buf.append( getExchange() );
+ buf.append( ", " );
+ buf.append( "routingKey=" );
+ buf.append( getRoutingKey() );
+ buf.append( ", " );
+ buf.append( "mandatory=" );
+ buf.append( getMandatory() );
+ buf.append( ", " );
+ buf.append( "immediate=" );
+ buf.append( getImmediate() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,159 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ChannelCloseBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ChannelCloseBodyImpl extends AMQMethodBody_0_9 implements ChannelCloseBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ChannelCloseBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 20;
+
+ public static int METHOD_ID = 40;
+
+
+
+ // Fields declared in specification
+ private final int _replyCode; // [replyCode]
+ private final AMQShortString _replyText; // [replyText]
+ private final int _classId; // [classId]
+ private final int _methodId; // [methodId]
+
+
+ // Constructor
+
+ public ChannelCloseBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _replyCode = readUnsignedShort( buffer );
+ _replyText = readAMQShortString( buffer );
+ _classId = readUnsignedShort( buffer );
+ _methodId = readUnsignedShort( buffer );
+ }
+
+ public ChannelCloseBodyImpl(
+ int replyCode,
+ AMQShortString replyText,
+ int classId,
+ int methodId
+ )
+ {
+ _replyCode = replyCode;
+ _replyText = replyText;
+ _classId = classId;
+ _methodId = methodId;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final int getReplyCode()
+ {
+ return _replyCode;
+ }
+ public final AMQShortString getReplyText()
+ {
+ return _replyText;
+ }
+ public final int getClassId()
+ {
+ return _classId;
+ }
+ public final int getMethodId()
+ {
+ return _methodId;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 6;
+ size += getSizeOf( _replyText );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeUnsignedShort( buffer, _replyCode );
+ writeAMQShortString( buffer, _replyText );
+ writeUnsignedShort( buffer, _classId );
+ writeUnsignedShort( buffer, _methodId );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ChannelCloseBodyImpl: ");
+ buf.append( "replyCode=" );
+ buf.append( getReplyCode() );
+ buf.append( ", " );
+ buf.append( "replyText=" );
+ buf.append( getReplyText() );
+ buf.append( ", " );
+ buf.append( "classId=" );
+ buf.append( getClassId() );
+ buf.append( ", " );
+ buf.append( "methodId=" );
+ buf.append( getMethodId() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseOkBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseOkBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelCloseOkBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,109 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.ChannelCloseOkBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ChannelCloseOkBodyImpl extends AMQMethodBody_0_9 implements ChannelCloseOkBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ChannelCloseOkBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 20;
+
+ public static int METHOD_ID = 41;
+
+
+
+ // Fields declared in specification
+
+
+ // Constructor
+
+ public ChannelCloseOkBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ }
+
+ public ChannelCloseOkBodyImpl(
+ )
+ {
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+
+ protected int getBodySize()
+ {
+ int size = 0;
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ }
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ChannelCloseOkBodyImpl: ");
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,123 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ChannelOpenBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ChannelOpenBodyImpl extends AMQMethodBody_0_9 implements ChannelOpenBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ChannelOpenBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 20;
+
+ public static int METHOD_ID = 10;
+
+
+
+ // Fields declared in specification
+ private final AMQShortString _outOfBand; // [outOfBand]
+
+
+ // Constructor
+
+ public ChannelOpenBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _outOfBand = readAMQShortString( buffer );
+ }
+
+ public ChannelOpenBodyImpl(
+ AMQShortString outOfBand
+ )
+ {
+ _outOfBand = outOfBand;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final AMQShortString getOutOfBand()
+ {
+ return _outOfBand;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 0;
+ size += getSizeOf( _outOfBand );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeAMQShortString( buffer, _outOfBand );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ChannelOpenBodyImpl: ");
+ buf.append( "outOfBand=" );
+ buf.append( getOutOfBand() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenOkBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenOkBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ChannelOpenOkBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,121 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.ChannelOpenOkBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ChannelOpenOkBodyImpl extends AMQMethodBody_0_9 implements ChannelOpenOkBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ChannelOpenOkBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 20;
+
+ public static int METHOD_ID = 11;
+
+
+
+ // Fields declared in specification
+ private final byte[] _channelId; // [channelId]
+
+
+ // Constructor
+
+ public ChannelOpenOkBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _channelId = readBytes( buffer );
+ }
+
+ public ChannelOpenOkBodyImpl(
+ byte[] channelId
+ )
+ {
+ _channelId = channelId;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final byte[] getChannelId()
+ {
+ return _channelId;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 0;
+ size += getSizeOf( _channelId );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeBytes( buffer, _channelId );
+ }
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ChannelOpenOkBodyImpl: ");
+ buf.append( "channelId=" );
+ buf.append( getChannelId() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionCloseBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionCloseBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionCloseBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,159 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ConnectionCloseBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionCloseBodyImpl extends AMQMethodBody_0_9 implements ConnectionCloseBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionCloseBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 50;
+
+
+
+ // Fields declared in specification
+ private final int _replyCode; // [replyCode]
+ private final AMQShortString _replyText; // [replyText]
+ private final int _classId; // [classId]
+ private final int _methodId; // [methodId]
+
+
+ // Constructor
+
+ public ConnectionCloseBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _replyCode = readUnsignedShort( buffer );
+ _replyText = readAMQShortString( buffer );
+ _classId = readUnsignedShort( buffer );
+ _methodId = readUnsignedShort( buffer );
+ }
+
+ public ConnectionCloseBodyImpl(
+ int replyCode,
+ AMQShortString replyText,
+ int classId,
+ int methodId
+ )
+ {
+ _replyCode = replyCode;
+ _replyText = replyText;
+ _classId = classId;
+ _methodId = methodId;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final int getReplyCode()
+ {
+ return _replyCode;
+ }
+ public final AMQShortString getReplyText()
+ {
+ return _replyText;
+ }
+ public final int getClassId()
+ {
+ return _classId;
+ }
+ public final int getMethodId()
+ {
+ return _methodId;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 6;
+ size += getSizeOf( _replyText );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeUnsignedShort( buffer, _replyCode );
+ writeAMQShortString( buffer, _replyText );
+ writeUnsignedShort( buffer, _classId );
+ writeUnsignedShort( buffer, _methodId );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionCloseBodyImpl: ");
+ buf.append( "replyCode=" );
+ buf.append( getReplyCode() );
+ buf.append( ", " );
+ buf.append( "replyText=" );
+ buf.append( getReplyText() );
+ buf.append( ", " );
+ buf.append( "classId=" );
+ buf.append( getClassId() );
+ buf.append( ", " );
+ buf.append( "methodId=" );
+ buf.append( getMethodId() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,152 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ConnectionOpenBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionOpenBodyImpl extends AMQMethodBody_0_9 implements ConnectionOpenBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionOpenBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 40;
+
+
+
+ // Fields declared in specification
+ private final AMQShortString _virtualHost; // [virtualHost]
+ private final AMQShortString _capabilities; // [capabilities]
+ private final byte _bitfield0; // [insist]
+
+
+ // Constructor
+
+ public ConnectionOpenBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _virtualHost = readAMQShortString( buffer );
+ _capabilities = readAMQShortString( buffer );
+ _bitfield0 = readBitfield( buffer );
+ }
+
+ public ConnectionOpenBodyImpl(
+ AMQShortString virtualHost,
+ AMQShortString capabilities,
+ boolean insist
+ )
+ {
+ _virtualHost = virtualHost;
+ _capabilities = capabilities;
+ byte bitfield0 = (byte)0;
+ if( insist )
+ {
+ bitfield0 = (byte) (((int) bitfield0) | (1 << 0));
+ }
+ _bitfield0 = bitfield0;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final AMQShortString getVirtualHost()
+ {
+ return _virtualHost;
+ }
+ public final AMQShortString getCapabilities()
+ {
+ return _capabilities;
+ }
+ public final boolean getInsist()
+ {
+ return (((int)(_bitfield0)) & ( 1 << 0)) != 0;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 1;
+ size += getSizeOf( _virtualHost );
+ size += getSizeOf( _capabilities );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeAMQShortString( buffer, _virtualHost );
+ writeAMQShortString( buffer, _capabilities );
+ writeBitfield( buffer, _bitfield0 );
+ }
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionOpenBodyImpl: ");
+ buf.append( "virtualHost=" );
+ buf.append( getVirtualHost() );
+ buf.append( ", " );
+ buf.append( "capabilities=" );
+ buf.append( getCapabilities() );
+ buf.append( ", " );
+ buf.append( "insist=" );
+ buf.append( getInsist() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenOkBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenOkBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionOpenOkBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,122 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ConnectionOpenOkBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionOpenOkBodyImpl extends AMQMethodBody_0_9 implements ConnectionOpenOkBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionOpenOkBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 41;
+
+
+
+ // Fields declared in specification
+ private final AMQShortString _knownHosts; // [knownHosts]
+
+
+ // Constructor
+
+ public ConnectionOpenOkBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _knownHosts = readAMQShortString( buffer );
+ }
+
+ public ConnectionOpenOkBodyImpl(
+ AMQShortString knownHosts
+ )
+ {
+ _knownHosts = knownHosts;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final AMQShortString getKnownHosts()
+ {
+ return _knownHosts;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 0;
+ size += getSizeOf( _knownHosts );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeAMQShortString( buffer, _knownHosts );
+ }
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionOpenOkBodyImpl: ");
+ buf.append( "knownHosts=" );
+ buf.append( getKnownHosts() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,173 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.ConnectionStartBody;
+import org.jboss.messaging.amq.framing.FieldTable;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionStartBodyImpl extends AMQMethodBody_0_9 implements ConnectionStartBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionStartBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 10;
+
+
+
+ // Fields declared in specification
+ private final short _versionMajor; // [versionMajor]
+ private final short _versionMinor; // [versionMinor]
+ private final FieldTable _serverProperties; // [serverProperties]
+ private final byte[] _mechanisms; // [mechanisms]
+ private final byte[] _locales; // [locales]
+
+
+ // Constructor
+
+ public ConnectionStartBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _versionMajor = readUnsignedByte( buffer );
+ _versionMinor = readUnsignedByte( buffer );
+ _serverProperties = readFieldTable( buffer );
+ _mechanisms = readBytes( buffer );
+ _locales = readBytes( buffer );
+ }
+
+ public ConnectionStartBodyImpl(
+ short versionMajor,
+ short versionMinor,
+ FieldTable serverProperties,
+ byte[] mechanisms,
+ byte[] locales
+ )
+ {
+ _versionMajor = versionMajor;
+ _versionMinor = versionMinor;
+ _serverProperties = serverProperties;
+ _mechanisms = mechanisms;
+ _locales = locales;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final short getVersionMajor()
+ {
+ return _versionMajor;
+ }
+ public final short getVersionMinor()
+ {
+ return _versionMinor;
+ }
+ public final FieldTable getServerProperties()
+ {
+ return _serverProperties;
+ }
+ public final byte[] getMechanisms()
+ {
+ return _mechanisms;
+ }
+ public final byte[] getLocales()
+ {
+ return _locales;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 2;
+ size += getSizeOf( _serverProperties );
+ size += getSizeOf( _mechanisms );
+ size += getSizeOf( _locales );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeUnsignedByte( buffer, _versionMajor );
+ writeUnsignedByte( buffer, _versionMinor );
+ writeFieldTable( buffer, _serverProperties );
+ writeBytes( buffer, _mechanisms );
+ writeBytes( buffer, _locales );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionStartBodyImpl: ");
+ buf.append( "versionMajor=" );
+ buf.append( getVersionMajor() );
+ buf.append( ", " );
+ buf.append( "versionMinor=" );
+ buf.append( getVersionMinor() );
+ buf.append( ", " );
+ buf.append( "serverProperties=" );
+ buf.append( getServerProperties() );
+ buf.append( ", " );
+ buf.append( "mechanisms=" );
+ buf.append( getMechanisms() );
+ buf.append( ", " );
+ buf.append( "locales=" );
+ buf.append( getLocales() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartOkBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartOkBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionStartOkBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,163 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ConnectionStartOkBody;
+import org.jboss.messaging.amq.framing.FieldTable;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionStartOkBodyImpl extends AMQMethodBody_0_9 implements ConnectionStartOkBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionStartOkBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 11;
+
+
+
+ // Fields declared in specification
+ private final FieldTable _clientProperties; // [clientProperties]
+ private final AMQShortString _mechanism; // [mechanism]
+ private final byte[] _response; // [response]
+ private final AMQShortString _locale; // [locale]
+
+
+ // Constructor
+
+ public ConnectionStartOkBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _clientProperties = readFieldTable( buffer );
+ _mechanism = readAMQShortString( buffer );
+ _response = readBytes( buffer );
+ _locale = readAMQShortString( buffer );
+ }
+
+ public ConnectionStartOkBodyImpl(
+ FieldTable clientProperties,
+ AMQShortString mechanism,
+ byte[] response,
+ AMQShortString locale
+ )
+ {
+ _clientProperties = clientProperties;
+ _mechanism = mechanism;
+ _response = response;
+ _locale = locale;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final FieldTable getClientProperties()
+ {
+ return _clientProperties;
+ }
+ public final AMQShortString getMechanism()
+ {
+ return _mechanism;
+ }
+ public final byte[] getResponse()
+ {
+ return _response;
+ }
+ public final AMQShortString getLocale()
+ {
+ return _locale;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 0;
+ size += getSizeOf( _clientProperties );
+ size += getSizeOf( _mechanism );
+ size += getSizeOf( _response );
+ size += getSizeOf( _locale );
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeFieldTable( buffer, _clientProperties );
+ writeAMQShortString( buffer, _mechanism );
+ writeBytes( buffer, _response );
+ writeAMQShortString( buffer, _locale );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionStartOkBodyImpl: ");
+ buf.append( "clientProperties=" );
+ buf.append( getClientProperties() );
+ buf.append( ", " );
+ buf.append( "mechanism=" );
+ buf.append( getMechanism() );
+ buf.append( ", " );
+ buf.append( "response=" );
+ buf.append( getResponse() );
+ buf.append( ", " );
+ buf.append( "locale=" );
+ buf.append( getLocale() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,144 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.ConnectionTuneBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionTuneBodyImpl extends AMQMethodBody_0_9 implements ConnectionTuneBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionTuneBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 30;
+
+
+
+ // Fields declared in specification
+ private final int _channelMax; // [channelMax]
+ private final long _frameMax; // [frameMax]
+ private final int _heartbeat; // [heartbeat]
+
+
+ // Constructor
+
+ public ConnectionTuneBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _channelMax = readUnsignedShort( buffer );
+ _frameMax = readUnsignedInteger( buffer );
+ _heartbeat = readUnsignedShort( buffer );
+ }
+
+ public ConnectionTuneBodyImpl(
+ int channelMax,
+ long frameMax,
+ int heartbeat
+ )
+ {
+ _channelMax = channelMax;
+ _frameMax = frameMax;
+ _heartbeat = heartbeat;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final int getChannelMax()
+ {
+ return _channelMax;
+ }
+ public final long getFrameMax()
+ {
+ return _frameMax;
+ }
+ public final int getHeartbeat()
+ {
+ return _heartbeat;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 8;
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeUnsignedShort( buffer, _channelMax );
+ writeUnsignedInteger( buffer, _frameMax );
+ writeUnsignedShort( buffer, _heartbeat );
+ }
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionTuneBodyImpl: ");
+ buf.append( "channelMax=" );
+ buf.append( getChannelMax() );
+ buf.append( ", " );
+ buf.append( "frameMax=" );
+ buf.append( getFrameMax() );
+ buf.append( ", " );
+ buf.append( "heartbeat=" );
+ buf.append( getHeartbeat() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneOkBodyImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneOkBodyImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/ConnectionTuneOkBodyImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,145 @@
+
+
+
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.ConnectionTuneOkBody;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+public class ConnectionTuneOkBodyImpl extends AMQMethodBody_0_9 implements ConnectionTuneOkBody
+{
+ private static final AMQMethodBodyInstanceFactory FACTORY_INSTANCE = new AMQMethodBodyInstanceFactory()
+ {
+ public AMQMethodBody newInstance(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ return new ConnectionTuneOkBodyImpl(in);
+ }
+
+
+ };
+
+
+ public static AMQMethodBodyInstanceFactory getFactory()
+ {
+ return FACTORY_INSTANCE;
+ }
+
+ public static int CLASS_ID = 10;
+
+ public static int METHOD_ID = 31;
+
+
+
+ // Fields declared in specification
+ private final int _channelMax; // [channelMax]
+ private final long _frameMax; // [frameMax]
+ private final int _heartbeat; // [heartbeat]
+
+
+ // Constructor
+
+ public ConnectionTuneOkBodyImpl(MessagingBuffer buffer) throws AMQFrameDecodingException
+ {
+ _channelMax = readUnsignedShort( buffer );
+ _frameMax = readUnsignedInteger( buffer );
+ _heartbeat = readUnsignedShort( buffer );
+ }
+
+ public ConnectionTuneOkBodyImpl(
+ int channelMax,
+ long frameMax,
+ int heartbeat
+ )
+ {
+ _channelMax = channelMax;
+ _frameMax = frameMax;
+ _heartbeat = heartbeat;
+ }
+
+ public int getClazz()
+ {
+ return CLASS_ID;
+ }
+
+ public int getMethod()
+ {
+ return METHOD_ID;
+ }
+
+
+ public final int getChannelMax()
+ {
+ return _channelMax;
+ }
+ public final long getFrameMax()
+ {
+ return _frameMax;
+ }
+ public final int getHeartbeat()
+ {
+ return _heartbeat;
+ }
+
+ protected int getBodySize()
+ {
+ int size = 8;
+ return size;
+ }
+
+ public void writeMethodPayload(MessagingBuffer buffer)
+ {
+ writeUnsignedShort( buffer, _channelMax );
+ writeUnsignedInteger( buffer, _frameMax );
+ writeUnsignedShort( buffer, _heartbeat );
+ }
+
+
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder("[ConnectionTuneOkBodyImpl: ");
+ buf.append( "channelMax=" );
+ buf.append( getChannelMax() );
+ buf.append( ", " );
+ buf.append( "frameMax=" );
+ buf.append( getFrameMax() );
+ buf.append( ", " );
+ buf.append( "heartbeat=" );
+ buf.append( getHeartbeat() );
+ buf.append("]");
+ return buf.toString();
+ }
+
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/MethodRegistry_0_9.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/MethodRegistry_0_9.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/framing/amqp_0_9/MethodRegistry_0_9.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,1587 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+/*
+ * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
+ * Supported AMQP version:
+ * 0-9
+ */
+
+package org.jboss.messaging.amq.framing.amqp_0_9;
+
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.AMQMethodBodyInstanceFactory;
+import org.jboss.messaging.amq.framing.AMQShortString;
+import org.jboss.messaging.amq.framing.ChannelCloseBody;
+import org.jboss.messaging.amq.framing.ChannelCloseOkBody;
+import org.jboss.messaging.amq.framing.ChannelOpenOkBody;
+import org.jboss.messaging.amq.framing.ConnectionCloseBody;
+import org.jboss.messaging.amq.framing.ConnectionOpenBody;
+import org.jboss.messaging.amq.framing.ConnectionOpenOkBody;
+import org.jboss.messaging.amq.framing.ConnectionStartBody;
+import org.jboss.messaging.amq.framing.ConnectionStartOkBody;
+import org.jboss.messaging.amq.framing.ConnectionTuneBody;
+import org.jboss.messaging.amq.framing.ConnectionTuneOkBody;
+import org.jboss.messaging.amq.framing.FieldTable;
+import org.jboss.messaging.amq.framing.MethodRegistry;
+import org.jboss.messaging.amq.framing.ProtocolVersion;
+import org.jboss.messaging.amq.protocol.AMQConstant;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * A MethodRegistry_0_9
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class MethodRegistry_0_9 extends MethodRegistry
+{
+
+ private static final Logger _log = Logger.getLogger(MethodRegistry_0_9.class);
+
+ // private MethodConverter_0_9 _protocolVersionConverter = new MethodConverter_0_9();
+
+ private final AMQMethodBodyInstanceFactory[][] _factories = new AMQMethodBodyInstanceFactory[121][];
+
+ public MethodRegistry_0_9()
+ {
+ this(new ProtocolVersion((byte)0, (byte)9));
+ }
+
+ public MethodRegistry_0_9(ProtocolVersion pv)
+ {
+ super(pv);
+
+ // Register method body instance factories for the Connection class.
+
+ _factories[10] = new AMQMethodBodyInstanceFactory[52];
+
+ _factories[10][10] = ConnectionStartBodyImpl.getFactory();
+ _factories[10][11] = ConnectionStartOkBodyImpl.getFactory();
+ /* _factories[10][20] = ConnectionSecureBodyImpl.getFactory();
+ _factories[10][21] = ConnectionSecureOkBodyImpl.getFactory();
+ */_factories[10][30] = ConnectionTuneBodyImpl.getFactory();
+ _factories[10][31] = ConnectionTuneOkBodyImpl.getFactory();
+ _factories[10][40] = ConnectionOpenBodyImpl.getFactory();
+ _factories[10][41] = ConnectionOpenOkBodyImpl.getFactory();
+ /* _factories[10][42] = ConnectionRedirectBodyImpl.getFactory();
+ */_factories[10][50] = ConnectionCloseBodyImpl.getFactory();
+ /* _factories[10][51] = ConnectionCloseOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Channel class.
+
+ */
+ _factories[20] = new AMQMethodBodyInstanceFactory[81];
+
+ _factories[20][10] = ChannelOpenBodyImpl.getFactory();
+ /* _factories[20][11] = ChannelOpenOkBodyImpl.getFactory();
+ _factories[20][20] = ChannelFlowBodyImpl.getFactory();
+ _factories[20][21] = ChannelFlowOkBodyImpl.getFactory();
+ */
+ _factories[20][40] = ChannelCloseBodyImpl.getFactory();
+ _factories[20][41] = ChannelCloseOkBodyImpl.getFactory();
+ /*
+ _factories[20][50] = ChannelResumeBodyImpl.getFactory();
+ _factories[20][60] = ChannelPingBodyImpl.getFactory();
+ _factories[20][70] = ChannelPongBodyImpl.getFactory();
+ _factories[20][80] = ChannelOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Access class.
+
+ _factories[30] = new AMQMethodBodyInstanceFactory[12];
+
+ _factories[30][10] = AccessRequestBodyImpl.getFactory();
+ _factories[30][11] = AccessRequestOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Exchange class.
+
+ _factories[40] = new AMQMethodBodyInstanceFactory[24];
+
+ _factories[40][10] = ExchangeDeclareBodyImpl.getFactory();
+ _factories[40][11] = ExchangeDeclareOkBodyImpl.getFactory();
+ _factories[40][20] = ExchangeDeleteBodyImpl.getFactory();
+ _factories[40][21] = ExchangeDeleteOkBodyImpl.getFactory();
+ _factories[40][22] = ExchangeBoundBodyImpl.getFactory();
+ _factories[40][23] = ExchangeBoundOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Queue class.
+
+ _factories[50] = new AMQMethodBodyInstanceFactory[52];
+
+ _factories[50][10] = QueueDeclareBodyImpl.getFactory();
+ _factories[50][11] = QueueDeclareOkBodyImpl.getFactory();
+ _factories[50][20] = QueueBindBodyImpl.getFactory();
+ _factories[50][21] = QueueBindOkBodyImpl.getFactory();
+ _factories[50][30] = QueuePurgeBodyImpl.getFactory();
+ _factories[50][31] = QueuePurgeOkBodyImpl.getFactory();
+ _factories[50][40] = QueueDeleteBodyImpl.getFactory();
+ _factories[50][41] = QueueDeleteOkBodyImpl.getFactory();
+ _factories[50][50] = QueueUnbindBodyImpl.getFactory();
+ _factories[50][51] = QueueUnbindOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Basic class.
+ */
+ _factories[60] = new AMQMethodBodyInstanceFactory[103];
+ /*
+ _factories[60][10] = BasicQosBodyImpl.getFactory();
+ _factories[60][11] = BasicQosOkBodyImpl.getFactory();
+ _factories[60][20] = BasicConsumeBodyImpl.getFactory();
+ _factories[60][21] = BasicConsumeOkBodyImpl.getFactory();
+ _factories[60][30] = BasicCancelBodyImpl.getFactory();
+ _factories[60][31] = BasicCancelOkBodyImpl.getFactory();
+ */
+ _factories[60][40] = BasicPublishBodyImpl.getFactory();
+ /*
+ _factories[60][50] = BasicReturnBodyImpl.getFactory();
+ _factories[60][60] = BasicDeliverBodyImpl.getFactory();
+ _factories[60][70] = BasicGetBodyImpl.getFactory();
+ _factories[60][71] = BasicGetOkBodyImpl.getFactory();
+ _factories[60][72] = BasicGetEmptyBodyImpl.getFactory();
+ _factories[60][80] = BasicAckBodyImpl.getFactory();
+ _factories[60][90] = BasicRejectBodyImpl.getFactory();
+ _factories[60][100] = BasicRecoverBodyImpl.getFactory();
+ _factories[60][101] = BasicRecoverSyncOkBodyImpl.getFactory();
+ _factories[60][102] = BasicRecoverSyncBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the File class.
+
+ _factories[70] = new AMQMethodBodyInstanceFactory[101];
+
+ _factories[70][10] = FileQosBodyImpl.getFactory();
+ _factories[70][11] = FileQosOkBodyImpl.getFactory();
+ _factories[70][20] = FileConsumeBodyImpl.getFactory();
+ _factories[70][21] = FileConsumeOkBodyImpl.getFactory();
+ _factories[70][30] = FileCancelBodyImpl.getFactory();
+ _factories[70][31] = FileCancelOkBodyImpl.getFactory();
+ _factories[70][40] = FileOpenBodyImpl.getFactory();
+ _factories[70][41] = FileOpenOkBodyImpl.getFactory();
+ _factories[70][50] = FileStageBodyImpl.getFactory();
+ _factories[70][60] = FilePublishBodyImpl.getFactory();
+ _factories[70][70] = FileReturnBodyImpl.getFactory();
+ _factories[70][80] = FileDeliverBodyImpl.getFactory();
+ _factories[70][90] = FileAckBodyImpl.getFactory();
+ _factories[70][100] = FileRejectBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Stream class.
+
+ _factories[80] = new AMQMethodBodyInstanceFactory[61];
+
+ _factories[80][10] = StreamQosBodyImpl.getFactory();
+ _factories[80][11] = StreamQosOkBodyImpl.getFactory();
+ _factories[80][20] = StreamConsumeBodyImpl.getFactory();
+ _factories[80][21] = StreamConsumeOkBodyImpl.getFactory();
+ _factories[80][30] = StreamCancelBodyImpl.getFactory();
+ _factories[80][31] = StreamCancelOkBodyImpl.getFactory();
+ _factories[80][40] = StreamPublishBodyImpl.getFactory();
+ _factories[80][50] = StreamReturnBodyImpl.getFactory();
+ _factories[80][60] = StreamDeliverBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Tx class.
+
+ _factories[90] = new AMQMethodBodyInstanceFactory[32];
+
+ _factories[90][10] = TxSelectBodyImpl.getFactory();
+ _factories[90][11] = TxSelectOkBodyImpl.getFactory();
+ _factories[90][20] = TxCommitBodyImpl.getFactory();
+ _factories[90][21] = TxCommitOkBodyImpl.getFactory();
+ _factories[90][30] = TxRollbackBodyImpl.getFactory();
+ _factories[90][31] = TxRollbackOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Dtx class.
+
+ _factories[100] = new AMQMethodBodyInstanceFactory[22];
+
+ _factories[100][10] = DtxSelectBodyImpl.getFactory();
+ _factories[100][11] = DtxSelectOkBodyImpl.getFactory();
+ _factories[100][20] = DtxStartBodyImpl.getFactory();
+ _factories[100][21] = DtxStartOkBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Tunnel class.
+
+ _factories[110] = new AMQMethodBodyInstanceFactory[11];
+
+ _factories[110][10] = TunnelRequestBodyImpl.getFactory();
+
+
+
+
+ // Register method body instance factories for the Message class.
+
+ _factories[120] = new AMQMethodBodyInstanceFactory[531];
+
+ _factories[120][10] = MessageTransferBodyImpl.getFactory();
+ _factories[120][20] = MessageConsumeBodyImpl.getFactory();
+ _factories[120][30] = MessageCancelBodyImpl.getFactory();
+ _factories[120][40] = MessageGetBodyImpl.getFactory();
+ _factories[120][50] = MessageRecoverBodyImpl.getFactory();
+ _factories[120][60] = MessageOpenBodyImpl.getFactory();
+ _factories[120][70] = MessageCloseBodyImpl.getFactory();
+ _factories[120][80] = MessageAppendBodyImpl.getFactory();
+ _factories[120][90] = MessageCheckpointBodyImpl.getFactory();
+ _factories[120][100] = MessageResumeBodyImpl.getFactory();
+ _factories[120][110] = MessageQosBodyImpl.getFactory();
+ _factories[120][500] = MessageOkBodyImpl.getFactory();
+ _factories[120][510] = MessageEmptyBodyImpl.getFactory();
+ _factories[120][520] = MessageRejectBodyImpl.getFactory();
+ _factories[120][530] = MessageOffsetBodyImpl.getFactory();
+
+
+ */
+ }
+
+ public AMQMethodBody convertToBody(MessagingBuffer in, long size) throws AMQFrameDecodingException
+ {
+ int classId = in.getUnsignedShort();
+ int methodId = in.getUnsignedShort();
+
+ AMQMethodBodyInstanceFactory bodyFactory;
+ try
+ {
+ bodyFactory = _factories[classId][methodId];
+ }
+ catch (NullPointerException e)
+ {
+ throw new AMQFrameDecodingException(AMQConstant.COMMAND_INVALID, "Class " + classId +
+ " unknown in AMQP version 0-9" +
+ " (while trying to decode class " +
+ classId +
+ " method " +
+ methodId +
+ ".");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ if (classId >= _factories.length)
+ {
+ throw new AMQFrameDecodingException(AMQConstant.COMMAND_INVALID, "Class " + classId +
+ " unknown in AMQP version 0-9" +
+ " (while trying to decode class " +
+ classId +
+ " method " +
+ methodId +
+ ".");
+
+ }
+ else
+ {
+ throw new AMQFrameDecodingException(AMQConstant.COMMAND_INVALID, "Method " + methodId +
+ " unknown in AMQP version 0-9" +
+ " (while trying to decode class " +
+ classId +
+ " method " +
+ methodId +
+ ".");
+
+ }
+ }
+
+ if (bodyFactory == null)
+ {
+ throw new AMQFrameDecodingException(AMQConstant.COMMAND_INVALID, "Method " + methodId +
+ " unknown in AMQP version 0-9" +
+ " (while trying to decode class " +
+ classId +
+ " method " +
+ methodId +
+ ".");
+ }
+
+ return bodyFactory.newInstance(in, size);
+
+ }
+
+ public int getMaxClassId()
+ {
+ return 120;
+ }
+
+ public int getMaxMethodId(int classId)
+ {
+ return _factories[classId].length - 1;
+ }
+
+ public ConnectionStartBody createConnectionStartBody(final short versionMajor,
+ final short versionMinor,
+ final FieldTable serverProperties,
+ final byte[] mechanisms,
+ final byte[] locales)
+ {
+ return new ConnectionStartBodyImpl(versionMajor, versionMinor, serverProperties, mechanisms, locales);
+ }
+
+ public ConnectionStartOkBody createConnectionStartOkBody(final FieldTable clientProperties,
+ final AMQShortString mechanism,
+ final byte[] response,
+ final AMQShortString locale)
+ {
+ return new ConnectionStartOkBodyImpl(clientProperties, mechanism, response, locale);
+ }
+
+ /*
+ public ConnectionSecureBody createConnectionSecureBody(
+ final byte[] challenge
+ )
+ {
+ return new ConnectionSecureBodyImpl(
+ challenge
+ );
+ }
+
+ public ConnectionSecureOkBody createConnectionSecureOkBody(
+ final byte[] response
+ )
+ {
+ return new ConnectionSecureOkBodyImpl(
+ response
+ );
+ }
+
+ */
+ public ConnectionTuneBody createConnectionTuneBody(final int channelMax, final long frameMax, final int heartbeat)
+ {
+ return new ConnectionTuneBodyImpl(channelMax, frameMax, heartbeat);
+ }
+
+ public ConnectionTuneOkBody createConnectionTuneOkBody(final int channelMax, final long frameMax, final int heartbeat)
+ {
+ return new ConnectionTuneOkBodyImpl(channelMax, frameMax, heartbeat);
+ }
+
+ public ConnectionOpenBody createConnectionOpenBody(final AMQShortString virtualHost,
+ final AMQShortString capabilities,
+ final boolean insist)
+ {
+ return new ConnectionOpenBodyImpl(virtualHost, capabilities, insist);
+ }
+
+ public ConnectionOpenOkBody createConnectionOpenOkBody(final AMQShortString knownHosts)
+ {
+ return new ConnectionOpenOkBodyImpl(knownHosts);
+ }
+
+ /*
+ public ConnectionRedirectBody createConnectionRedirectBody(
+ final AMQShortString host,
+ final AMQShortString knownHosts
+ )
+ {
+ return new ConnectionRedirectBodyImpl(
+ host,
+ knownHosts
+ );
+ }
+
+ */
+ public ConnectionCloseBody createConnectionCloseBody(final int replyCode,
+ final AMQShortString replyText,
+ final int classId,
+ final int methodId)
+ {
+ return new ConnectionCloseBodyImpl(replyCode, replyText, classId, methodId);
+ }
+
+ /*
+ public ConnectionCloseOkBody createConnectionCloseOkBody(
+ )
+ {
+ return new ConnectionCloseOkBodyImpl(
+ );
+ }
+
+
+
+
+ public ChannelOpenBody createChannelOpenBody(
+ final AMQShortString outOfBand
+ )
+ {
+ return new ChannelOpenBodyImpl(
+ outOfBand
+ );
+ }
+
+ */
+ public ChannelOpenOkBody createChannelOpenOkBody(final byte[] channelId)
+ {
+ return new ChannelOpenOkBodyImpl(channelId);
+ }
+
+ /*
+ public ChannelFlowBody createChannelFlowBody(
+ final boolean active
+ )
+ {
+ return new ChannelFlowBodyImpl(
+ active
+ );
+ }
+
+ public ChannelFlowOkBody createChannelFlowOkBody(
+ final boolean active
+ )
+ {
+ return new ChannelFlowOkBodyImpl(
+ active
+ );
+ }
+
+ */
+ public ChannelCloseBody createChannelCloseBody(final int replyCode,
+ final AMQShortString replyText,
+ final int classId,
+ final int methodId)
+ {
+ return new ChannelCloseBodyImpl(replyCode, replyText, classId, methodId);
+ }
+
+ public ChannelCloseOkBody createChannelCloseOkBody()
+ {
+ return new ChannelCloseOkBodyImpl();
+ }
+ /*
+ public ChannelResumeBody createChannelResumeBody(
+ final byte[] channelId
+ )
+ {
+ return new ChannelResumeBodyImpl(
+ channelId
+ );
+ }
+
+ public ChannelPingBody createChannelPingBody(
+ )
+ {
+ return new ChannelPingBodyImpl(
+ );
+ }
+
+ public ChannelPongBody createChannelPongBody(
+ )
+ {
+ return new ChannelPongBodyImpl(
+ );
+ }
+
+ public ChannelOkBody createChannelOkBody(
+ )
+ {
+ return new ChannelOkBodyImpl(
+ );
+ }
+
+
+
+
+ public AccessRequestBody createAccessRequestBody(
+ final AMQShortString realm,
+ final boolean exclusive,
+ final boolean passive,
+ final boolean active,
+ final boolean write,
+ final boolean read
+ )
+ {
+ return new AccessRequestBodyImpl(
+ realm,
+ exclusive,
+ passive,
+ active,
+ write,
+ read
+ );
+ }
+
+ public AccessRequestOkBody createAccessRequestOkBody(
+ final int ticket
+ )
+ {
+ return new AccessRequestOkBodyImpl(
+ ticket
+ );
+ }
+
+
+
+
+ public ExchangeDeclareBody createExchangeDeclareBody(
+ final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString type,
+ final boolean passive,
+ final boolean durable,
+ final boolean autoDelete,
+ final boolean internal,
+ final boolean nowait,
+ final FieldTable arguments
+ )
+ {
+ return new ExchangeDeclareBodyImpl(
+ ticket,
+ exchange,
+ type,
+ passive,
+ durable,
+ autoDelete,
+ internal,
+ nowait,
+ arguments
+ );
+ }
+
+ public ExchangeDeclareOkBody createExchangeDeclareOkBody(
+ )
+ {
+ return new ExchangeDeclareOkBodyImpl(
+ );
+ }
+
+ public ExchangeDeleteBody createExchangeDeleteBody(
+ final int ticket,
+ final AMQShortString exchange,
+ final boolean ifUnused,
+ final boolean nowait
+ )
+ {
+ return new ExchangeDeleteBodyImpl(
+ ticket,
+ exchange,
+ ifUnused,
+ nowait
+ );
+ }
+
+ public ExchangeDeleteOkBody createExchangeDeleteOkBody(
+ )
+ {
+ return new ExchangeDeleteOkBodyImpl(
+ );
+ }
+
+ public ExchangeBoundBody createExchangeBoundBody(
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final AMQShortString queue
+ )
+ {
+ return new ExchangeBoundBodyImpl(
+ exchange,
+ routingKey,
+ queue
+ );
+ }
+
+ public ExchangeBoundOkBody createExchangeBoundOkBody(
+ final int replyCode,
+ final AMQShortString replyText
+ )
+ {
+ return new ExchangeBoundOkBodyImpl(
+ replyCode,
+ replyText
+ );
+ }
+
+
+
+
+ public QueueDeclareBody createQueueDeclareBody(
+ final int ticket,
+ final AMQShortString queue,
+ final boolean passive,
+ final boolean durable,
+ final boolean exclusive,
+ final boolean autoDelete,
+ final boolean nowait,
+ final FieldTable arguments
+ )
+ {
+ return new QueueDeclareBodyImpl(
+ ticket,
+ queue,
+ passive,
+ durable,
+ exclusive,
+ autoDelete,
+ nowait,
+ arguments
+ );
+ }
+
+ public QueueDeclareOkBody createQueueDeclareOkBody(
+ final AMQShortString queue,
+ final long messageCount,
+ final long consumerCount
+ )
+ {
+ return new QueueDeclareOkBodyImpl(
+ queue,
+ messageCount,
+ consumerCount
+ );
+ }
+
+ public QueueBindBody createQueueBindBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean nowait,
+ final FieldTable arguments
+ )
+ {
+ return new QueueBindBodyImpl(
+ ticket,
+ queue,
+ exchange,
+ routingKey,
+ nowait,
+ arguments
+ );
+ }
+
+ public QueueBindOkBody createQueueBindOkBody(
+ )
+ {
+ return new QueueBindOkBodyImpl(
+ );
+ }
+
+ public QueuePurgeBody createQueuePurgeBody(
+ final int ticket,
+ final AMQShortString queue,
+ final boolean nowait
+ )
+ {
+ return new QueuePurgeBodyImpl(
+ ticket,
+ queue,
+ nowait
+ );
+ }
+
+ public QueuePurgeOkBody createQueuePurgeOkBody(
+ final long messageCount
+ )
+ {
+ return new QueuePurgeOkBodyImpl(
+ messageCount
+ );
+ }
+
+ public QueueDeleteBody createQueueDeleteBody(
+ final int ticket,
+ final AMQShortString queue,
+ final boolean ifUnused,
+ final boolean ifEmpty,
+ final boolean nowait
+ )
+ {
+ return new QueueDeleteBodyImpl(
+ ticket,
+ queue,
+ ifUnused,
+ ifEmpty,
+ nowait
+ );
+ }
+
+ public QueueDeleteOkBody createQueueDeleteOkBody(
+ final long messageCount
+ )
+ {
+ return new QueueDeleteOkBodyImpl(
+ messageCount
+ );
+ }
+
+ public QueueUnbindBody createQueueUnbindBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final FieldTable arguments
+ )
+ {
+ return new QueueUnbindBodyImpl(
+ ticket,
+ queue,
+ exchange,
+ routingKey,
+ arguments
+ );
+ }
+
+ public QueueUnbindOkBody createQueueUnbindOkBody(
+ )
+ {
+ return new QueueUnbindOkBodyImpl(
+ );
+ }
+
+
+
+
+ public BasicQosBody createBasicQosBody(
+ final long prefetchSize,
+ final int prefetchCount,
+ final boolean global
+ )
+ {
+ return new BasicQosBodyImpl(
+ prefetchSize,
+ prefetchCount,
+ global
+ );
+ }
+
+ public BasicQosOkBody createBasicQosOkBody(
+ )
+ {
+ return new BasicQosOkBodyImpl(
+ );
+ }
+
+ public BasicConsumeBody createBasicConsumeBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString consumerTag,
+ final boolean noLocal,
+ final boolean noAck,
+ final boolean exclusive,
+ final boolean nowait,
+ final FieldTable arguments
+ )
+ {
+ return new BasicConsumeBodyImpl(
+ ticket,
+ queue,
+ consumerTag,
+ noLocal,
+ noAck,
+ exclusive,
+ nowait,
+ arguments
+ );
+ }
+
+ public BasicConsumeOkBody createBasicConsumeOkBody(
+ final AMQShortString consumerTag
+ )
+ {
+ return new BasicConsumeOkBodyImpl(
+ consumerTag
+ );
+ }
+
+ public BasicCancelBody createBasicCancelBody(
+ final AMQShortString consumerTag,
+ final boolean nowait
+ )
+ {
+ return new BasicCancelBodyImpl(
+ consumerTag,
+ nowait
+ );
+ }
+
+ public BasicCancelOkBody createBasicCancelOkBody(
+ final AMQShortString consumerTag
+ )
+ {
+ return new BasicCancelOkBodyImpl(
+ consumerTag
+ );
+ }
+
+ public BasicPublishBody createBasicPublishBody(
+ final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean mandatory,
+ final boolean immediate
+ )
+ {
+ return new BasicPublishBodyImpl(
+ ticket,
+ exchange,
+ routingKey,
+ mandatory,
+ immediate
+ );
+ }
+
+ public BasicReturnBody createBasicReturnBody(
+ final int replyCode,
+ final AMQShortString replyText,
+ final AMQShortString exchange,
+ final AMQShortString routingKey
+ )
+ {
+ return new BasicReturnBodyImpl(
+ replyCode,
+ replyText,
+ exchange,
+ routingKey
+ );
+ }
+
+ public BasicDeliverBody createBasicDeliverBody(
+ final AMQShortString consumerTag,
+ final long deliveryTag,
+ final boolean redelivered,
+ final AMQShortString exchange,
+ final AMQShortString routingKey
+ )
+ {
+ return new BasicDeliverBodyImpl(
+ consumerTag,
+ deliveryTag,
+ redelivered,
+ exchange,
+ routingKey
+ );
+ }
+
+ public BasicGetBody createBasicGetBody(
+ final int ticket,
+ final AMQShortString queue,
+ final boolean noAck
+ )
+ {
+ return new BasicGetBodyImpl(
+ ticket,
+ queue,
+ noAck
+ );
+ }
+
+ public BasicGetOkBody createBasicGetOkBody(
+ final long deliveryTag,
+ final boolean redelivered,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final long messageCount
+ )
+ {
+ return new BasicGetOkBodyImpl(
+ deliveryTag,
+ redelivered,
+ exchange,
+ routingKey,
+ messageCount
+ );
+ }
+
+ public BasicGetEmptyBody createBasicGetEmptyBody(
+ final AMQShortString clusterId
+ )
+ {
+ return new BasicGetEmptyBodyImpl(
+ clusterId
+ );
+ }
+
+ public BasicAckBody createBasicAckBody(
+ final long deliveryTag,
+ final boolean multiple
+ )
+ {
+ return new BasicAckBodyImpl(
+ deliveryTag,
+ multiple
+ );
+ }
+
+ public BasicRejectBody createBasicRejectBody(
+ final long deliveryTag,
+ final boolean requeue
+ )
+ {
+ return new BasicRejectBodyImpl(
+ deliveryTag,
+ requeue
+ );
+ }
+
+ public BasicRecoverBody createBasicRecoverBody(
+ final boolean requeue
+ )
+ {
+ return new BasicRecoverBodyImpl(
+ requeue
+ );
+ }
+
+ public BasicRecoverSyncOkBody createBasicRecoverSyncOkBody(
+ )
+ {
+ return new BasicRecoverSyncOkBodyImpl(
+ );
+ }
+
+ public BasicRecoverSyncBody createBasicRecoverSyncBody(
+ final boolean requeue
+ )
+ {
+ return new BasicRecoverSyncBodyImpl(
+ requeue
+ );
+ }
+
+
+
+
+ public FileQosBody createFileQosBody(
+ final long prefetchSize,
+ final int prefetchCount,
+ final boolean global
+ )
+ {
+ return new FileQosBodyImpl(
+ prefetchSize,
+ prefetchCount,
+ global
+ );
+ }
+
+ public FileQosOkBody createFileQosOkBody(
+ )
+ {
+ return new FileQosOkBodyImpl(
+ );
+ }
+
+ public FileConsumeBody createFileConsumeBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString consumerTag,
+ final boolean noLocal,
+ final boolean noAck,
+ final boolean exclusive,
+ final boolean nowait,
+ final FieldTable filter
+ )
+ {
+ return new FileConsumeBodyImpl(
+ ticket,
+ queue,
+ consumerTag,
+ noLocal,
+ noAck,
+ exclusive,
+ nowait,
+ filter
+ );
+ }
+
+ public FileConsumeOkBody createFileConsumeOkBody(
+ final AMQShortString consumerTag
+ )
+ {
+ return new FileConsumeOkBodyImpl(
+ consumerTag
+ );
+ }
+
+ public FileCancelBody createFileCancelBody(
+ final AMQShortString consumerTag,
+ final boolean nowait
+ )
+ {
+ return new FileCancelBodyImpl(
+ consumerTag,
+ nowait
+ );
+ }
+
+ public FileCancelOkBody createFileCancelOkBody(
+ final AMQShortString consumerTag
+ )
+ {
+ return new FileCancelOkBodyImpl(
+ consumerTag
+ );
+ }
+
+ public FileOpenBody createFileOpenBody(
+ final AMQShortString identifier,
+ final long contentSize
+ )
+ {
+ return new FileOpenBodyImpl(
+ identifier,
+ contentSize
+ );
+ }
+
+ public FileOpenOkBody createFileOpenOkBody(
+ final long stagedSize
+ )
+ {
+ return new FileOpenOkBodyImpl(
+ stagedSize
+ );
+ }
+
+ public FileStageBody createFileStageBody(
+ )
+ {
+ return new FileStageBodyImpl(
+ );
+ }
+
+ public FilePublishBody createFilePublishBody(
+ final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean mandatory,
+ final boolean immediate,
+ final AMQShortString identifier
+ )
+ {
+ return new FilePublishBodyImpl(
+ ticket,
+ exchange,
+ routingKey,
+ mandatory,
+ immediate,
+ identifier
+ );
+ }
+
+ public FileReturnBody createFileReturnBody(
+ final int replyCode,
+ final AMQShortString replyText,
+ final AMQShortString exchange,
+ final AMQShortString routingKey
+ )
+ {
+ return new FileReturnBodyImpl(
+ replyCode,
+ replyText,
+ exchange,
+ routingKey
+ );
+ }
+
+ public FileDeliverBody createFileDeliverBody(
+ final AMQShortString consumerTag,
+ final long deliveryTag,
+ final boolean redelivered,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final AMQShortString identifier
+ )
+ {
+ return new FileDeliverBodyImpl(
+ consumerTag,
+ deliveryTag,
+ redelivered,
+ exchange,
+ routingKey,
+ identifier
+ );
+ }
+
+ public FileAckBody createFileAckBody(
+ final long deliveryTag,
+ final boolean multiple
+ )
+ {
+ return new FileAckBodyImpl(
+ deliveryTag,
+ multiple
+ );
+ }
+
+ public FileRejectBody createFileRejectBody(
+ final long deliveryTag,
+ final boolean requeue
+ )
+ {
+ return new FileRejectBodyImpl(
+ deliveryTag,
+ requeue
+ );
+ }
+
+
+
+
+ public StreamQosBody createStreamQosBody(
+ final long prefetchSize,
+ final int prefetchCount,
+ final long consumeRate,
+ final boolean global
+ )
+ {
+ return new StreamQosBodyImpl(
+ prefetchSize,
+ prefetchCount,
+ consumeRate,
+ global
+ );
+ }
+
+ public StreamQosOkBody createStreamQosOkBody(
+ )
+ {
+ return new StreamQosOkBodyImpl(
+ );
+ }
+
+ public StreamConsumeBody createStreamConsumeBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString consumerTag,
+ final boolean noLocal,
+ final boolean exclusive,
+ final boolean nowait,
+ final FieldTable filter
+ )
+ {
+ return new StreamConsumeBodyImpl(
+ ticket,
+ queue,
+ consumerTag,
+ noLocal,
+ exclusive,
+ nowait,
+ filter
+ );
+ }
+
+ public StreamConsumeOkBody createStreamConsumeOkBody(
+ final AMQShortString consumerTag
+ )
+ {
+ return new StreamConsumeOkBodyImpl(
+ consumerTag
+ );
+ }
+
+ public StreamCancelBody createStreamCancelBody(
+ final AMQShortString consumerTag,
+ final boolean nowait
+ )
+ {
+ return new StreamCancelBodyImpl(
+ consumerTag,
+ nowait
+ );
+ }
+
+ public StreamCancelOkBody createStreamCancelOkBody(
+ final AMQShortString consumerTag
+ )
+ {
+ return new StreamCancelOkBodyImpl(
+ consumerTag
+ );
+ }
+
+ public StreamPublishBody createStreamPublishBody(
+ final int ticket,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final boolean mandatory,
+ final boolean immediate
+ )
+ {
+ return new StreamPublishBodyImpl(
+ ticket,
+ exchange,
+ routingKey,
+ mandatory,
+ immediate
+ );
+ }
+
+ public StreamReturnBody createStreamReturnBody(
+ final int replyCode,
+ final AMQShortString replyText,
+ final AMQShortString exchange,
+ final AMQShortString routingKey
+ )
+ {
+ return new StreamReturnBodyImpl(
+ replyCode,
+ replyText,
+ exchange,
+ routingKey
+ );
+ }
+
+ public StreamDeliverBody createStreamDeliverBody(
+ final AMQShortString consumerTag,
+ final long deliveryTag,
+ final AMQShortString exchange,
+ final AMQShortString queue
+ )
+ {
+ return new StreamDeliverBodyImpl(
+ consumerTag,
+ deliveryTag,
+ exchange,
+ queue
+ );
+ }
+
+
+
+
+ public TxSelectBody createTxSelectBody(
+ )
+ {
+ return new TxSelectBodyImpl(
+ );
+ }
+
+ public TxSelectOkBody createTxSelectOkBody(
+ )
+ {
+ return new TxSelectOkBodyImpl(
+ );
+ }
+
+ public TxCommitBody createTxCommitBody(
+ )
+ {
+ return new TxCommitBodyImpl(
+ );
+ }
+
+ public TxCommitOkBody createTxCommitOkBody(
+ )
+ {
+ return new TxCommitOkBodyImpl(
+ );
+ }
+
+ public TxRollbackBody createTxRollbackBody(
+ )
+ {
+ return new TxRollbackBodyImpl(
+ );
+ }
+
+ public TxRollbackOkBody createTxRollbackOkBody(
+ )
+ {
+ return new TxRollbackOkBodyImpl(
+ );
+ }
+
+
+
+
+ public DtxSelectBody createDtxSelectBody(
+ )
+ {
+ return new DtxSelectBodyImpl(
+ );
+ }
+
+ public DtxSelectOkBody createDtxSelectOkBody(
+ )
+ {
+ return new DtxSelectOkBodyImpl(
+ );
+ }
+
+ public DtxStartBody createDtxStartBody(
+ final AMQShortString dtxIdentifier
+ )
+ {
+ return new DtxStartBodyImpl(
+ dtxIdentifier
+ );
+ }
+
+ public DtxStartOkBody createDtxStartOkBody(
+ )
+ {
+ return new DtxStartOkBodyImpl(
+ );
+ }
+
+
+
+
+ public TunnelRequestBody createTunnelRequestBody(
+ final FieldTable metaData
+ )
+ {
+ return new TunnelRequestBodyImpl(
+ metaData
+ );
+ }
+
+
+
+
+ public MessageTransferBody createMessageTransferBody(
+ final int ticket,
+ final AMQShortString destination,
+ final boolean redelivered,
+ final boolean immediate,
+ final long ttl,
+ final short priority,
+ final long timestamp,
+ final short deliveryMode,
+ final long expiration,
+ final AMQShortString exchange,
+ final AMQShortString routingKey,
+ final AMQShortString messageId,
+ final AMQShortString correlationId,
+ final AMQShortString replyTo,
+ final AMQShortString contentType,
+ final AMQShortString contentEncoding,
+ final AMQShortString userId,
+ final AMQShortString appId,
+ final AMQShortString transactionId,
+ final byte[] securityToken,
+ final FieldTable applicationHeaders,
+ final Content body
+ )
+ {
+ return new MessageTransferBodyImpl(
+ ticket,
+ destination,
+ redelivered,
+ immediate,
+ ttl,
+ priority,
+ timestamp,
+ deliveryMode,
+ expiration,
+ exchange,
+ routingKey,
+ messageId,
+ correlationId,
+ replyTo,
+ contentType,
+ contentEncoding,
+ userId,
+ appId,
+ transactionId,
+ securityToken,
+ applicationHeaders,
+ body
+ );
+ }
+
+ public MessageConsumeBody createMessageConsumeBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString destination,
+ final boolean noLocal,
+ final boolean noAck,
+ final boolean exclusive,
+ final FieldTable filter
+ )
+ {
+ return new MessageConsumeBodyImpl(
+ ticket,
+ queue,
+ destination,
+ noLocal,
+ noAck,
+ exclusive,
+ filter
+ );
+ }
+
+ public MessageCancelBody createMessageCancelBody(
+ final AMQShortString destination
+ )
+ {
+ return new MessageCancelBodyImpl(
+ destination
+ );
+ }
+
+ public MessageGetBody createMessageGetBody(
+ final int ticket,
+ final AMQShortString queue,
+ final AMQShortString destination,
+ final boolean noAck
+ )
+ {
+ return new MessageGetBodyImpl(
+ ticket,
+ queue,
+ destination,
+ noAck
+ );
+ }
+
+ public MessageRecoverBody createMessageRecoverBody(
+ final boolean requeue
+ )
+ {
+ return new MessageRecoverBodyImpl(
+ requeue
+ );
+ }
+
+ public MessageOpenBody createMessageOpenBody(
+ final byte[] reference
+ )
+ {
+ return new MessageOpenBodyImpl(
+ reference
+ );
+ }
+
+ public MessageCloseBody createMessageCloseBody(
+ final byte[] reference
+ )
+ {
+ return new MessageCloseBodyImpl(
+ reference
+ );
+ }
+
+ public MessageAppendBody createMessageAppendBody(
+ final byte[] reference,
+ final byte[] bytes
+ )
+ {
+ return new MessageAppendBodyImpl(
+ reference,
+ bytes
+ );
+ }
+
+ public MessageCheckpointBody createMessageCheckpointBody(
+ final byte[] reference,
+ final AMQShortString identifier
+ )
+ {
+ return new MessageCheckpointBodyImpl(
+ reference,
+ identifier
+ );
+ }
+
+ public MessageResumeBody createMessageResumeBody(
+ final byte[] reference,
+ final AMQShortString identifier
+ )
+ {
+ return new MessageResumeBodyImpl(
+ reference,
+ identifier
+ );
+ }
+
+ public MessageQosBody createMessageQosBody(
+ final long prefetchSize,
+ final int prefetchCount,
+ final boolean global
+ )
+ {
+ return new MessageQosBodyImpl(
+ prefetchSize,
+ prefetchCount,
+ global
+ );
+ }
+
+ public MessageOkBody createMessageOkBody(
+ )
+ {
+ return new MessageOkBodyImpl(
+ );
+ }
+
+ public MessageEmptyBody createMessageEmptyBody(
+ )
+ {
+ return new MessageEmptyBodyImpl(
+ );
+ }
+
+ public MessageRejectBody createMessageRejectBody(
+ final int code,
+ final AMQShortString text
+ )
+ {
+ return new MessageRejectBodyImpl(
+ code,
+ text
+ );
+ }
+
+ public MessageOffsetBody createMessageOffsetBody(
+ final long value
+ )
+ {
+ return new MessageOffsetBodyImpl(
+ value
+ );
+ }
+
+
+ */
+
+ /*
+
+ public ProtocolVersionMethodConverter getProtocolVersionMethodConverter()
+ {
+ return _protocolVersionConverter;
+ }
+
+ */
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/impl/AMQMessageImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/impl/AMQMessageImpl.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/impl/AMQMessageImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors by
+ * the @authors tag. See the copyright.txt in the distribution for a full listing of individual contributors. This is
+ * free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+ * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details. You should have received a copy of the GNU Lesser General Public License along with this software; if not,
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.amq.impl;
+
+import java.nio.ByteBuffer;
+
+import org.jboss.messaging.amq.AMQMessage;
+import org.jboss.messaging.amq.framing.ContentHeaderProperties;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.impl.ServerMessageImpl;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A AMQMessageImpl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class AMQMessageImpl implements AMQMessage
+{
+
+ private final SimpleString exchange;
+
+ private final SimpleString routingKey;
+
+ private final boolean immediate;
+
+ private final boolean mandatory;
+
+ private ContentHeaderProperties header;
+
+ private MessagingBuffer payload;
+
+ private long bodySize;
+
+ private int currentBodySize;
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public AMQMessageImpl(SimpleString exchange, SimpleString routingKey, boolean immediate, boolean mandatory)
+ {
+ this.exchange = exchange;
+ this.routingKey = routingKey;
+ this.immediate = immediate;
+ this.mandatory = mandatory;
+
+ currentBodySize = 0;
+ payload = new ByteBufferWrapper(ByteBuffer.allocate(0));
+ }
+
+ // AMQMessage implementation -------------------------------------
+
+ public SimpleString getExchange()
+ {
+ return exchange;
+ }
+
+ public SimpleString getRoutingKey()
+ {
+ return routingKey;
+ }
+
+ public boolean isImmediate()
+ {
+ return immediate;
+ }
+
+ public boolean isMandatory()
+ {
+ return mandatory;
+ }
+
+ public void setHeader(ContentHeaderProperties properties)
+ {
+ this.header = properties;
+ }
+
+ public ContentHeaderProperties getHeader()
+ {
+ return header;
+ }
+
+ // TODO make it more efficient
+ public boolean addPayload(MessagingBuffer framePayload, int frameSize)
+ {
+ MessagingBuffer newBuffer = payload.createNewBuffer(currentBodySize + frameSize);
+
+ // copy the current payload in the new buffer
+ byte[] b = new byte[currentBodySize];
+ payload.getBytes(b);
+ newBuffer.putBytes(b);
+
+ // add the frame payload
+ b = new byte[frameSize];
+ framePayload.getBytes(b);
+ newBuffer.putBytes(b);
+
+ currentBodySize += frameSize;
+ payload = newBuffer;
+ return (currentBodySize == bodySize);
+ }
+
+ public long getBodySize()
+ {
+ return bodySize;
+ }
+
+ public void setBodySize(long bodySize)
+ {
+ this.bodySize = bodySize;
+ }
+
+ public ServerMessage toCoreMessage()
+ {
+ ServerMessage msg = new ServerMessageImpl();
+ msg.setDestination(getRoutingKey());
+ msg.setBody(payload);
+
+ return msg;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/protocol/AMQConstant.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/protocol/AMQConstant.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/protocol/AMQConstant.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,238 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.protocol;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.messaging.amq.framing.AMQShortString;
+
+/**
+ * Defines constants for AMQP codes and also acts as a factory for creating such constants from the raw codes. Each
+ * constant also defines a short human readable description of the constant.
+ *
+ * @todo Why would a constant be defined that is not in the map? Seems more natural that getConstant should raise an
+ * exception for an unknown constant. Or else provide an explanation of why this is so. Also, there is no way for
+ * callers to determine the unknown status of a code except by comparing its name to "unknown code", which would
+ * seem to render this scheme a little bit pointless?
+ *
+ * @todo Java has a nice enum construct for doing this sort of thing. Maybe this is done in the old style for Java 1.4
+ * backward compatability? Now that is handled through retrotranslater it may be time to use enum.
+ *
+ * <p/><tabld id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Define the set of AMQP status codes.
+ * <tr><td> Provide a factory to lookup constants by their code.
+ * <tr><td>
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public final class AMQConstant
+{
+ /** Defines a map from codes to constants. */
+ private static Map _codeMap = new HashMap();
+
+ /** Indicates that the method completed successfully. */
+ public static final AMQConstant REPLY_SUCCESS = new AMQConstant(200, "reply success", true);
+
+ public static final AMQConstant FRAME_END = new AMQConstant(206, "frame end", true);
+
+ /**
+ * The client asked for a specific message that is no longer available. The message was delivered to another
+ * client, or was purged from the queue for some other reason.
+ */
+ public static final AMQConstant NOT_DELIVERED = new AMQConstant(310, "not delivered", true);
+
+ /**
+ * The client attempted to transfer content larger than the server could accept at the present time. The client
+ * may retry at a later time.
+ */
+ public static final AMQConstant MESSAGE_TOO_LARGE = new AMQConstant(311, "message too large", true);
+
+ /**
+ * When the exchange cannot route the result of a .Publish, most likely due to an invalid routing key. Only when
+ * the mandatory flag is set.
+ */
+ public static final AMQConstant NO_ROUTE = new AMQConstant(312, "no route", true);
+
+ /**
+ * When the exchange cannot deliver to a consumer when the immediate flag is set. As a result of pending data on
+ * the queue or the absence of any consumers of the queue.
+ */
+ public static final AMQConstant NO_CONSUMERS = new AMQConstant(313, "no consumers", true);
+
+ /**
+ * An operator intervened to close the connection for some reason. The client may retry at some later date.
+ */
+ public static final AMQConstant CONTEXT_IN_USE = new AMQConstant(320, "context in use", true);
+
+ /** The client tried to work with an unknown virtual host or cluster. */
+ public static final AMQConstant INVALID_PATH = new AMQConstant(402, "invalid path", true);
+
+ /** The client attempted to work with a server entity to which it has no access due to security settings. */
+ public static final AMQConstant ACCESS_REFUSED = new AMQConstant(403, "access refused", true);
+
+ /** The client attempted to work with a server entity that does not exist. */
+ public static final AMQConstant NOT_FOUND = new AMQConstant(404, "not found", true);
+
+ /**
+ * The client attempted to work with a server entity to which it has no access because another client is
+ * working with it.
+ */
+ public static final AMQConstant ALREADY_EXISTS = new AMQConstant(405, "Already exists", true);
+
+ /** The client requested a method that was not allowed because some precondition failed. */
+ public static final AMQConstant IN_USE = new AMQConstant(406, "In use", true);
+
+ public static final AMQConstant INVALID_ROUTING_KEY = new AMQConstant(407, "routing key invalid", true);
+
+ public static final AMQConstant REQUEST_TIMEOUT = new AMQConstant(408, "Request Timeout", true);
+
+ public static final AMQConstant INVALID_ARGUMENT = new AMQConstant(409, "argument invalid", true);
+
+ /**
+ * The client sent a malformed frame that the server could not decode. This strongly implies a programming error
+ * in the client.
+ */
+ public static final AMQConstant FRAME_ERROR = new AMQConstant(501, "frame error", true);
+
+ /**
+ * The client sent a frame that contained illegal values for one or more fields. This strongly implies a
+ * programming error in the client.
+ */
+ public static final AMQConstant SYNTAX_ERROR = new AMQConstant(502, "syntax error", true);
+
+ /**
+ * The client sent an invalid sequence of frames, attempting to perform an operation that was considered invalid
+ * by the server. This usually implies a programming error in the client.
+ */
+ public static final AMQConstant COMMAND_INVALID = new AMQConstant(503, "command invalid", true);
+
+ /**
+ * The client attempted to work with a channel that had not been correctly opened. This most likely indicates a
+ * fault in the client layer.
+ */
+ public static final AMQConstant CHANNEL_ERROR = new AMQConstant(504, "channel error", true);
+
+ /**
+ * The server could not complete the method because it lacked sufficient resources. This may be due to the client
+ * creating too many of some type of entity.
+ */
+ public static final AMQConstant RESOURCE_ERROR = new AMQConstant(506, "resource error", true);
+
+ /**
+ * The client tried to work with some entity in a manner that is prohibited by the server, due to security settings
+ * or by some other criteria.
+ */
+ public static final AMQConstant NOT_ALLOWED = new AMQConstant(530, "not allowed", true);
+
+ /** The client tried to use functionality that is not implemented in the server. */
+ public static final AMQConstant NOT_IMPLEMENTED = new AMQConstant(540, "not implemented", true);
+
+ /**
+ * The server could not complete the method because of an internal error. The server may require intervention by
+ * an operator in order to resume normal operations.
+ */
+ public static final AMQConstant INTERNAL_ERROR = new AMQConstant(541, "internal error", true);
+
+ public static final AMQConstant FRAME_MIN_SIZE = new AMQConstant(4096, "frame min size", true);
+
+ /**
+ * The server does not support the protocol version
+ */
+ public static final AMQConstant UNSUPPORTED_BROKER_PROTOCOL_ERROR = new AMQConstant(542, "broker unsupported protocol", true);
+ /**
+ * The client imp does not support the protocol version
+ */
+ public static final AMQConstant UNSUPPORTED_CLIENT_PROTOCOL_ERROR = new AMQConstant(543, "client unsupported protocol", true);
+
+ /** The AMQP status code. */
+ private int _code;
+
+ /** A short description of the status code. */
+ private AMQShortString _name;
+
+ /**
+ * Creates a new AMQP status code.
+ *
+ * @param code The code.
+ * @param name A short description of the code.
+ * @param map <tt>true</tt> to register the code as a known code, <tt>false</tt> otherwise.
+ */
+ private AMQConstant(int code, String name, boolean map)
+ {
+ _code = code;
+ _name = new AMQShortString(name);
+ if (map)
+ {
+ _codeMap.put(new Integer(code), this);
+ }
+ }
+
+ /**
+ * Creates a constant for a status code by looking up the code in the map of known codes. If the code is not known
+ * a constant is still created for it, but it is marked as unknown.
+ *
+ * @param code The AMQP status code.
+ *
+ * @return The AMQP status code encapsulated as a constant.
+ */
+ public static AMQConstant getConstant(int code)
+ {
+ AMQConstant c = (AMQConstant) _codeMap.get(new Integer(code));
+ if (c == null)
+ {
+ c = new AMQConstant(code, "unknown code", false);
+ }
+
+ return c;
+ }
+
+ /**
+ * Gets the underlying AMQP status code.
+ *
+ * @return The AMQP status code.
+ */
+ public int getCode()
+ {
+ return _code;
+ }
+
+ /**
+ * Gets a short description of the status code.
+ *
+ * @return A short description of the status code.
+ */
+ public AMQShortString getName()
+ {
+ return _name;
+ }
+
+ /**
+ * Renders the constant as a string, mainly for debugging purposes.
+ *
+ * @return The status code and its description.
+ */
+ public String toString()
+ {
+ return _code + ": " + _name;
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/server/protocol/HeartbeatConfig.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/server/protocol/HeartbeatConfig.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/server/protocol/HeartbeatConfig.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,74 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.server.protocol;
+
+
+/**
+ * A HeartbeatConfig
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class HeartbeatConfig
+{
+ private static final HeartbeatConfig instance = new HeartbeatConfig();
+
+// @Configured(path = "heartbeat.delay", defaultValue = "5")
+ public int delay = 5;//in secs
+// @Configured(path = "heartbeat.timeoutFactor", defaultValue = "2.0")
+ public double timeoutFactor = 2;
+
+ public double getTimeoutFactor()
+ {
+ return timeoutFactor;
+ }
+
+ public void setTimeoutFactor(double timeoutFactor)
+ {
+ this.timeoutFactor = timeoutFactor;
+ }
+
+ public int getDelay()
+ {
+ return delay;
+ }
+
+ public void setDelay(int delay)
+ {
+ this.delay = delay;
+ }
+
+ int getTimeout(int writeDelay)
+ {
+ return (int) (timeoutFactor * writeDelay);
+ }
+
+ public static HeartbeatConfig getInstance()
+ {
+ return instance;
+ // return ApplicationRegistry.getInstance().getConfiguredObject(HeartbeatConfig.class);
+ }
+
+ public String toString()
+ {
+ return "HeartBeatConfig{delay = " + delay + " timeoutFactor = " + timeoutFactor + "}";
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/amq/server/security/auth/AuthenticationResult.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/amq/server/security/auth/AuthenticationResult.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/amq/server/security/auth/AuthenticationResult.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.amq.server.security.auth;
+
+/**
+ * A AuthenticationResult
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class AuthenticationResult
+{
+ public enum AuthenticationStatus
+ {
+ SUCCESS, CONTINUE, ERROR
+ }
+
+ public AuthenticationStatus status;
+ public byte[] challenge;
+
+ public AuthenticationResult(byte[] challenge, AuthenticationStatus status)
+ {
+ this.status = status;
+ this.challenge = challenge;
+ }
+
+ public AuthenticationResult(AuthenticationStatus status)
+ {
+ this.status = status;
+ }
+}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/client/impl/ClientSessionPacketHandler.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/client/impl/ClientSessionPacketHandler.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/client/impl/ClientSessionPacketHandler.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -26,11 +26,11 @@
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_RECEIVETOKENS;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_RECEIVE_MSG;
+import org.jboss.messaging.amq.framing.AMQFrame;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.ChannelHandler;
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.remoting.impl.wireformat.MessagingExceptionMessage;
-import org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionProducerFlowCreditMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.SessionReceiveMessage;
@@ -97,4 +97,9 @@
log.error("Failed to handle packet", e);
}
}
+
+ public void handleFrame(AMQFrame frame)
+ {
+ // FIXME no client-side handling for AMQ
+ }
}
\ No newline at end of file
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/Channel.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/Channel.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/Channel.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -13,6 +13,7 @@
import java.util.concurrent.Executor;
+import org.jboss.messaging.amq.framing.AMQFrame;
import org.jboss.messaging.core.exception.MessagingException;
/**
@@ -55,4 +56,6 @@
Executor getExecutor();
void interruptBlocking();
+
+ void send(AMQFrame generateFrame);
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/ChannelHandler.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/ChannelHandler.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/ChannelHandler.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -21,6 +21,8 @@
*/
package org.jboss.messaging.core.remoting;
+import org.jboss.messaging.amq.framing.AMQFrame;
+
/**
* A ChannelHandler
*
@@ -30,4 +32,6 @@
public interface ChannelHandler
{
void handlePacket(Packet packet);
+
+ void handleFrame(AMQFrame frame);
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ByteBufferWrapper.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -118,6 +118,11 @@
return buffer.get();
}
+ public byte getByte(int position)
+ {
+ return buffer.get(position);
+ }
+
public short getUnsignedByte()
{
return (short)(buffer.get() & 0xFF);
@@ -366,5 +371,15 @@
{
return buffer;
}
+
+ public long getUnsignedInt()
+ {
+ throw new IllegalStateException("Not implemented");
+ }
+
+ public void skip(int i)
+ {
+ throw new IllegalStateException("Not implemented");
+ }
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ConnectionRegistryImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ConnectionRegistryImpl.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ConnectionRegistryImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -26,6 +26,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
+import org.jboss.messaging.amq.framing.AMQDataBlock;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.ConnectionRegistry;
@@ -431,5 +432,10 @@
{
conn.bufferReceived(connectionID, buffer);
}
+
+ public void dataBlockReceived(Object connectionID, AMQDataBlock dataBlock)
+ {
+ conn.dataBlockReceived(connectionID, dataBlock);
+ }
}
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/ExpandingMessagingBuffer.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -88,6 +88,11 @@
return buf.get();
}
+ public byte getByte(int position)
+ {
+ return buf.get(position);
+ }
+
public void getBytes(byte[] bytes)
{
buf.get(bytes);
@@ -385,4 +390,15 @@
return newBuf;
}
+
+ public long getUnsignedInt()
+ {
+ throw new IllegalStateException("Not implemented");
+ }
+
+ public void skip(int i)
+ {
+ throw new IllegalStateException("Not implemented");
+ }
+
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingConnectionImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -90,9 +90,17 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import org.jboss.messaging.amq.AMQException;
+import org.jboss.messaging.amq.framing.AMQBody;
+import org.jboss.messaging.amq.framing.AMQDataBlock;
+import org.jboss.messaging.amq.framing.AMQFrame;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.ChannelCloseOkBody;
+import org.jboss.messaging.amq.framing.MethodRegistry;
+import org.jboss.messaging.amq.framing.ProtocolInitiation;
+import org.jboss.messaging.amq.framing.ProtocolVersion;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.remoting.Channel;
import org.jboss.messaging.core.remoting.ChannelHandler;
import org.jboss.messaging.core.remoting.FailureListener;
@@ -100,6 +108,7 @@
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.remoting.RemotingConnection;
import org.jboss.messaging.core.remoting.ResponseNotifier;
+import org.jboss.messaging.core.remoting.impl.amqp.IoBufferWrapper;
import org.jboss.messaging.core.remoting.impl.wireformat.CreateSessionMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.CreateSessionResponseMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.MessagingExceptionMessage;
@@ -267,7 +276,7 @@
final ChannelHandler ppHandler = new PingPongHandler();
- pingChannel.setHandler(ppHandler);
+ pingChannel.setHandler(ppHandler);
}
public void startPinger()
@@ -433,7 +442,69 @@
}
}
}
+
+ public void dataBlockReceived(Object connectionID, AMQDataBlock dataBlock)
+ {
+ System.out.println("[RCV] RemotingConnectionImpl.dataBlockReceived(): " + dataBlock.getClass());
+ if (dataBlock instanceof ProtocolInitiation)
+ {
+ try
+ {
+ ProtocolInitiation pi = (ProtocolInitiation)dataBlock;
+
+ // Fails if not correct
+ ProtocolVersion pv = pi.checkVersion();
+ // This sets the protocol version (and hence framing classes) for this session.
+
+ String mechanisms = "AMQPLAIN";
+
+ String locales = "en_US";
+
+
+ AMQMethodBody responseBody = MethodRegistry.registry_0_9.createConnectionStartBody((short) 0,
+ (short) 9,
+ null,
+ mechanisms.getBytes(),
+ locales.getBytes());
+ AMQFrame frame = responseBody.generateFrame(0);
+ transportConnection.write(new IoBufferWrapper(frame.toIoBuffer()));
+ System.out.println("protocol initiation success");
+ }
+ catch (AMQException e)
+ {
+ ProtocolInitiation pi = new ProtocolInitiation(ProtocolVersion.getLatestSupportedVersion());
+ transportConnection.write(new IoBufferWrapper(pi.toIoBuffer()));
+ System.out.println("protocol initiation failure");
+ }
+ }
+ else if (dataBlock instanceof AMQFrame)
+ {
+ AMQFrame frame = (AMQFrame)dataBlock;
+
+ synchronized (this)
+ {
+ System.out.println("channelID = " + frame.getChannel());
+ Long channelID = (long)frame.getChannel();
+// ChannelImpl channel = channels.get(channelID);
+ ChannelImpl channel = channels.get((long)1);
+
+// if (channel == null)
+// {
+// channel = new ChannelImpl(this, channelID, true, -1, true);
+//
+// channels.put(channelID, channel);
+// }
+
+ System.out.println("channel =" + channel);
+ if (channel != null)
+ {
+ channel.handleFrame(frame);
+ }
+ }
+ }
+ }
+
public void activate()
{
active = true;
@@ -501,6 +572,11 @@
transportConnection.write(buffer);
}
+
+ public void doWrite(AMQFrame frame)
+ {
+ transportConnection.write(new IoBufferWrapper(frame.toIoBuffer()));
+ }
private Packet decode(final MessagingBuffer in)
{
@@ -988,6 +1064,13 @@
}
}
+ public void send(AMQFrame frame)
+ {
+ connection.doWrite(frame);
+ }
+
+ private final Object waitLock = new Object();
+
public Executor getExecutor()
{
return executor;
@@ -1256,6 +1339,49 @@
lock.unlock();
}
+ private void handleFrame(final AMQFrame frame)
+ {
+ AMQBody body = frame.getBodyFrame();
+ long channelId = frame.getChannel();
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Frame Received: " + frame);
+ }
+
+ // Check that this channel is not closing
+ if (channelAwaitingClosure(channelId))
+ {
+ if ((frame.getBodyFrame() instanceof ChannelCloseOkBody))
+ {
+ if (log.isInfoEnabled())
+ {
+ log.info("Channel[" + channelId + "] awaiting closure - processing close-ok");
+ }
+ }
+ else
+ {
+ if (log.isInfoEnabled())
+ {
+ log.info("Channel[" + channelId + "] awaiting closure ignoring");
+ }
+
+ return;
+ }
+ }
+
+ System.out.println("handler = " + handler);
+ System.out.println("frame = " + frame);
+ handler.handleFrame(frame);
+ }
+
+ public boolean channelAwaitingClosure(long channelId)
+ {
+ // FIXME
+ return false;
+ //return _closingChannelsList.contains(channelId);
+ }
+
private void handlePacket(final Packet packet)
{
if (packet.getType() == PACKETS_CONFIRMED)
@@ -1449,6 +1575,11 @@
throw new IllegalArgumentException("Invalid packet " + packet);
}
}
+
+ public void handleFrame(AMQFrame frame)
+ {
+ // FIXME no replication for AMQ
+ }
}
}
@@ -1505,5 +1636,10 @@
throw new IllegalArgumentException("Invalid packet: " + packet);
}
}
+
+ public void handleFrame(AMQFrame frame)
+ {
+ // FIXME no ping pong for AMQ
+ }
}
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -24,6 +24,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import org.jboss.messaging.amq.framing.AMQDataBlock;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
@@ -214,6 +215,10 @@
public void setMessagingServer(final MessagingServer server)
{
this.server = server;
+ for (Acceptor acceptor : acceptors)
+ {
+ acceptor.setMessagingServer(server);
+ }
}
public void setBackup(final boolean backup)
@@ -346,6 +351,16 @@
conn.bufferReceived(connectionID, buffer);
}
}
+
+ public void dataBlockReceived(Object connectionID, AMQDataBlock dataBlock)
+ {
+ RemotingConnection conn = connections.get(connectionID);
+
+ if (conn != null)
+ {
+ conn.dataBlockReceived(connectionID, dataBlock);
+ }
+ }
}
}
\ No newline at end of file
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptor.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptor.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptor.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,282 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_HOST;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_KEYSTORE_PASSWORD;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_KEYSTORE_PATH;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_PORT;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_SSL_ENABLED;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_TCP_NODELAY;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_TRUSTSTORE_PASSWORD;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.DEFAULT_TRUSTSTORE_PATH;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.HOST_PROP_NAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.KEYSTORE_PASSWORD_PROP_NAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.KEYSTORE_PATH_PROP_NAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.PORT_PROP_NAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.SSL_ENABLED_PROP_NAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.TCP_NODELAY_PROPNAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME;
+import static org.jboss.messaging.core.remoting.impl.mina.TransportConstants.TRUSTSTORE_PATH_PROP_NAME;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.service.IoService;
+import org.apache.mina.core.service.IoServiceListener;
+import org.apache.mina.core.session.IdleStatus;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.SocketAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
+import org.jboss.messaging.amq.codec.AMQCodecFactory;
+import org.jboss.messaging.amq.framing.AMQDataBlock;
+import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.util.ConfigurationHelper;
+
+
+/**
+ * A Mina TCP Acceptor that supports SSL
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ */
+public class AMQPMinaAcceptor implements Acceptor
+{
+ public static final Logger log = Logger.getLogger(AMQPMinaAcceptor.class);
+
+
+ // Attributes ------------------------------------------------------------------------------------
+
+ private SocketAcceptor acceptor;
+
+ private IoServiceListener acceptorListener;
+
+ private final BufferHandler handler;
+
+ private final ConnectionLifeCycleListener listener;
+
+ private final boolean sslEnabled;
+
+ private final String host;
+
+ private final int port;
+
+ private final String keyStorePath;
+
+ private final String keyStorePassword;
+
+ private final String trustStorePath;
+
+ private final String trustStorePassword;
+
+ private final boolean tcpNoDelay;
+
+ private final int tcpSendBufferSize;
+
+ private final int tcpReceiveBufferSize;
+
+ private AMQCodecFactory codecFactory;
+
+ public AMQPMinaAcceptor(final Map<String, Object> configuration, final BufferHandler handler,
+ final ConnectionLifeCycleListener listener)
+ {
+ this.handler = handler;
+ this.listener = listener;
+
+ this.sslEnabled =
+ ConfigurationHelper.getBooleanProperty(SSL_ENABLED_PROP_NAME, DEFAULT_SSL_ENABLED, configuration);
+ this.host =
+ ConfigurationHelper.getStringProperty(HOST_PROP_NAME, DEFAULT_HOST, configuration);
+ this.port =
+ ConfigurationHelper.getIntProperty(PORT_PROP_NAME, DEFAULT_PORT, configuration);
+ if (sslEnabled)
+ {
+ this.keyStorePath =
+ ConfigurationHelper.getStringProperty(KEYSTORE_PATH_PROP_NAME, DEFAULT_KEYSTORE_PATH, configuration);
+ this.keyStorePassword =
+ ConfigurationHelper.getStringProperty(KEYSTORE_PASSWORD_PROP_NAME, DEFAULT_KEYSTORE_PASSWORD, configuration);
+ this.trustStorePath =
+ ConfigurationHelper.getStringProperty(TRUSTSTORE_PATH_PROP_NAME, DEFAULT_TRUSTSTORE_PATH, configuration);
+ this.trustStorePassword =
+ ConfigurationHelper.getStringProperty(TRUSTSTORE_PASSWORD_PROP_NAME, DEFAULT_TRUSTSTORE_PASSWORD, configuration);
+ }
+ else
+ {
+ this.keyStorePath = null;
+ this.keyStorePassword = null;
+ this.trustStorePath = null;
+ this.trustStorePassword = null;
+ }
+
+ this.tcpNoDelay =
+ ConfigurationHelper.getBooleanProperty(TCP_NODELAY_PROPNAME, DEFAULT_TCP_NODELAY, configuration);
+ this.tcpSendBufferSize =
+ ConfigurationHelper.getIntProperty(TCP_SENDBUFFER_SIZE_PROPNAME, DEFAULT_TCP_SENDBUFFER_SIZE, configuration);
+ this.tcpReceiveBufferSize =
+ ConfigurationHelper.getIntProperty(TCP_RECEIVEBUFFER_SIZE_PROPNAME, DEFAULT_TCP_RECEIVEBUFFER_SIZE, configuration);
+
+ }
+
+ public synchronized void start() throws Exception
+ {
+ if (acceptor != null)
+ {
+ //Already started
+ return;
+ }
+
+ acceptor = new NioSocketAcceptor();
+
+ acceptor.setSessionDataStructureFactory(new MessagingIOSessionDataStructureFactory());
+
+ DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain();
+ codecFactory = new AMQCodecFactory(true);
+
+ if (sslEnabled)
+ {
+ FilterChainSupport.addSSLFilter(filterChain, false, keyStorePath,
+ keyStorePassword,
+ trustStorePath,
+ trustStorePassword);
+ }
+ FilterChainSupport.addCodecFilter(filterChain, handler, codecFactory);
+
+ // Bind
+ acceptor.setDefaultLocalAddress(new InetSocketAddress(host, port));
+ acceptor.getSessionConfig().setTcpNoDelay(tcpNoDelay);
+ if (tcpReceiveBufferSize != -1)
+ {
+ acceptor.getSessionConfig().setReceiveBufferSize(tcpReceiveBufferSize);
+ }
+ if (tcpSendBufferSize != -1)
+ {
+ acceptor.getSessionConfig().setSendBufferSize(tcpSendBufferSize);
+ }
+ acceptor.setReuseAddress(true);
+ acceptor.getSessionConfig().setReuseAddress(true);
+ acceptor.getSessionConfig().setKeepAlive(true);
+ acceptor.setCloseOnDeactivation(false);
+
+// amqHandler = new AMQPFastProtocolHandler(codecFactory);
+// acceptor.setHandler(amqHandler);
+ acceptor.setHandler(new MinaHandler());
+ acceptor.bind();
+ acceptorListener = new MinaSessionListener();
+ acceptor.addListener(acceptorListener);
+ }
+
+ public synchronized void stop()
+ {
+ if (acceptor == null)
+ {
+ return;
+ }
+
+ // remove the listener before disposing the acceptor
+ // so that we're not notified when the sessions are destroyed
+ acceptor.removeListener(acceptorListener);
+ acceptor.unbind();
+ acceptor.dispose();
+ acceptor = null;
+ }
+
+ public DefaultIoFilterChainBuilder getFilterChain()
+ {
+ return acceptor.getFilterChain();
+ }
+
+ public void setMessagingServer(MessagingServer server)
+ {
+ //amqHandler.setMessagingServer(server);
+ }
+
+ // Inner classes -----------------------------------------------------------------------------
+
+ private final class MinaHandler extends IoHandlerAdapter
+ {
+ @Override
+ public void exceptionCaught(final IoSession session, final Throwable cause)
+ throws Exception
+ {
+ log.error("caught exception " + cause + " for session " + session, cause);
+
+ MessagingException me = new MessagingException(MessagingException.INTERNAL_ERROR, "MINA exception");
+
+ me.initCause(cause);
+
+ listener.connectionException(session.getId(), me);
+ }
+
+ @Override
+ public void messageReceived(final IoSession session, final Object message)
+ throws Exception
+ {
+ if (message instanceof AMQDataBlock)
+ {
+ AMQDataBlock dataBlock = (AMQDataBlock)message;
+ handler.dataBlockReceived(session.getId(), dataBlock);
+ }
+ }
+ }
+
+ private final class MinaSessionListener implements IoServiceListener
+ {
+
+ public void serviceActivated(final IoService service)
+ {
+ }
+
+ public void serviceDeactivated(final IoService service)
+ {
+ }
+
+ public void serviceIdle(final IoService service, final IdleStatus idleStatus)
+ {
+ }
+
+ public void sessionCreated(final IoSession session)
+ {
+ Connection tc = new MinaConnection(session);
+
+ listener.connectionCreated(tc);
+ }
+
+ public void sessionDestroyed(final IoSession session)
+ {
+ listener.connectionDestroyed(session.getId());
+ }
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptorFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptorFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/AMQPMinaAcceptorFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import java.util.Map;
+
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+
+/**
+ *
+ * A MinaAcceptorFactory
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class AMQPMinaAcceptorFactory implements AcceptorFactory
+{
+ public Acceptor createAcceptor(final Map<String, Object> configuration,
+ final BufferHandler handler,
+ final ConnectionLifeCycleListener listener)
+ {
+ return new AMQPMinaAcceptor(configuration, handler, listener);
+ }
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/FilterChainSupport.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/FilterChainSupport.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/FilterChainSupport.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.filter.ssl.SslFilter;
+import org.jboss.messaging.amq.codec.AMQCodecFactory;
+import org.jboss.messaging.amq.codec.AMQProtocolCodecFilter;
+import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ */
+public class FilterChainSupport
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ private FilterChainSupport()
+ {
+ }
+
+ // Public --------------------------------------------------------
+
+ public static void addCodecFilter(final DefaultIoFilterChainBuilder filterChain,
+ final BufferHandler handler, AMQCodecFactory codecFactory)
+ {
+ assert filterChain != null;
+
+ filterChain.addLast("codec", new ProtocolCodecFilter(new AMQProtocolCodecFilter(codecFactory)));
+ }
+
+ public static void addSSLFilter(
+ final DefaultIoFilterChainBuilder filterChain, final boolean client,
+ final String keystorePath, final String keystorePassword, final String trustStorePath,
+ final String trustStorePassword) throws Exception
+ {
+ SSLContext context = SSLSupport.getInstance(client, keystorePath, keystorePassword,
+ trustStorePath, trustStorePassword);
+ SslFilter filter = new SslFilter(context);
+ if (client)
+ {
+ filter.setUseClientMode(true);
+ filter.setWantClientAuth(true);
+ }
+ filterChain.addLast("ssl", filter);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/IoBufferWrapper.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/IoBufferWrapper.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/IoBufferWrapper.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,385 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import static org.jboss.messaging.util.DataConstants.FALSE;
+import static org.jboss.messaging.util.DataConstants.NOT_NULL;
+import static org.jboss.messaging.util.DataConstants.NULL;
+import static org.jboss.messaging.util.DataConstants.TRUE;
+
+import java.nio.charset.Charset;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ *
+ * A BufferWrapper
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class IoBufferWrapper implements MessagingBuffer
+{
+ // Constants -----------------------------------------------------
+
+ private static final Charset utf8 = Charset.forName("UTF-8");
+
+ // Attributes ----------------------------------------------------
+
+ private final IoBuffer buffer;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public IoBufferWrapper(final int size)
+ {
+ buffer = IoBuffer.allocate(size);
+
+ buffer.setAutoExpand(true);
+ }
+
+ public IoBufferWrapper(final IoBuffer buffer)
+ {
+ this.buffer = buffer;
+ }
+
+ // Public --------------------------------------------------------
+
+ // MessagingBuffer implementation ----------------------------------------------
+
+ public byte[] array()
+ {
+ return buffer.array();
+ }
+
+ public int position()
+ {
+ return buffer.position();
+ }
+
+ public void position(final int position)
+ {
+ buffer.position(position);
+ }
+
+ public int limit()
+ {
+ return buffer.limit();
+ }
+
+ public void limit(final int limit)
+ {
+ buffer.limit(limit);
+ }
+
+ public int capacity()
+ {
+ return buffer.capacity();
+ }
+
+ public void flip()
+ {
+ buffer.flip();
+ }
+
+ public MessagingBuffer slice()
+ {
+ return new IoBufferWrapper(buffer.slice());
+ }
+
+ public MessagingBuffer createNewBuffer(int len)
+ {
+ return new IoBufferWrapper(len);
+ }
+
+ public int remaining()
+ {
+ return buffer.remaining();
+ }
+
+ public void rewind()
+ {
+ buffer.rewind();
+ }
+
+ public void putByte(byte byteValue)
+ {
+ buffer.put(byteValue);
+ }
+
+ public void putBytes(final byte[] byteArray)
+ {
+ buffer.put(byteArray);
+ }
+
+ public void putBytes(final byte[] bytes, int offset, int length)
+ {
+ buffer.put(bytes, offset, length);
+ }
+
+ public void putInt(final int intValue)
+ {
+ buffer.putInt(intValue);
+ }
+
+ public void putInt(final int pos, final int intValue)
+ {
+ buffer.putInt(pos, intValue);
+ }
+
+ public void putLong(final long longValue)
+ {
+ buffer.putLong(longValue);
+ }
+
+ public void putFloat(final float floatValue)
+ {
+ buffer.putFloat(floatValue);
+ }
+
+ public void putDouble(final double d)
+ {
+ buffer.putDouble(d);
+ }
+
+ public void putShort(final short s)
+ {
+ buffer.putShort(s);
+ }
+
+ public void putChar(final char chr)
+ {
+ buffer.putChar(chr);
+ }
+
+ public byte getByte()
+ {
+ return buffer.get();
+ }
+
+ public byte getByte(int position)
+ {
+ return buffer.get(position);
+ }
+
+ public short getUnsignedByte()
+ {
+ return buffer.getUnsigned();
+ }
+
+ public void getBytes(final byte[] b)
+ {
+ buffer.get(b);
+ }
+
+ public void getBytes(final byte[] b, final int offset, final int length)
+ {
+ buffer.get(b, offset, length);
+ }
+
+ public int getInt()
+ {
+ return buffer.getInt();
+ }
+
+ public long getLong()
+ {
+ return buffer.getLong();
+ }
+
+ public float getFloat()
+ {
+ return buffer.getFloat();
+ }
+
+ public short getShort()
+ {
+ return buffer.getShort();
+ }
+
+ public int getUnsignedShort()
+ {
+ return buffer.getUnsignedShort();
+ }
+
+ public double getDouble()
+ {
+ return buffer.getDouble();
+ }
+
+ public char getChar()
+ {
+ return buffer.getChar();
+ }
+
+ public void putBoolean(final boolean b)
+ {
+ if (b)
+ {
+ buffer.put(TRUE);
+ } else
+ {
+ buffer.put(FALSE);
+ }
+ }
+
+ public boolean getBoolean()
+ {
+ byte b = buffer.get();
+ return b == TRUE;
+ }
+
+ public void putString(final String nullableString)
+ {
+ buffer.putInt(nullableString.length());
+
+ for (int i = 0; i < nullableString.length(); i++)
+ {
+ buffer.putChar(nullableString.charAt(i));
+ }
+ }
+
+ public void putNullableString(final String nullableString)
+ {
+ if (nullableString == null)
+ {
+ buffer.put(NULL);
+ }
+ else
+ {
+ buffer.put(NOT_NULL);
+
+ putString(nullableString);
+ }
+ }
+
+ public String getString()
+ {
+ int len = buffer.getInt();
+
+ char[] chars = new char[len];
+
+ for (int i = 0; i < len; i++)
+ {
+ chars[i] = buffer.getChar();
+ }
+
+ return new String(chars);
+ }
+
+ public String getNullableString()
+ {
+ byte check = buffer.get();
+
+ if (check == NULL)
+ {
+ return null;
+ }
+ else
+ {
+ return getString();
+ }
+ }
+
+ public void putUTF(final String str) throws Exception
+ {
+ buffer.putPrefixedString(str, utf8.newEncoder());
+ }
+
+ public void putNullableSimpleString(final SimpleString string)
+ {
+ if (string == null)
+ {
+ buffer.put(NULL);
+ }
+ else
+ {
+ buffer.put(NOT_NULL);
+ putSimpleString(string);
+ }
+ }
+
+ public void putSimpleString(final SimpleString string)
+ {
+ byte[] data = string.getData();
+
+ buffer.putInt(data.length);
+ buffer.put(data);
+ }
+
+ public SimpleString getSimpleString()
+ {
+ int len = buffer.getInt();
+
+ byte[] data = new byte[len];
+ buffer.get(data);
+
+ return new SimpleString(data);
+ }
+
+ public SimpleString getNullableSimpleString()
+ {
+ int b = buffer.get();
+ if (b == NULL)
+ {
+ return null;
+ }
+ else
+ {
+ return getSimpleString();
+ }
+ }
+
+ public String getUTF() throws Exception
+ {
+ return buffer.getPrefixedString(utf8.newDecoder());
+ }
+
+ public Object getUnderlyingBuffer()
+ {
+ return buffer;
+ }
+
+ public long getUnsignedInt()
+ {
+ return buffer.getUnsignedInt();
+ }
+
+ public void skip(int size)
+ {
+ buffer.skip(size);
+ }
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
\ No newline at end of file
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MessagingIOSessionDataStructureFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MessagingIOSessionDataStructureFactory.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MessagingIOSessionDataStructureFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import java.util.HashSet;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.core.session.IoSessionAttributeMap;
+import org.apache.mina.core.session.IoSessionDataStructureFactory;
+import org.apache.mina.core.write.WriteRequest;
+import org.apache.mina.core.write.WriteRequestQueue;
+
+/**
+ *
+ * A MessagingIOSessionDataStructureFactory
+ *
+ * Derived from:
+ * @author The Apache MINA Project (dev at mina.apache.org)
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class MessagingIOSessionDataStructureFactory implements IoSessionDataStructureFactory
+{
+
+ public IoSessionAttributeMap getAttributeMap(IoSession session)
+ throws Exception
+ {
+ return new ConcurrentIoSessionAttributeMap();
+ }
+
+ public WriteRequestQueue getWriteRequestQueue(IoSession session)
+ throws Exception
+ {
+ return new ConcurrentWriteRequestQueue();
+ }
+
+
+ private static class ConcurrentIoSessionAttributeMap implements IoSessionAttributeMap {
+
+ private final ConcurrentMap<Object, Object> attributes = new ConcurrentHashMap<Object, Object>(4);
+
+ public Object getAttribute(IoSession session, Object key, Object defaultValue) {
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ Object answer = attributes.get(key);
+ if (answer == null) {
+ return defaultValue;
+ } else {
+ return answer;
+ }
+ }
+
+ public Object setAttribute(IoSession session, Object key, Object value) {
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ if (value == null) {
+ return attributes.remove(key);
+ } else {
+ return attributes.put(key, value);
+ }
+ }
+
+ public Object setAttributeIfAbsent(IoSession session, Object key, Object value) {
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ if (value == null) {
+ return null;
+ }
+
+ return attributes.putIfAbsent(key, value);
+ }
+
+ public Object removeAttribute(IoSession session, Object key) {
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ return attributes.remove(key);
+ }
+
+ public boolean removeAttribute(IoSession session, Object key, Object value) {
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ if (value == null) {
+ return false;
+ }
+
+ return attributes.remove(key, value);
+ }
+
+ public boolean replaceAttribute(IoSession session, Object key, Object oldValue, Object newValue) {
+ return attributes.replace(key, oldValue, newValue);
+ }
+
+ public boolean containsAttribute(IoSession session, Object key) {
+ return attributes.containsKey(key);
+ }
+
+ public Set<Object> getAttributeKeys(IoSession session) {
+ return new HashSet<Object>(attributes.keySet());
+ }
+
+ public void dispose(IoSession session) throws Exception {
+ }
+ }
+
+ private static class ConcurrentWriteRequestQueue implements WriteRequestQueue
+ {
+ private final Queue<WriteRequest> q = new ConcurrentLinkedQueue<WriteRequest>();
+
+ public void dispose(IoSession session) {
+ }
+
+ public void clear(IoSession session) {
+ q.clear();
+ }
+
+ public synchronized boolean isEmpty(IoSession session) {
+ return q.isEmpty();
+ }
+
+ public synchronized void offer(IoSession session, WriteRequest writeRequest) {
+ q.offer(writeRequest);
+ }
+
+ public synchronized WriteRequest poll(IoSession session) {
+ return q.poll();
+ }
+
+ @Override
+ public String toString() {
+ return q.toString();
+ }
+ }
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaConnection.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaConnection.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaConnection.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.future.IoFutureListener;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.ssl.SslFilter;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.Connection;
+import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class MinaConnection implements Connection
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(MinaConnection.class);
+
+ // Attributes ----------------------------------------------------
+
+ private final IoSession session;
+
+ private boolean closed;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public MinaConnection(final IoSession session)
+ {
+ this.session = session;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Connection implementation ----------------------------
+
+ public synchronized void close()
+ {
+ if (closed)
+ {
+ return;
+ }
+
+ SslFilter sslFilter = (SslFilter) session.getFilterChain().get("ssl");
+
+ if (session.getService() instanceof IoConnector) {
+ if (sslFilter != null)
+ {
+ try
+ {
+ sslFilter.stopSsl(session).awaitUninterruptibly();
+ }
+ catch (Throwable t)
+ {
+ // ignore
+ }
+ }
+ session.close().awaitUninterruptibly();
+ } else {
+ if (sslFilter != null)
+ {
+ try
+ {
+ sslFilter.stopSsl(session).addListener(IoFutureListener.CLOSE);
+ }
+ catch (Throwable t)
+ {
+ // ignore
+ }
+ } else {
+ session.close();
+ }
+ }
+
+ closed = true;
+ }
+
+ public MessagingBuffer createBuffer(int size)
+ {
+ IoBuffer buffer = IoBuffer.allocate(size);
+ buffer.setAutoExpand(true);
+ return new IoBufferWrapper(buffer);
+ }
+
+ public Object getID()
+ {
+ return Long.valueOf(session.getId());
+ }
+
+ public void write(final MessagingBuffer buffer)
+ {
+ session.write(buffer.getUnderlyingBuffer());
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaProtocolCodecFilter.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaProtocolCodecFilter.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/MinaProtocolCodecFilter.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+import static org.jboss.messaging.util.DataConstants.SIZE_INT;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.remoting.spi.BufferHandler;
+
+/**
+ * A Mina ProtocolEncoder used to encode/decode messages.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class MinaProtocolCodecFilter extends CumulativeProtocolDecoder
+ implements ProtocolEncoder, ProtocolCodecFactory
+{
+ private static final Logger log = Logger.getLogger(MinaProtocolCodecFilter.class);
+
+ private final BufferHandler handler;
+
+ public MinaProtocolCodecFilter(final BufferHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ // ProtocolCodecFactory implementation
+ // -----------------------------------------------------------------------------------
+
+ public ProtocolDecoder getDecoder(final IoSession session)
+ {
+ return this;
+ }
+
+ public ProtocolEncoder getEncoder(final IoSession session)
+ {
+ return this;
+ }
+
+ // ProtocolEncoder implementation ------------------------------------------
+
+ @Override
+ public void dispose(final IoSession session) throws Exception
+ {
+ }
+
+ public void encode(final IoSession session, final Object message,
+ final ProtocolEncoderOutput out) throws Exception
+ {
+ out.write(message);
+ }
+
+ // CumulativeProtocolDecoder overrides
+ // -------------------------------------------------------------------------------------
+
+ @Override
+ public boolean doDecode(final IoSession session, final IoBuffer in, final ProtocolDecoderOutput out) throws Exception
+ {
+ //TODO - we can avoid this entirely if we maintain fragmented packets in the handler
+
+ int start = in.position();
+
+ int length = handler.isReadyToHandle(new IoBufferWrapper(in));
+
+ if (length == -1)
+ {
+ in.position(start);
+
+ return false;
+ }
+
+ IoBuffer sliced = in.slice();
+
+ in.position(start + length + SIZE_INT);
+
+ out.write(sliced);
+
+ return true;
+ }
+}
+
+
+
+
Added: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/TransportConstants.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/TransportConstants.java (rev 0)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/amqp/TransportConstants.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.messaging.core.remoting.impl.amqp;
+
+/**
+ * A TransportConstants
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class TransportConstants
+{
+ public static final String SSL_ENABLED_PROP_NAME = "jbm.remoting.mina.sslenabled";
+
+ public static final String HOST_PROP_NAME = "jbm.remoting.mina.host";
+
+ public static final String PORT_PROP_NAME = "jbm.remoting.mina.port";
+
+ public static final String KEYSTORE_PATH_PROP_NAME = "jbm.remoting.mina.keystorepath";
+
+ public static final String KEYSTORE_PASSWORD_PROP_NAME = "jbm.remoting.mina.keystorepassword";
+
+ public static final String TRUSTSTORE_PATH_PROP_NAME = "jbm.remoting.mina.truststorepath";
+
+ public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "jbm.remoting.mina.truststorepassword";
+
+ public static final String TCP_NODELAY_PROPNAME = "jbm.remoting.mina.tcpnodelay";
+
+ public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "jbm.remoting.mina.tcpsendbuffersize";
+
+ public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "jbm.remoting.mina.tcpreceivebuffersize";
+
+ public static final boolean DEFAULT_SSL_ENABLED = false;
+
+ public static final String DEFAULT_HOST = "localhost";
+
+ public static final int DEFAULT_PORT = 5400;
+
+ public static final String DEFAULT_KEYSTORE_PATH = "messaging.keystore";
+
+ public static final String DEFAULT_KEYSTORE_PASSWORD = "secureexample";
+
+ public static final String DEFAULT_TRUSTSTORE_PATH = "messaging.truststore";
+
+ public static final String DEFAULT_TRUSTSTORE_PASSWORD = "secureexample";
+
+ public static final boolean DEFAULT_TCP_NODELAY = true;
+
+ public static final int DEFAULT_TCP_SENDBUFFER_SIZE = 32768;
+
+ public static final int DEFAULT_TCP_RECEIVEBUFFER_SIZE = 32768;
+}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -30,6 +30,7 @@
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.util.ConfigurationHelper;
/**
@@ -93,6 +94,10 @@
started = true;
}
+ public void setMessagingServer(MessagingServer server)
+ {
+ }
+
public BufferHandler getHandler()
{
if (!started)
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/IoBufferWrapper.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -181,6 +181,11 @@
return buffer.get();
}
+ public byte getByte(int position)
+ {
+ return buffer.get(position);
+ }
+
public short getUnsignedByte()
{
return buffer.getUnsigned();
@@ -359,6 +364,17 @@
return buffer;
}
+ public long getUnsignedInt()
+ {
+ throw new IllegalStateException("Not implemented");
+ }
+
+ public void skip(int i)
+ {
+ throw new IllegalStateException("Not implemented");
+ }
+
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/mina/MinaAcceptor.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -61,6 +61,7 @@
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.util.ConfigurationHelper;
@@ -206,6 +207,10 @@
acceptor = null;
}
+ public void setMessagingServer(MessagingServer server)
+ {
+ }
+
public DefaultIoFilterChainBuilder getFilterChain()
{
return acceptor.getFilterChain();
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/ChannelBufferWrapper.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/ChannelBufferWrapper.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/ChannelBufferWrapper.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -199,6 +199,11 @@
throw new BufferUnderflowException();
}
}
+
+ public byte getByte(int position)
+ {
+ throw new IllegalStateException("unimplemented");
+ }
public short getUnsignedByte()
{
@@ -425,7 +430,18 @@
{
return buffer;
}
+
+ public long getUnsignedInt()
+ {
+ return buffer.readUnsignedInt();
+ }
+
+ public void skip(int i)
+ {
+ throw new IllegalStateException("Not implemented");
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyAcceptor.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyAcceptor.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/impl/netty/NettyAcceptor.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -60,6 +60,7 @@
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.Connection;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.util.ConfigurationHelper;
import org.jboss.messaging.util.JBMThreadFactory;
import org.jboss.netty.bootstrap.ServerBootstrap;
@@ -268,6 +269,10 @@
channelFactory = null;
}
+ public void setMessagingServer(MessagingServer server)
+ {
+ }
+
// Inner classes -----------------------------------------------------------------------------
@ChannelPipelineCoverage("one")
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -22,6 +22,8 @@
package org.jboss.messaging.core.remoting.spi;
+import org.jboss.messaging.core.server.MessagingServer;
+
/**
* An Acceptor is used tby the Remoting Service to allow clients to connect. It should take care of dispatchin client requests
* to the Remoting Service's Dispatcher.
@@ -34,4 +36,6 @@
void start() throws Exception;
void stop();
+
+ void setMessagingServer(MessagingServer server);
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/AcceptorFactory.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/AcceptorFactory.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/AcceptorFactory.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -24,6 +24,7 @@
import java.util.Map;
+
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/BufferHandler.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/BufferHandler.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/BufferHandler.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -21,6 +21,8 @@
*/
package org.jboss.messaging.core.remoting.spi;
+import org.jboss.messaging.amq.framing.AMQDataBlock;
+
/**
* A BufferHandler
*
@@ -30,6 +32,9 @@
public interface BufferHandler
{
void bufferReceived(Object connectionID, MessagingBuffer buffer);
-
+
+ void dataBlockReceived(Object connectionID, AMQDataBlock dataBlock);
+
int isReadyToHandle(MessagingBuffer buffer);
+
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/remoting/spi/MessagingBuffer.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -1,35 +1,34 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * JBoss, Home of Professional Open Source Copyright 2005-2008, Red Hat
+ * Middleware LLC, and individual contributors by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of individual
+ * contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
*/
package org.jboss.messaging.core.remoting.spi;
import org.jboss.messaging.util.SimpleString;
-/**
- *
+/*
+ *
* A MessagingBuffer
- *
+ *
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
*/
public interface MessagingBuffer
{
@@ -122,4 +121,12 @@
MessagingBuffer createNewBuffer(int len);
Object getUnderlyingBuffer();
+
+ // TODO AMQP integration
+
+ long getUnsignedInt();
+
+ void skip(int i);
+
+ byte getByte(int position);
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/security/impl/JBMSecurityManagerImpl.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -71,6 +71,10 @@
public boolean validateUser(final String user, final String password)
{
+ if (log.isDebugEnabled())
+ {
+ log.debug("validating user" + user);
+ }
User theUser = users.get(user == null ? "guest" : user);
return theUser != null && theUser.isValid(user == null ? "guest" : user, password == null ? "guest" : password);
}
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/MessagingServerPacketHandler.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -13,17 +13,39 @@
package org.jboss.messaging.core.server.impl;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.CREATESESSION;
-import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_FAILOVER_COMPLETE;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.REATTACH_SESSION;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.jboss.messaging.amq.framing.AMQBody;
+import org.jboss.messaging.amq.framing.AMQFrame;
+import org.jboss.messaging.amq.framing.AMQFrameDecodingException;
+import org.jboss.messaging.amq.framing.AMQMethodBody;
+import org.jboss.messaging.amq.framing.ChannelOpenBody;
+import org.jboss.messaging.amq.framing.ChannelOpenOkBody;
+import org.jboss.messaging.amq.framing.ConnectionOpenBody;
+import org.jboss.messaging.amq.framing.ConnectionStartOkBody;
+import org.jboss.messaging.amq.framing.ConnectionTuneBody;
+import org.jboss.messaging.amq.framing.ConnectionTuneOkBody;
+import org.jboss.messaging.amq.framing.FieldTable;
+import org.jboss.messaging.amq.framing.FieldTableFactory;
+import org.jboss.messaging.amq.framing.MethodRegistry;
+import org.jboss.messaging.amq.framing.ProtocolVersion;
+import org.jboss.messaging.amq.framing.amqp_0_9.MethodRegistry_0_9;
+import org.jboss.messaging.amq.server.protocol.HeartbeatConfig;
+import org.jboss.messaging.amq.server.security.auth.AuthenticationResult;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.Channel;
import org.jboss.messaging.core.remoting.ChannelHandler;
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.remoting.RemotingConnection;
+import org.jboss.messaging.core.remoting.impl.amqp.IoBufferWrapper;
import org.jboss.messaging.core.remoting.impl.wireformat.CreateSessionMessage;
-import org.jboss.messaging.core.remoting.impl.wireformat.SessionFailoverCompleteMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.MessagingExceptionMessage;
import org.jboss.messaging.core.remoting.impl.wireformat.ReattachSessionMessage;
import org.jboss.messaging.core.server.MessagingServer;
@@ -45,6 +67,10 @@
private final RemotingConnection connection;
+ private MethodRegistry_0_9 methodRegistry = new MethodRegistry_0_9();
+
+ private static final int DEFAULT_FRAME_SIZE = 65536;
+
public MessagingServerPacketHandler(final MessagingServer server,
final Channel channel1,
final RemotingConnection connection)
@@ -70,7 +96,7 @@
private void doHandle(final Packet packet)
{
Packet response = null;
-
+
byte type = packet.getType();
// All these operations need to be idempotent since they are outside of the session
@@ -82,7 +108,7 @@
case CREATESESSION:
{
CreateSessionMessage request = (CreateSessionMessage)packet;
-
+
response = server.createSession(request.getName(),
request.getSessionChannelID(),
request.getUsername(),
@@ -97,9 +123,9 @@
case REATTACH_SESSION:
{
ReattachSessionMessage request = (ReattachSessionMessage)packet;
-
+
response = server.reattachSession(connection, request.getName(), request.getLastReceivedCommandID());
-
+
break;
}
default:
@@ -134,4 +160,113 @@
channel1.replicateComplete();
}
+
+ public void handleFrame(AMQFrame frame)
+ {
+ log.info("handling AMQ frame:" + frame);
+ AMQBody b = frame.getBodyFrame();
+ if (b instanceof ConnectionStartOkBody)
+ {
+ ConnectionStartOkBody body = (ConnectionStartOkBody)b;
+ byte[] response = body.getResponse();
+ FieldTable ft = null;
+ try
+ {
+ ft = FieldTableFactory.newFieldTable(new IoBufferWrapper(IoBuffer.wrap(response)), response.length);
+ }
+ catch (AMQFrameDecodingException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ String username = (String)ft.getString("LOGIN");
+ String pwd = (String)ft.getString("PASSWORD");
+
+ AuthenticationResult authResult = null;
+ if (server.getSecurityManager().validateUser(username, pwd))
+ {
+ authResult = new AuthenticationResult(new byte[0], AuthenticationResult.AuthenticationStatus.SUCCESS);
+ }
+ else
+ {
+ authResult = new AuthenticationResult(new byte[0], AuthenticationResult.AuthenticationStatus.ERROR);
+ }
+ switch (authResult.status)
+ {
+ case ERROR:
+ log.info("Authentication failed");
+ break;
+
+ case SUCCESS:
+ log.info("Authentication succeeded");
+ // _logger.info("Connected as: " + ss.getAuthorizationID());
+ // session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID()));
+
+ ConnectionTuneBody tuneBody = methodRegistry.createConnectionTuneBody(0xFFFF,
+ DEFAULT_FRAME_SIZE,
+ HeartbeatConfig.getInstance()
+ .getDelay());
+ channel1.send(tuneBody.generateFrame(frame.getChannel()));
+ break;
+ case CONTINUE:
+ log.info("Authentication continued");
+
+ // ConnectionSecureBody secureBody = methodRegistry.createConnectionSecureBody(authResult.challenge);
+ // session.writeFrame(secureBody.generateFrame(0));
+ }
+
+ }
+ else if (b instanceof ConnectionTuneOkBody)
+ {
+ ConnectionTuneOkBody body = (ConnectionTuneOkBody)b;
+
+ }
+ else if (b instanceof ConnectionOpenBody)
+ {
+ ConnectionOpenBody body = (ConnectionOpenBody)b;
+ AMQMethodBody responseBody = methodRegistry.createConnectionOpenOkBody(body.getVirtualHost());
+
+ channel1.send(responseBody.generateFrame(frame.getChannel()));
+ }
+ else if (b instanceof ChannelOpenBody)
+ {
+ ChannelOpenBody body = (ChannelOpenBody)b;
+ MethodRegistry_0_9 methodRegistry = (MethodRegistry_0_9) MethodRegistry.getMethodRegistry(ProtocolVersion.v0_9);
+ UUID uuid = UUID.randomUUID();
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(output);
+ try
+ {
+ dataOut.writeLong(uuid.getMostSignificantBits());
+ dataOut.writeLong(uuid.getLeastSignificantBits());
+ dataOut.flush();
+ dataOut.close();
+ }
+ catch (IOException e)
+ {
+ // This *really* shouldn't happen as we're not doing any I/O
+ throw new RuntimeException("I/O exception when writing to byte array", e);
+ }
+
+ // should really associate this channelId to the session
+ byte[] channelName = output.toByteArray();
+ ChannelOpenOkBody responseBody = methodRegistry.createChannelOpenOkBody(channelName);
+
+ try
+ {
+ server.createSession(uuid.toString(), frame.getChannel(), null, null, server.getVersion().getIncrementingVersion(), connection, true, true, false);
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ channel1.send(responseBody.generateFrame(frame.getChannel()));
+
+ }
+ else
+ {
+ throw new IllegalStateException("unsupported AMQ body: " + b.getClass());
+ }
+ }
}
\ No newline at end of file
Modified: branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/ServerSessionPacketHandler.java
===================================================================
--- branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/ServerSessionPacketHandler.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/src/main/org/jboss/messaging/core/server/impl/ServerSessionPacketHandler.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -12,6 +12,7 @@
package org.jboss.messaging.core.server.impl;
+import static org.jboss.messaging.amq.exchange.ExchangeDefaults.DEFAULT_EXCHANGE_NAME;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_ADD_DESTINATION;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_BINDINGQUERY;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_BROWSER_CLOSE;
@@ -33,6 +34,7 @@
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_PRODUCER_CLOSE;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_QUEUEQUERY;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_REMOVE_DESTINATION;
+import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_REPLICATE_DELIVERY;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_ROLLBACK;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_SCHEDULED_SEND;
import static org.jboss.messaging.core.remoting.impl.wireformat.PacketImpl.SESS_SEND;
@@ -55,8 +57,20 @@
import javax.transaction.xa.Xid;
+import org.jboss.messaging.amq.AMQMessage;
+import org.jboss.messaging.amq.exchange.ExchangeDefaults;
+import org.jboss.messaging.amq.framing.AMQBody;
+import org.jboss.messaging.amq.framing.AMQFrame;
+import org.jboss.messaging.amq.framing.BasicPublishBody;
+import org.jboss.messaging.amq.framing.ChannelCloseBody;
+import org.jboss.messaging.amq.framing.ChannelCloseOkBody;
+import org.jboss.messaging.amq.framing.ContentBody;
+import org.jboss.messaging.amq.framing.ContentHeaderBody;
+import org.jboss.messaging.amq.framing.amqp_0_9.MethodRegistry_0_9;
+import org.jboss.messaging.amq.impl.AMQMessageImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.remoting.Channel;
import org.jboss.messaging.core.remoting.ChannelHandler;
@@ -101,6 +115,7 @@
import org.jboss.messaging.core.remoting.impl.wireformat.SessionXAStartMessage;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.core.server.ServerSession;
+import org.jboss.messaging.util.SimpleString;
/**
* A ServerSessionPacketHandler
@@ -119,6 +134,10 @@
private final StorageManager storageManager;
+ private MethodRegistry_0_9 methodRegistry = new MethodRegistry_0_9();
+
+ private AMQMessage currentMessage = null;
+
public ServerSessionPacketHandler(final ServerSession session,
final Channel channel,
final StorageManager storageManager)
@@ -432,7 +451,7 @@
session.handleManagementMessage(message);
break;
}
- case PacketImpl.SESS_REPLICATE_DELIVERY:
+ case SESS_REPLICATE_DELIVERY:
{
SessionReplicateDeliveryMessage message = (SessionReplicateDeliveryMessage)packet;
session.handleReplicatedDelivery(message.getConsumerID(), message.getMessageID());
@@ -470,4 +489,67 @@
channel.replicateComplete();
}
+
+ public void handleFrame(AMQFrame frame)
+ {
+ log.info("handling frame:" + frame);
+ AMQBody b = frame.getBodyFrame();
+ if (b instanceof BasicPublishBody)
+ {
+ BasicPublishBody body = (BasicPublishBody)b;
+ log.info("received basic.publish method " + body);
+ SimpleString exchange = (body.getExchange() == null) ? new SimpleString(DEFAULT_EXCHANGE_NAME.toString()) : new SimpleString(body.getExchange().toString());
+ SimpleString routingKey = (body.getRoutingKey() == null) ? null : new SimpleString(body.getRoutingKey().toString());
+ currentMessage = new AMQMessageImpl(exchange, routingKey, body.getImmediate(), body.getMandatory());
+ }
+ else if (b instanceof ContentHeaderBody)
+ {
+ ContentHeaderBody body = (ContentHeaderBody)b;
+ log.info("received header: " + body.properties);
+ if (currentMessage == null)
+ {
+ throw new IllegalStateException("Content header received before a basic.publish method");
+ }
+ currentMessage.setHeader(body.properties);
+ currentMessage.setBodySize(body.bodySize);
+ }
+ else if (b instanceof ContentBody)
+ {
+ if (currentMessage == null)
+ {
+ throw new IllegalStateException("Content body received before a basic.publish method");
+ }
+ ContentBody body = (ContentBody)b;
+ log.info("received body: " + body.payload);
+ boolean finalFrame = currentMessage.addPayload(body.payload, body.getSize());
+ if (finalFrame)
+ {
+ log.info("received final frame");
+ //TODO convert to a JBM Message and route it
+ ServerMessage coreMessage = currentMessage.toCoreMessage();
+ try
+ {
+ session.send(coreMessage);
+ log.info("routed message");
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } else
+ {
+ log.info("wating for more frame");
+ }
+ }
+ else if (b instanceof ChannelCloseBody)
+ {
+ ChannelCloseOkBody responseBody = methodRegistry.createChannelCloseOkBody();
+ channel.send(responseBody.generateFrame(frame.getChannel()));
+ }
+ else
+ {
+ throw new IllegalStateException("Unsupported body:" + frame.getBodyFrame().getClass());
+ }
+ }
}
Modified: branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java
===================================================================
--- branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -27,6 +27,7 @@
import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
/**
*
@@ -55,6 +56,11 @@
{
}
+ public void setMessagingServer(MessagingServer server)
+ {
+ }
+
+
}
}
Modified: branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java
===================================================================
--- branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -27,6 +27,7 @@
import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
/**
*
@@ -55,6 +56,11 @@
{
}
+ public void setMessagingServer(MessagingServer server)
+ {
+ }
+
+
}
}
Modified: branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java
===================================================================
--- branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java 2008-10-14 14:54:04 UTC (rev 5109)
+++ branches/amqp_integration/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java 2008-10-14 15:01:09 UTC (rev 5110)
@@ -27,6 +27,7 @@
import org.jboss.messaging.core.remoting.spi.AcceptorFactory;
import org.jboss.messaging.core.remoting.spi.BufferHandler;
import org.jboss.messaging.core.remoting.spi.ConnectionLifeCycleListener;
+import org.jboss.messaging.core.server.MessagingServer;
/**
*
@@ -55,6 +56,11 @@
{
}
+ public void setMessagingServer(MessagingServer server)
+ {
+ }
+
+
}
}
More information about the jboss-cvs-commits
mailing list