You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/12 22:52:08 UTC
svn commit: r1397719 - in /activemq/activemq-cpp/trunk/activemq-cpp/src:
main/activemq/wireformat/ main/activemq/wireformat/openwire/
main/activemq/wireformat/stomp/ test/activemq/transport/
Author: tabish
Date: Fri Oct 12 20:52:07 2012
New Revision: 1397719
URL: http://svn.apache.org/viewvc?rev=1397719&view=rev
Log:
work for: https://issues.apache.org/jira/browse/AMQCPP-435
Do some refactoring and add in most of the bits needed for this.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormat.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatNegotiator.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormat.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormat.h?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormat.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormat.h Fri Oct 12 20:52:07 2012
@@ -60,9 +60,9 @@ namespace wireformat{
*
* @throws IOException if an I/O error occurs.
*/
- virtual void marshal( const Pointer<commands::Command>& command,
- const activemq::transport::Transport* transport,
- decaf::io::DataOutputStream* out ) = 0;
+ virtual void marshal(const Pointer<commands::Command> command,
+ const activemq::transport::Transport* transport,
+ decaf::io::DataOutputStream* out) = 0;
/**
* Stream based unmarshaling, blocks on reads on the input stream until a complete
@@ -78,8 +78,8 @@ namespace wireformat{
*
* @throws IOException if an I/O error occurs.
*/
- virtual Pointer<commands::Command> unmarshal( const activemq::transport::Transport* transport,
- decaf::io::DataInputStream* in ) = 0;
+ virtual Pointer<commands::Command> unmarshal(const activemq::transport::Transport* transport,
+ decaf::io::DataInputStream* in) = 0;
/**
* Set the Version
@@ -87,7 +87,7 @@ namespace wireformat{
* @param version
* the version of the wire format
*/
- virtual void setVersion( int version ) = 0;
+ virtual void setVersion(int version) = 0;
/**
* Get the Version
@@ -126,7 +126,7 @@ namespace wireformat{
* @throws UnsupportedOperationException if the WireFormat doesn't have a Negotiator.
*/
virtual Pointer<transport::Transport> createNegotiator(
- const Pointer<transport::Transport>& transport ) = 0;
+ const Pointer<transport::Transport> transport) = 0;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatNegotiator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatNegotiator.h?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatNegotiator.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatNegotiator.h Fri Oct 12 20:52:07 2012
@@ -39,8 +39,8 @@ namespace wireformat {
* @param next
* The next Transport in the chain
*/
- WireFormatNegotiator( const Pointer<transport::Transport>& next ) :
- transport::TransportFilter( next ) {}
+ WireFormatNegotiator(const Pointer<transport::Transport> next ) :
+ transport::TransportFilter(next) {}
virtual ~WireFormatNegotiator() {}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.cpp Fri Oct 12 20:52:07 2012
@@ -77,7 +77,7 @@ OpenWireFormat::~OpenWireFormat() {
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Transport> OpenWireFormat::createNegotiator(const Pointer<Transport>& transport) {
+Pointer<Transport> OpenWireFormat::createNegotiator(const Pointer<Transport> transport) {
try {
return Pointer<Transport>(new OpenWireFormatNegotiator(this, transport));
@@ -127,12 +127,12 @@ void OpenWireFormat::addMarshaller(DataS
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormat::setPreferedWireFormatInfo(const Pointer<commands::WireFormatInfo>& info) {
+void OpenWireFormat::setPreferedWireFormatInfo(const Pointer<commands::WireFormatInfo> info) {
this->preferedWireFormatInfo = info;
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormat::marshal(const Pointer<commands::Command>& command, const activemq::transport::Transport* transport, decaf::io::DataOutputStream* dataOut) {
+void OpenWireFormat::marshal(const Pointer<commands::Command> command, const activemq::transport::Transport* transport, decaf::io::DataOutputStream* dataOut) {
if (transport == NULL) {
throw decaf::io::IOException(__FILE__, __LINE__, "Transport passed is NULL");
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h Fri Oct 12 20:52:07 2012
@@ -100,7 +100,7 @@ namespace marshal {
/**
* {@inheritDoc}
*/
- virtual Pointer<transport::Transport> createNegotiator(const Pointer<transport::Transport>& transport);
+ virtual Pointer<transport::Transport> createNegotiator(const Pointer<transport::Transport> transport);
/**
* Allows an external source to add marshalers to this object for
@@ -112,7 +112,7 @@ namespace marshal {
/**
* {@inheritDoc}
*/
- virtual void marshal(const Pointer<commands::Command>& command, const activemq::transport::Transport* transport, decaf::io::DataOutputStream* out);
+ virtual void marshal(const Pointer<commands::Command> command, const activemq::transport::Transport* transport, decaf::io::DataOutputStream* out);
/**
* {@inheritDoc}
@@ -192,7 +192,7 @@ namespace marshal {
*
* @throws IllegalStateException if the WireFormat object has not been initialized.
*/
- void setPreferedWireFormatInfo(const Pointer<commands::WireFormatInfo>& info);
+ void setPreferedWireFormatInfo(const Pointer<commands::WireFormatInfo> info);
/**
* Gets the Preferred WireFormatInfo object that this class holds
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp Fri Oct 12 20:52:07 2012
@@ -38,7 +38,7 @@ using namespace decaf::lang::exceptions;
const int OpenWireFormatNegotiator::negotiationTimeout = 15000;
////////////////////////////////////////////////////////////////////////////////
-OpenWireFormatNegotiator::OpenWireFormatNegotiator(OpenWireFormat* wireFormat, const Pointer<Transport>& next ) :
+OpenWireFormatNegotiator::OpenWireFormatNegotiator(OpenWireFormat* wireFormat, const Pointer<Transport> next ) :
WireFormatNegotiator( next ),
firstTime(true),
wireInfoSentDownLatch(1),
@@ -56,7 +56,7 @@ OpenWireFormatNegotiator::~OpenWireForma
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormatNegotiator::oneway(const Pointer<Command>& command) throw (IOException, UnsupportedOperationException) {
+void OpenWireFormatNegotiator::oneway(const Pointer<Command> command) {
try {
@@ -79,7 +79,7 @@ void OpenWireFormatNegotiator::oneway(co
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Response> OpenWireFormatNegotiator::request(const Pointer<Command>& command) throw (IOException, UnsupportedOperationException) {
+Pointer<Response> OpenWireFormatNegotiator::request(const Pointer<Command> command) {
try {
@@ -102,7 +102,7 @@ Pointer<Response> OpenWireFormatNegotiat
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Response> OpenWireFormatNegotiator::request(const Pointer<Command>& command, unsigned int timeout) throw (IOException, UnsupportedOperationException) {
+Pointer<Response> OpenWireFormatNegotiator::request(const Pointer<Command> command, unsigned int timeout) {
try {
@@ -125,7 +125,7 @@ Pointer<Response> OpenWireFormatNegotiat
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormatNegotiator::onCommand(const Pointer<Command>& command) {
+void OpenWireFormatNegotiator::onCommand(const Pointer<Command> command) {
if (command->isWireFormatInfo()) {
@@ -152,17 +152,14 @@ void OpenWireFormatNegotiator::onCommand
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormatNegotiator::onTransportException(Transport* source AMQCPP_UNUSED, const decaf::lang::Exception& ex) {
+void OpenWireFormatNegotiator::onException(const decaf::lang::Exception& ex) {
readyCountDownLatch.countDown();
fire(ex);
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormatNegotiator::start() throw (IOException) {
+void OpenWireFormatNegotiator::start() {
- /**
- * We're already started.
- */
if (!closed) {
return;
}
@@ -205,7 +202,7 @@ void OpenWireFormatNegotiator::start() t
}
////////////////////////////////////////////////////////////////////////////////
-void OpenWireFormatNegotiator::close() throw (IOException) {
+void OpenWireFormatNegotiator::close() {
try {
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatNegotiator.h Fri Oct 12 20:52:07 2012
@@ -75,7 +75,7 @@ namespace openwire{
* @param wireFormat - The WireFormat object we use to negotiate
* @param next - The next transport in the chain
*/
- OpenWireFormatNegotiator(OpenWireFormat* wireFormat, const Pointer<transport::Transport>& next);
+ OpenWireFormatNegotiator(OpenWireFormat* wireFormat, const Pointer<transport::Transport> next);
virtual ~OpenWireFormatNegotiator();
@@ -90,7 +90,7 @@ namespace openwire{
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
- virtual void oneway(const Pointer<commands::Command>& command) throw (decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException);
+ virtual void oneway(const Pointer<commands::Command> command);
/**
* Sends the given request to the server and waits for the response.
@@ -100,8 +100,7 @@ namespace openwire{
* @return the response from the server.
* @throws IOException if an error occurs with the request.
*/
- virtual Pointer<commands::Response> request(const Pointer<commands::Command>& command) throw (decaf::io::IOException,
- decaf::lang::exceptions::UnsupportedOperationException);
+ virtual Pointer<commands::Response> request(const Pointer<commands::Command> command);
/**
* Sends the given request to the server and waits for the response.
@@ -112,8 +111,7 @@ namespace openwire{
* @return the response from the server.
* @throws IOException if an error occurs with the request.
*/
- virtual Pointer<commands::Response> request(const Pointer<commands::Command>& command, unsigned int timeout) throw (decaf::io::IOException,
- decaf::lang::exceptions::UnsupportedOperationException);
+ virtual Pointer<commands::Response> request(const Pointer<commands::Command> command, unsigned int timeout);
/**
* This is called in the context of the nested transport's
@@ -123,14 +121,14 @@ namespace openwire{
* the command listener.
* @param command the received from the nested transport.
*/
- virtual void onCommand(const Pointer<commands::Command>& command);
+ virtual void onCommand(const Pointer<commands::Command> command);
/**
* Event handler for an exception from a command transport.
* @param source The source of the exception
* @param ex The exception.
*/
- virtual void onTransportException(transport::Transport* source, const decaf::lang::Exception& ex);
+ virtual void onException(const decaf::lang::Exception& ex);
/**
* Starts this transport object and creates the thread for
@@ -141,7 +139,7 @@ namespace openwire{
* @throws IOException if an error occurs or if this transport
* has already been closed.
*/
- virtual void start() throw (decaf::io::IOException);
+ virtual void start();
/**
* Stops the polling thread and closes the streams. This can
@@ -149,7 +147,7 @@ namespace openwire{
* this object has been closed, it cannot be restarted.
* @throws IOException if errors occur.
*/
- virtual void close() throw (decaf::io::IOException);
+ virtual void close();
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.cpp Fri Oct 12 20:52:07 2012
@@ -96,50 +96,48 @@ StompWireFormat::~StompWireFormat() {
}
////////////////////////////////////////////////////////////////////////////////
-void StompWireFormat::marshal( const Pointer<Command>& command,
- const activemq::transport::Transport* transport,
- decaf::io::DataOutputStream* out ) {
-
- try{
-
- if( out == NULL ) {
- throw decaf::io::IOException(
- __FILE__, __LINE__,
- "StompCommandWriter::writeCommand - "
- "output stream is NULL" );
+void StompWireFormat::marshal(const Pointer<Command> command,
+ const activemq::transport::Transport* transport,
+ decaf::io::DataOutputStream* out) {
+
+ try {
+
+ if (out == NULL) {
+ throw decaf::io::IOException(__FILE__, __LINE__, "StompCommandWriter::writeCommand - "
+ "output stream is NULL");
}
Pointer<StompFrame> frame;
- if( command->isMessage() ) {
- frame = this->marshalMessage( command );
- } else if( command->isRemoveInfo() ) {
- frame = this->marshalRemoveInfo( command );
- } else if( command->isShutdownInfo() ) {
- frame = this->marshalShutdownInfo( command );
- } else if( command->isMessageAck() ) {
- frame = this->marshalAck( command );
- } else if( command->isConnectionInfo() ) {
- frame = this->marshalConnectionInfo( command );
- } else if( command->isTransactionInfo() ) {
- frame = this->marshalTransactionInfo( command );
- } else if( command->isConsumerInfo() ) {
- frame = this->marshalConsumerInfo( command );
- } else if( command->isRemoveSubscriptionInfo() ) {
- frame = this->marshalRemoveSubscriptionInfo( command );
+ if (command->isMessage()) {
+ frame = this->marshalMessage(command);
+ } else if (command->isRemoveInfo()) {
+ frame = this->marshalRemoveInfo(command);
+ } else if (command->isShutdownInfo()) {
+ frame = this->marshalShutdownInfo(command);
+ } else if (command->isMessageAck()) {
+ frame = this->marshalAck(command);
+ } else if (command->isConnectionInfo()) {
+ frame = this->marshalConnectionInfo(command);
+ } else if (command->isTransactionInfo()) {
+ frame = this->marshalTransactionInfo(command);
+ } else if (command->isConsumerInfo()) {
+ frame = this->marshalConsumerInfo(command);
+ } else if (command->isRemoveSubscriptionInfo()) {
+ frame = this->marshalRemoveSubscriptionInfo(command);
}
// Some commands just don't translate to Stomp Commands, unless they require
// a response we can just ignore them.
- if( frame == NULL ) {
+ if (frame == NULL) {
- if( command->isResponseRequired() ) {
- Pointer<Response> response( new Response() );
- response->setCorrelationId( command->getCommandId() );
+ if (command->isResponseRequired()) {
+ Pointer<Response> response(new Response());
+ response->setCorrelationId(command->getCommandId());
transport::TransportListener* listener = transport->getTransportListener();
- if( listener != NULL ) {
- listener->onCommand( response );
+ if (listener != NULL) {
+ listener->onCommand(response);
}
}
@@ -147,36 +145,33 @@ void StompWireFormat::marshal( const Poi
}
// Let the Frame write itself to the output stream
- frame->toStream( out );
+ frame->toStream(out);
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW( decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW( decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Command> StompWireFormat::unmarshal( const activemq::transport::Transport* transport,
- decaf::io::DataInputStream* in ) {
+Pointer<Command> StompWireFormat::unmarshal(const activemq::transport::Transport* transport, decaf::io::DataInputStream* in) {
- if( transport == NULL ) {
- throw decaf::io::IOException(
- __FILE__, __LINE__, "Transport passed is NULL" );
+ if (transport == NULL) {
+ throw decaf::io::IOException(__FILE__, __LINE__, "Transport passed is NULL");
}
- if( in == NULL ) {
- throw decaf::io::IOException(
- __FILE__, __LINE__, "DataInputStream passed is NULL" );
+ if (in == NULL) {
+ throw decaf::io::IOException(__FILE__, __LINE__, "DataInputStream passed is NULL");
}
Pointer<StompFrame> frame;
- try{
+ try {
// Create a new Frame for reading to.
- frame.reset( new StompFrame() );
+ frame.reset(new StompFrame());
// Read the command header.
- frame->fromStream( in );
+ frame->fromStream(in);
// Return the Command.
const std::string commandId = frame->getCommand();
@@ -184,8 +179,8 @@ Pointer<Command> StompWireFormat::unmars
class Finally {
private:
- Finally( const Finally& );
- Finally& operator= ( const Finally& );
+ Finally(const Finally&);
+ Finally& operator=(const Finally&);
private:
@@ -193,74 +188,70 @@ Pointer<Command> StompWireFormat::unmars
public:
- Finally( decaf::util::concurrent::atomic::AtomicBoolean* state ) : state( state ) {
- state->set( true );
+ Finally(decaf::util::concurrent::atomic::AtomicBoolean* state) :
+ state(state) {
+ state->set(true);
}
~Finally() {
- state->set( false );
+ state->set(false);
}
- } finalizer( &( this->receiving ) );
+ } finalizer(&(this->receiving));
- if( commandId == StompCommandConstants::CONNECTED ){
- return this->unmarshalConnected( frame );
- } else if( commandId == StompCommandConstants::ERROR_CMD ){
- return this->unmarshalError( frame );
- } else if( commandId == StompCommandConstants::RECEIPT ){
- return this->unmarshalReceipt( frame );
- } else if( commandId == StompCommandConstants::MESSAGE ){
- return this->unmarshalMessage( frame );
+ if (commandId == StompCommandConstants::CONNECTED) {
+ return this->unmarshalConnected(frame);
+ } else if (commandId == StompCommandConstants::ERROR_CMD) {
+ return this->unmarshalError(frame);
+ } else if (commandId == StompCommandConstants::RECEIPT) {
+ return this->unmarshalReceipt(frame);
+ } else if (commandId == StompCommandConstants::MESSAGE) {
+ return this->unmarshalMessage(frame);
}
// We didn't seem to know what it was we got, so throw an exception.
- throw decaf::io::IOException(
- __FILE__, __LINE__,
- "StompWireFormat::marshal - No Command Created from frame" );
+ throw decaf::io::IOException(__FILE__, __LINE__, "StompWireFormat::marshal - No Command Created from frame");
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW( decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW( decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<transport::Transport> StompWireFormat::createNegotiator(
- const Pointer<transport::Transport>& transport AMQCPP_UNUSED ) {
+Pointer<transport::Transport> StompWireFormat::createNegotiator(const Pointer<transport::Transport> transport AMQCPP_UNUSED) {
- throw UnsupportedOperationException( __FILE__, __LINE__,
- "No Negotiator is required to use this WireFormat." );
+ throw UnsupportedOperationException(__FILE__, __LINE__, "No Negotiator is required to use this WireFormat.");
// Apparently HP's aCC compiler is even dumber than Sun's
return Pointer<transport::Transport>();
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Command> StompWireFormat::unmarshalMessage( const Pointer<StompFrame>& frame ) {
+Pointer<Command> StompWireFormat::unmarshalMessage(const Pointer<StompFrame> frame) {
- Pointer<MessageDispatch> messageDispatch( new MessageDispatch() );
+ Pointer<MessageDispatch> messageDispatch(new MessageDispatch());
// We created a unique id when we registered the subscription for the consumer
// now extract it back to a consumer Id so the ActiveMQConnection can dispatch it
// correctly.
- Pointer<ConsumerId> consumerId = helper.convertConsumerId(
- frame->removeProperty( StompCommandConstants::HEADER_SUBSCRIPTION ) );
- messageDispatch->setConsumerId( consumerId );
-
- if( frame->hasProperty( StompCommandConstants::HEADER_CONTENTLENGTH ) ) {
-
- Pointer<ActiveMQBytesMessage> message( new ActiveMQBytesMessage() );
- frame->removeProperty( StompCommandConstants::HEADER_CONTENTLENGTH );
- helper.convertProperties( frame, message );
- message->setContent( frame->getBody() );
- messageDispatch->setMessage( message );
- messageDispatch->setDestination( message->getDestination() );
+ Pointer<ConsumerId> consumerId = helper.convertConsumerId(frame->removeProperty(StompCommandConstants::HEADER_SUBSCRIPTION));
+ messageDispatch->setConsumerId(consumerId);
+
+ if (frame->hasProperty(StompCommandConstants::HEADER_CONTENTLENGTH)) {
+
+ Pointer<ActiveMQBytesMessage> message(new ActiveMQBytesMessage());
+ frame->removeProperty(StompCommandConstants::HEADER_CONTENTLENGTH);
+ helper.convertProperties(frame, message);
+ message->setContent(frame->getBody());
+ messageDispatch->setMessage(message);
+ messageDispatch->setDestination(message->getDestination());
} else {
- Pointer<ActiveMQTextMessage> message( new ActiveMQTextMessage() );
- helper.convertProperties( frame, message );
- message->setText( (char*)&(frame->getBody()[0]) );
- messageDispatch->setMessage( message );
- messageDispatch->setDestination( message->getDestination() );
+ Pointer<ActiveMQTextMessage> message(new ActiveMQTextMessage());
+ helper.convertProperties(frame, message);
+ message->setText((char*) &(frame->getBody()[0]));
+ messageDispatch->setMessage(message);
+ messageDispatch->setDestination(message->getDestination());
}
@@ -268,64 +259,61 @@ Pointer<Command> StompWireFormat::unmars
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Command> StompWireFormat::unmarshalReceipt( const Pointer<StompFrame>& frame ){
+Pointer<Command> StompWireFormat::unmarshalReceipt(const Pointer<StompFrame> frame) {
- Pointer<Response> response( new Response() );
- if( frame->hasProperty( StompCommandConstants::HEADER_RECEIPTID ) ) {
+ Pointer<Response> response(new Response());
+ if (frame->hasProperty(StompCommandConstants::HEADER_RECEIPTID)) {
- std::string responseId = frame->getProperty( StompCommandConstants::HEADER_RECEIPTID );
- if( responseId.find( "ignore:" ) == 0 ) {
- responseId = responseId.substr( 7 );
+ std::string responseId = frame->getProperty(StompCommandConstants::HEADER_RECEIPTID);
+ if (responseId.find("ignore:") == 0) {
+ responseId = responseId.substr(7);
}
- response->setCorrelationId( Integer::parseInt( responseId ) );
+ response->setCorrelationId(Integer::parseInt(responseId));
} else {
- throw IOException(
- __FILE__, __LINE__, "Error, Connected Command has no Response ID." );
+ throw IOException(__FILE__, __LINE__, "Error, Connected Command has no Response ID.");
}
return response;
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Command> StompWireFormat::unmarshalConnected( const Pointer<StompFrame>& frame AMQCPP_UNUSED ) {
+Pointer<Command> StompWireFormat::unmarshalConnected(const Pointer<StompFrame> frame AMQCPP_UNUSED) {
- Pointer<Response> response( new Response() );
+ Pointer<Response> response(new Response());
- if( this->properties->connectResponseId != -1 ) {
+ if (this->properties->connectResponseId != -1) {
response->setCorrelationId(this->properties->connectResponseId);
} else {
- throw IOException(
- __FILE__, __LINE__, "Error, Connected Command has no Response ID." );
+ throw IOException(__FILE__, __LINE__, "Error, Connected Command has no Response ID.");
}
return response;
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<Command> StompWireFormat::unmarshalError( const Pointer<StompFrame>& frame ) {
+Pointer<Command> StompWireFormat::unmarshalError(const Pointer<StompFrame> frame) {
- Pointer<BrokerError> error( new BrokerError() );
- error->setMessage(
- frame->removeProperty( StompCommandConstants::HEADER_MESSAGE ) );
+ Pointer<BrokerError> error(new BrokerError());
+ error->setMessage(frame->removeProperty(StompCommandConstants::HEADER_MESSAGE));
- if( frame->hasProperty( StompCommandConstants::HEADER_RECEIPTID ) ) {
+ if (frame->hasProperty(StompCommandConstants::HEADER_RECEIPTID)) {
- std::string responseId = frame->removeProperty( StompCommandConstants::HEADER_RECEIPTID );
+ std::string responseId = frame->removeProperty(StompCommandConstants::HEADER_RECEIPTID);
// If we indicated that we don't care if the request failed then just create a
// response command to answer the request.
- if( responseId.find( "ignore:" ) == 0 ) {
+ if (responseId.find("ignore:") == 0) {
- Pointer<Response> response( new Response() );
- response->setCorrelationId( Integer::parseInt( responseId.substr( 7 ) ) );
+ Pointer<Response> response(new Response());
+ response->setCorrelationId(Integer::parseInt(responseId.substr(7)));
return response;
} else {
- Pointer<ExceptionResponse> errorResponse( new ExceptionResponse() );
- errorResponse->setException( error );
- errorResponse->setCorrelationId( Integer::parseInt( responseId ) );
+ Pointer<ExceptionResponse> errorResponse(new ExceptionResponse());
+ errorResponse->setException(error);
+ errorResponse->setCorrelationId(Integer::parseInt(responseId));
return errorResponse;
}
@@ -335,77 +323,71 @@ Pointer<Command> StompWireFormat::unmars
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalMessage( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalMessage(const Pointer<Command> command) {
Pointer<Message> message = command.dynamicCast<Message>();
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::SEND );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::SEND);
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, Integer::toString(command->getCommandId()));
}
// Convert the standard headers to the Stomp Format.
- helper.convertProperties( message, frame );
+ helper.convertProperties(message, frame);
// Convert the Content
- try{
+ try {
Pointer<ActiveMQTextMessage> txtMessage = message.dynamicCast<ActiveMQTextMessage>();
std::string text = txtMessage->getText();
- frame->setBody( (unsigned char*)text.c_str(), text.length() + 1 );
+ frame->setBody((unsigned char*) text.c_str(), text.length() + 1);
return frame;
- } catch( ClassCastException& ex ) {}
+ } catch (ClassCastException& ex) {
+ }
- try{
+ try {
Pointer<ActiveMQBytesMessage> bytesMessage = message.dynamicCast<ActiveMQBytesMessage>();
- frame->setBody( bytesMessage->getBodyBytes(), bytesMessage->getBodyLength() );
- frame->setProperty( StompCommandConstants::HEADER_CONTENTLENGTH,
- Long::toString( bytesMessage->getBodyLength() ) );
+ frame->setBody(bytesMessage->getBodyBytes(), bytesMessage->getBodyLength());
+ frame->setProperty(StompCommandConstants::HEADER_CONTENTLENGTH, Long::toString(bytesMessage->getBodyLength()));
return frame;
- } catch( ClassCastException& ex ) {}
+ } catch (ClassCastException& ex) {
+ }
- throw UnsupportedOperationException(
- __FILE__, __LINE__,
- "Stomp StompWireFormat can't marshal message of type: %s",
- typeid( message.get() ).name() );
+ throw UnsupportedOperationException(__FILE__, __LINE__, "Stomp StompWireFormat can't marshal message of type: %s", typeid( message.get() ).name());
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalAck( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalAck(const Pointer<Command> command) {
Pointer<MessageAck> ack = command.dynamicCast<MessageAck>();
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::ACK );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::ACK);
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- std::string( "ignore:" ) + Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, std::string("ignore:") + Integer::toString(command->getCommandId()));
}
- frame->setProperty( StompCommandConstants::HEADER_MESSAGEID,
- helper.convertMessageId( ack->getLastMessageId() ) );
+ frame->setProperty(StompCommandConstants::HEADER_MESSAGEID, helper.convertMessageId(ack->getLastMessageId()));
- if( ack->getTransactionId() != NULL ) {
- frame->setProperty( StompCommandConstants::HEADER_TRANSACTIONID,
- helper.convertTransactionId( ack->getTransactionId() ) );
+ if (ack->getTransactionId() != NULL) {
+ frame->setProperty(StompCommandConstants::HEADER_TRANSACTIONID, helper.convertTransactionId(ack->getTransactionId()));
}
return frame;
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalConnectionInfo( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalConnectionInfo(const Pointer<Command> command) {
Pointer<ConnectionInfo> info = command.dynamicCast<ConnectionInfo>();
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::CONNECT );
- frame->setProperty( StompCommandConstants::HEADER_CLIENT_ID, info->getClientId() );
- frame->setProperty( StompCommandConstants::HEADER_LOGIN, info->getUserName() );
- frame->setProperty( StompCommandConstants::HEADER_PASSWORD, info->getPassword() );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::CONNECT);
+ frame->setProperty(StompCommandConstants::HEADER_CLIENT_ID, info->getClientId());
+ frame->setProperty(StompCommandConstants::HEADER_LOGIN, info->getUserName());
+ frame->setProperty(StompCommandConstants::HEADER_PASSWORD, info->getPassword());
this->properties->connectResponseId = info->getCommandId();
@@ -416,159 +398,140 @@ Pointer<StompFrame> StompWireFormat::mar
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalTransactionInfo( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalTransactionInfo(const Pointer<Command> command) {
Pointer<TransactionInfo> info = command.dynamicCast<TransactionInfo>();
Pointer<LocalTransactionId> id = info->getTransactionId().dynamicCast<LocalTransactionId>();
- Pointer<StompFrame> frame( new StompFrame() );
+ Pointer<StompFrame> frame(new StompFrame());
- if( info->getType() == ActiveMQConstants::TRANSACTION_STATE_BEGIN ) {
- frame->setCommand( StompCommandConstants::BEGIN );
- } else if( info->getType() == ActiveMQConstants::TRANSACTION_STATE_ROLLBACK ) {
- frame->setCommand( StompCommandConstants::ABORT );
- } else if( info->getType() == ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE ) {
- frame->setCommand( StompCommandConstants::COMMIT );
+ if (info->getType() == ActiveMQConstants::TRANSACTION_STATE_BEGIN) {
+ frame->setCommand(StompCommandConstants::BEGIN);
+ } else if (info->getType() == ActiveMQConstants::TRANSACTION_STATE_ROLLBACK) {
+ frame->setCommand(StompCommandConstants::ABORT);
+ } else if (info->getType() == ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE) {
+ frame->setCommand(StompCommandConstants::COMMIT);
}
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, Integer::toString(command->getCommandId()));
}
- frame->setProperty( StompCommandConstants::HEADER_TRANSACTIONID,
- helper.convertTransactionId( info->getTransactionId() ) );
+ frame->setProperty(StompCommandConstants::HEADER_TRANSACTIONID, helper.convertTransactionId(info->getTransactionId()));
return frame;
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalShutdownInfo( const Pointer<Command>& command AMQCPP_UNUSED ) {
+Pointer<StompFrame> StompWireFormat::marshalShutdownInfo(const Pointer<Command> command) {
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::DISCONNECT );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::DISCONNECT);
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, Integer::toString(command->getCommandId()));
}
return frame;
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalRemoveInfo( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalRemoveInfo(const Pointer<Command> command) {
Pointer<RemoveInfo> info = command.dynamicCast<RemoveInfo>();
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::UNSUBSCRIBE );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::UNSUBSCRIBE);
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, Integer::toString(command->getCommandId()));
}
- try{
+ try {
Pointer<ConsumerId> id = info->getObjectId().dynamicCast<ConsumerId>();
- frame->setProperty( StompCommandConstants::HEADER_ID, helper.convertConsumerId( id ) );
+ frame->setProperty(StompCommandConstants::HEADER_ID, helper.convertConsumerId(id));
return frame;
- } catch( ClassCastException& ex ) {}
+ } catch (ClassCastException& ex) {
+ }
return Pointer<StompFrame>();
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalConsumerInfo( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalConsumerInfo(const Pointer<Command> command) {
Pointer<ConsumerInfo> info = command.dynamicCast<ConsumerInfo>();
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::SUBSCRIBE );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::SUBSCRIBE);
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, Integer::toString(command->getCommandId()));
}
- frame->setProperty( StompCommandConstants::HEADER_DESTINATION,
- helper.convertDestination( info->getDestination() ) );
+ frame->setProperty(StompCommandConstants::HEADER_DESTINATION, helper.convertDestination(info->getDestination()));
// This creates a unique Id for this consumer using the connection id, session id and
// the consumers's id value, when we get a message this Id will be embedded in the
// Message's "subscription" property.
- frame->setProperty( StompCommandConstants::HEADER_ID,
- helper.convertConsumerId( info->getConsumerId() ) );
+ frame->setProperty(StompCommandConstants::HEADER_ID, helper.convertConsumerId(info->getConsumerId()));
- if( info->getSubscriptionName() != "" ) {
+ if (info->getSubscriptionName() != "") {
- if( this->clientId != info->getSubscriptionName() ) {
- throw UnsupportedOperationException(
- __FILE__, __LINE__,
- "Stomp Durable Subscriptions require that the ClientId and the Subscription "
- "Name match, clientId = {%s} : subscription name = {%s}.",
- this->clientId.c_str(), info->getSubscriptionName().c_str() );
+ if (this->clientId != info->getSubscriptionName()) {
+ throw UnsupportedOperationException(__FILE__, __LINE__, "Stomp Durable Subscriptions require that the ClientId and the Subscription "
+ "Name match, clientId = {%s} : subscription name = {%s}.", this->clientId.c_str(), info->getSubscriptionName().c_str());
}
- frame->setProperty( StompCommandConstants::HEADER_SUBSCRIPTIONNAME,
- info->getSubscriptionName() );
+ frame->setProperty(StompCommandConstants::HEADER_SUBSCRIPTIONNAME, info->getSubscriptionName());
// Older Brokers had an misspelled property name, this ensure we can talk to them as well.
- frame->setProperty( StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME,
- info->getSubscriptionName() );
+ frame->setProperty(StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME, info->getSubscriptionName());
}
- if( info->getSelector() != "" ) {
- frame->setProperty( StompCommandConstants::HEADER_SELECTOR,
- info->getSelector() );
+ if (info->getSelector() != "") {
+ frame->setProperty(StompCommandConstants::HEADER_SELECTOR, info->getSelector());
}
// TODO - This should eventually check the session to see what its mode really is.
// This will work for now but in order to add individual ack we need to check.
- frame->setProperty( StompCommandConstants::HEADER_ACK, "client" );
+ frame->setProperty(StompCommandConstants::HEADER_ACK, "client");
- if( info->isNoLocal() ) {
- frame->setProperty( StompCommandConstants::HEADER_NOLOCAL, "true" );
+ if (info->isNoLocal()) {
+ frame->setProperty(StompCommandConstants::HEADER_NOLOCAL, "true");
}
- frame->setProperty( StompCommandConstants::HEADER_DISPATCH_ASYNC,
- Boolean::toString( info->isDispatchAsync() ) );
+ frame->setProperty(StompCommandConstants::HEADER_DISPATCH_ASYNC, Boolean::toString(info->isDispatchAsync()));
- if( info->isExclusive() ) {
- frame->setProperty( StompCommandConstants::HEADER_EXCLUSIVE, "true" );
+ if (info->isExclusive()) {
+ frame->setProperty(StompCommandConstants::HEADER_EXCLUSIVE, "true");
}
- frame->setProperty( StompCommandConstants::HEADER_MAXPENDINGMSGLIMIT,
- Integer::toString( info->getMaximumPendingMessageLimit() ) );
- frame->setProperty( StompCommandConstants::HEADER_PREFETCHSIZE,
- Integer::toString( info->getPrefetchSize() ) );
- frame->setProperty( StompCommandConstants::HEADER_CONSUMERPRIORITY,
- Integer::toString( info->getPriority() ) );
+ frame->setProperty(StompCommandConstants::HEADER_MAXPENDINGMSGLIMIT, Integer::toString(info->getMaximumPendingMessageLimit()));
+ frame->setProperty(StompCommandConstants::HEADER_PREFETCHSIZE, Integer::toString(info->getPrefetchSize()));
+ frame->setProperty(StompCommandConstants::HEADER_CONSUMERPRIORITY, Integer::toString(info->getPriority()));
- if( info->isRetroactive() ) {
- frame->setProperty( StompCommandConstants::HEADER_RETROACTIVE, "true" );
+ if (info->isRetroactive()) {
+ frame->setProperty(StompCommandConstants::HEADER_RETROACTIVE, "true");
}
return frame;
}
////////////////////////////////////////////////////////////////////////////////
-Pointer<StompFrame> StompWireFormat::marshalRemoveSubscriptionInfo( const Pointer<Command>& command ) {
+Pointer<StompFrame> StompWireFormat::marshalRemoveSubscriptionInfo(const Pointer<Command> command) {
Pointer<RemoveSubscriptionInfo> info = command.dynamicCast<RemoveSubscriptionInfo>();
- Pointer<StompFrame> frame( new StompFrame() );
- frame->setCommand( StompCommandConstants::UNSUBSCRIBE );
+ Pointer<StompFrame> frame(new StompFrame());
+ frame->setCommand(StompCommandConstants::UNSUBSCRIBE);
- if( command->isResponseRequired() ) {
- frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
- std::string( "ignore:" ) + Integer::toString( command->getCommandId() ) );
+ if (command->isResponseRequired()) {
+ frame->setProperty(StompCommandConstants::HEADER_RECEIPT_REQUIRED, std::string("ignore:") + Integer::toString(command->getCommandId()));
}
- frame->setProperty( StompCommandConstants::HEADER_ID, info->getClientId() );
- frame->setProperty( StompCommandConstants::HEADER_SUBSCRIPTIONNAME,
- info->getClientId() );
+ frame->setProperty(StompCommandConstants::HEADER_ID, info->getClientId());
+ frame->setProperty(StompCommandConstants::HEADER_SUBSCRIPTIONNAME, info->getClientId());
// Older Brokers had an misspelled property name, this ensure we can talk to them as well.
- frame->setProperty( StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME,
- info->getClientId() );
+ frame->setProperty(StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME, info->getClientId());
return frame;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.h?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompWireFormat.h Fri Oct 12 20:52:07 2012
@@ -75,9 +75,9 @@ namespace stomp {
*
* @throws IOException
*/
- virtual void marshal( const Pointer<commands::Command>& command,
- const activemq::transport::Transport* transport,
- decaf::io::DataOutputStream* out );
+ virtual void marshal(const Pointer<commands::Command> command,
+ const activemq::transport::Transport* transport,
+ decaf::io::DataOutputStream* out);
/**
* Stream based un-marshaling, blocks on reads on the input stream until a complete
@@ -89,8 +89,8 @@ namespace stomp {
* @returns the newly marshaled Command, caller owns the pointer
* @throws IOException
*/
- virtual Pointer<commands::Command> unmarshal( const activemq::transport::Transport* transport,
- decaf::io::DataInputStream* in );
+ virtual Pointer<commands::Command> unmarshal(const activemq::transport::Transport* transport,
+ decaf::io::DataInputStream* in);
/**
* Set the Version
@@ -131,23 +131,23 @@ namespace stomp {
* @throws UnsupportedOperationException if the WireFormat doesn't have a Negotiator.
*/
virtual Pointer<transport::Transport> createNegotiator(
- const Pointer<transport::Transport>& transport );
+ const Pointer<transport::Transport> transport);
private:
- Pointer<Command> unmarshalMessage( const Pointer<StompFrame>& frame );
- Pointer<Command> unmarshalReceipt( const Pointer<StompFrame>& frame );
- Pointer<Command> unmarshalConnected( const Pointer<StompFrame>& frame );
- Pointer<Command> unmarshalError( const Pointer<StompFrame>& frame );
-
- Pointer<StompFrame> marshalMessage( const Pointer<Command>& command );
- Pointer<StompFrame> marshalAck( const Pointer<Command>& command );
- Pointer<StompFrame> marshalConnectionInfo( const Pointer<Command>& command );
- Pointer<StompFrame> marshalTransactionInfo( const Pointer<Command>& command );
- Pointer<StompFrame> marshalShutdownInfo( const Pointer<Command>& command );
- Pointer<StompFrame> marshalRemoveInfo( const Pointer<Command>& command );
- Pointer<StompFrame> marshalConsumerInfo( const Pointer<Command>& command );
- Pointer<StompFrame> marshalRemoveSubscriptionInfo( const Pointer<Command>& command );
+ Pointer<Command> unmarshalMessage(const Pointer<StompFrame> frame);
+ Pointer<Command> unmarshalReceipt(const Pointer<StompFrame> frame);
+ Pointer<Command> unmarshalConnected(const Pointer<StompFrame> frame);
+ Pointer<Command> unmarshalError(const Pointer<StompFrame> frame);
+
+ Pointer<StompFrame> marshalMessage(const Pointer<Command> command);
+ Pointer<StompFrame> marshalAck(const Pointer<Command> command);
+ Pointer<StompFrame> marshalConnectionInfo(const Pointer<Command> command);
+ Pointer<StompFrame> marshalTransactionInfo(const Pointer<Command> command);
+ Pointer<StompFrame> marshalShutdownInfo(const Pointer<Command> command);
+ Pointer<StompFrame> marshalRemoveInfo(const Pointer<Command> command);
+ Pointer<StompFrame> marshalConsumerInfo(const Pointer<Command> command);
+ Pointer<StompFrame> marshalRemoveSubscriptionInfo(const Pointer<Command> command);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.cpp?rev=1397719&r1=1397718&r2=1397719&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/IOTransportTest.cpp Fri Oct 12 20:52:07 2012
@@ -40,7 +40,7 @@ using namespace decaf::io;
using namespace decaf::lang::exceptions;
////////////////////////////////////////////////////////////////////////////////
-class MyCommand : public commands::BaseCommand{
+class MyCommand : public commands::BaseCommand {
public:
MyCommand(){ c = 0; }
virtual ~MyCommand(){}
@@ -79,7 +79,7 @@ public:
virtual bool hasNegotiator() const { return false; }
virtual Pointer<Transport> createNegotiator(
- const Pointer<transport::Transport>& transport ) {
+ const Pointer<transport::Transport> transport ) {
return Pointer<wireformat::WireFormatNegotiator>();
}
@@ -136,7 +136,7 @@ public:
}
}
- virtual void marshal( const Pointer<commands::Command>& command,
+ virtual void marshal( const Pointer<commands::Command> command,
const activemq::transport::Transport* transport AMQCPP_UNUSED,
decaf::io::DataOutputStream* outputStream )
throw (IOException)