Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89BA6D8C2 for ; Thu, 4 Oct 2012 14:31:43 +0000 (UTC) Received: (qmail 62045 invoked by uid 500); 4 Oct 2012 14:31:43 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 61965 invoked by uid 500); 4 Oct 2012 14:31:43 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 61957 invoked by uid 99); 4 Oct 2012 14:31:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2012 14:31:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2012 14:31:40 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 31CBC2388A29 for ; Thu, 4 Oct 2012 14:30:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1394091 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire: ./ marshal/ Date: Thu, 04 Oct 2012 14:30:56 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121004143057.31CBC2388A29@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Thu Oct 4 14:30:56 2012 New Revision: 1394091 URL: http://svn.apache.org/viewvc?rev=1394091&view=rev Log: Polish up some of the code a bit. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormat.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.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/openwire/OpenWireResponseBuilder.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h 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=1394091&r1=1394090&r2=1394091&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 Thu Oct 4 14:30:56 2012 @@ -30,9 +30,9 @@ #include #include -namespace activemq{ -namespace wireformat{ -namespace openwire{ +namespace activemq { +namespace wireformat { +namespace openwire { namespace marshal { class DataStreamMarshaller; @@ -86,7 +86,7 @@ namespace marshal { * Constructs a new OpenWireFormat object * @param properties - can contain optional config params. */ - OpenWireFormat( const decaf::util::Properties& properties ); + OpenWireFormat(const decaf::util::Properties& properties); virtual ~OpenWireFormat(); @@ -100,28 +100,24 @@ namespace marshal { /** * {@inheritDoc} */ - virtual Pointer createNegotiator( - const Pointer& transport ); + virtual Pointer createNegotiator(const Pointer& transport); /** * Allows an external source to add marshalers to this object for - * types that may be marshaled or unmarhsaled. + * types that may be marshaled or unmarshaled. * @param marshaler - the Marshaler to add to the collection. */ - void addMarshaller( marshal::DataStreamMarshaller* marshaler ); + void addMarshaller(marshal::DataStreamMarshaller* marshaler); /** * {@inheritDoc} */ - virtual void marshal( const Pointer& command, - const activemq::transport::Transport* transport, - decaf::io::DataOutputStream* out ); + virtual void marshal(const Pointer& command, const activemq::transport::Transport* transport, decaf::io::DataOutputStream* out); /** * {@inheritDoc} */ - virtual Pointer unmarshal( const activemq::transport::Transport* transport, - decaf::io::DataInputStream* in ); + virtual Pointer unmarshal(const activemq::transport::Transport* transport, decaf::io::DataInputStream* in); public: @@ -132,8 +128,7 @@ namespace marshal { * @param bs - the BooleanStream to write to * @returns size of the data returned. */ - virtual int tightMarshalNestedObject1( commands::DataStructure* object, - utils::BooleanStream* bs ); + virtual int tightMarshalNestedObject1(commands::DataStructure* object, utils::BooleanStream* bs); /** * Utility method that will Tight marshal some internally nested object @@ -144,9 +139,7 @@ namespace marshal { * @param bs - BooleanStream * @throws IOException if an error occurs. */ - void tightMarshalNestedObject2( commands::DataStructure* o, - decaf::io::DataOutputStream* ds, - utils::BooleanStream* bs ); + void tightMarshalNestedObject2(commands::DataStructure* o, decaf::io::DataOutputStream* ds, utils::BooleanStream* bs); /** * Utility method used to Unmarshal a Nested DataStructure type object @@ -157,8 +150,7 @@ namespace marshal { * @returns Newly allocated DataStructure Object * @throws IOException if an error occurs. */ - commands::DataStructure* tightUnmarshalNestedObject( decaf::io::DataInputStream* dis, - utils::BooleanStream* bs ); + commands::DataStructure* tightUnmarshalNestedObject(decaf::io::DataInputStream* dis, utils::BooleanStream* bs); /** * Utility method to unmarshal an DataStructure object from an @@ -169,7 +161,7 @@ namespace marshal { * @returns a new DataStructure derived Object pointer * @throws IOException if an error occurs. */ - commands::DataStructure* looseUnmarshalNestedObject( decaf::io::DataInputStream* dis ); + commands::DataStructure* looseUnmarshalNestedObject(decaf::io::DataInputStream* dis); /** * Utility method to loosely Marshal an object that is derived from the @@ -179,8 +171,7 @@ namespace marshal { * @param dataOut - DataOutputStream to write the data to * @throw IOException if an error occurs. */ - void looseMarshalNestedObject( commands::DataStructure* o, - decaf::io::DataOutputStream* dataOut ); + void looseMarshalNestedObject(commands::DataStructure* o, decaf::io::DataOutputStream* dataOut); /** * Called to re-negotiate the settings for the WireFormatInfo, these @@ -191,7 +182,7 @@ namespace marshal { * * @throws IllegalStateException is wire format can't be negotiated. */ - void renegotiateWireFormat( const commands::WireFormatInfo& info ); + void renegotiateWireFormat(const commands::WireFormatInfo& info); /** * Configures this object using the provided WireformatInfo object @@ -201,7 +192,7 @@ namespace marshal { * * @throws IllegalStateException if the WireFormat object has not been initialized. */ - void setPreferedWireFormatInfo( const Pointer& info ); + void setPreferedWireFormatInfo(const Pointer& info); /** * Gets the Preferred WireFormatInfo object that this class holds @@ -223,7 +214,7 @@ namespace marshal { * Sets if the stackTraceEnabled flag is on * @param stackTraceEnabled - true to turn flag is on */ - void setStackTraceEnabled( bool stackTraceEnabled ) { + void setStackTraceEnabled(bool stackTraceEnabled) { this->stackTraceEnabled = stackTraceEnabled; } @@ -239,7 +230,7 @@ namespace marshal { * Sets if the tcpNoDelayEnabled flag is on * @param tcpNoDelayEnabled - true to turn flag is on */ - void setTcpNoDelayEnabled( bool tcpNoDelayEnabled ) { + void setTcpNoDelayEnabled(bool tcpNoDelayEnabled) { this->tcpNoDelayEnabled = tcpNoDelayEnabled; } @@ -259,7 +250,7 @@ namespace marshal { * * @throws IllegalArgumentException if the version given is not supported. */ - void setVersion( int version ); + void setVersion(int version); /** * Is there a Message being unmarshaled? @@ -282,7 +273,7 @@ namespace marshal { * Sets if the cacheEnabled flag is on * @param cacheEnabled - true to turn flag is on */ - void setCacheEnabled( bool cacheEnabled ) { + void setCacheEnabled(bool cacheEnabled) { this->cacheEnabled = cacheEnabled; } @@ -298,7 +289,7 @@ namespace marshal { * Sets the current Cache size. * @param value - the value to send as the broker's cache size. */ - void setCacheSize( int value ) { + void setCacheSize(int value) { this->cacheSize = value; } @@ -314,7 +305,7 @@ namespace marshal { * Sets if the tightEncodingEnabled flag is on * @param tightEncodingEnabled - true to turn flag is on */ - void setTightEncodingEnabled( bool tightEncodingEnabled ) { + void setTightEncodingEnabled(bool tightEncodingEnabled) { this->tightEncodingEnabled = tightEncodingEnabled; } @@ -330,7 +321,7 @@ namespace marshal { * Sets if the sizePrefixDisabled flag is on * @param sizePrefixDisabled - true to turn flag is on */ - void setSizePrefixDisabled( bool sizePrefixDisabled ) { + void setSizePrefixDisabled(bool sizePrefixDisabled) { this->sizePrefixDisabled = sizePrefixDisabled; } @@ -346,7 +337,7 @@ namespace marshal { * Sets the MaxInactivityDuration setting. * @param value - the Max inactivity duration value in milliseconds. */ - void setMaxInactivityDuration( long long value ) { + void setMaxInactivityDuration(long long value) { this->maxInactivityDuration = value; } @@ -362,7 +353,7 @@ namespace marshal { * Sets the MaxInactivityDurationInitialDelay setting. * @param value - the Max inactivity Initial Delay duration value in milliseconds. */ - void setMaxInactivityDurationInitialDelay( long long value ) { + void setMaxInactivityDurationInitialDelay(long long value) { this->maxInactivityDurationInitialDelay = value; } @@ -381,7 +372,7 @@ namespace marshal { * * @throws IOException if an error occurs during the unmarshal. */ - commands::DataStructure* doUnmarshal( decaf::io::DataInputStream* dis ); + commands::DataStructure* doUnmarshal(decaf::io::DataInputStream* dis); /** * Cleans up all registered Marshallers and empties the dataMarshallers Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp?rev=1394091&r1=1394090&r2=1394091&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.cpp Thu Oct 4 14:30:56 2012 @@ -35,51 +35,41 @@ using namespace decaf::lang; using namespace decaf::lang::exceptions; //////////////////////////////////////////////////////////////////////////////// -Pointer OpenWireFormatFactory::createWireFormat( - const decaf::util::Properties& properties ) { +Pointer OpenWireFormatFactory::createWireFormat(const decaf::util::Properties& properties) { - try{ + try { - Pointer info( new WireFormatInfo() ); + Pointer info(new WireFormatInfo()); // Configure the version to use - info->setVersion( Integer::parseInt( - properties.getProperty( "wireFormat.version", "6" ) ) ); + info->setVersion(Integer::parseInt(properties.getProperty("wireFormat.version", "6"))); // parse params out of the properties - info->setStackTraceEnabled( Boolean::parseBoolean( - properties.getProperty( "wireFormat.stackTraceEnabled", - "true" ) ) ); - info->setCacheEnabled( Boolean::parseBoolean( - properties.getProperty( "wireFormat.cacheEnabled", - "false" ) ) ); - info->setCacheSize( Integer::parseInt( - properties.getProperty( "wireFormat.cacheSize", - "1024" ) ) ); - info->setTcpNoDelayEnabled( Boolean::parseBoolean( - properties.getProperty( "wireFormat.tcpNoDelayEnabled", - "true" ) ) ); - info->setTightEncodingEnabled( Boolean::parseBoolean( - properties.getProperty( "wireFormat.tightEncodingEnabled", - "true" ) ) ); - info->setSizePrefixDisabled( Boolean::parseBoolean( - properties.getProperty( "wireFormat.sizePrefixDisabled", - "false" ) ) ); - info->setMaxInactivityDuration( Long::parseLong( - properties.getProperty( "wireFormat.MaxInactivityDuration", - "30000" ) ) ); - info->setMaxInactivityDurationInitalDelay( Long::parseLong( - properties.getProperty( "wireFormat.MaxInactivityDurationInitalDelay", - "10000" ) ) ); + info->setStackTraceEnabled( + Boolean::parseBoolean(properties.getProperty("wireFormat.stackTraceEnabled", "true"))); + info->setCacheEnabled( + Boolean::parseBoolean(properties.getProperty("wireFormat.cacheEnabled", "false"))); + info->setCacheSize( + Integer::parseInt(properties.getProperty("wireFormat.cacheSize", "1024"))); + info->setTcpNoDelayEnabled( + Boolean::parseBoolean(properties.getProperty("wireFormat.tcpNoDelayEnabled", "true"))); + info->setTightEncodingEnabled( + Boolean::parseBoolean(properties.getProperty("wireFormat.tightEncodingEnabled", "true"))); + info->setSizePrefixDisabled( + Boolean::parseBoolean(properties.getProperty("wireFormat.sizePrefixDisabled", "false"))); + info->setMaxInactivityDuration( + Long::parseLong(properties.getProperty("wireFormat.MaxInactivityDuration", "30000"))); + info->setMaxInactivityDurationInitalDelay( + Long::parseLong(properties.getProperty("wireFormat.MaxInactivityDurationInitalDelay", "10000"))); // Create the Openwire Format Object - Pointer wireFormat( new OpenWireFormat( properties ) ); + Pointer wireFormat(new OpenWireFormat(properties)); // give the format object the ownership - wireFormat->setPreferedWireFormatInfo( info ); + wireFormat->setPreferedWireFormatInfo(info); return wireFormat; } - AMQ_CATCH_RETHROW( IllegalStateException ) - AMQ_CATCHALL_THROW( IllegalStateException ) + AMQ_CATCH_RETHROW(IllegalStateException) + AMQ_CATCHALL_THROW(IllegalStateException) } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.h?rev=1394091&r1=1394090&r2=1394091&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireFormatFactory.h Thu Oct 4 14:30:56 2012 @@ -53,8 +53,7 @@ namespace openwire{ virtual ~OpenWireFormatFactory() {} - virtual Pointer createWireFormat( - const decaf::util::Properties& properties ); + virtual Pointer createWireFormat(const decaf::util::Properties& properties); }; 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=1394091&r1=1394090&r2=1394091&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 Thu Oct 4 14:30:56 2012 @@ -38,8 +38,7 @@ using namespace decaf::lang::exceptions; const int OpenWireFormatNegotiator::negotiationTimeout = 15000; //////////////////////////////////////////////////////////////////////////////// -OpenWireFormatNegotiator::OpenWireFormatNegotiator( OpenWireFormat* wireFormat, - const Pointer& next ) : +OpenWireFormatNegotiator::OpenWireFormatNegotiator(OpenWireFormat* wireFormat, const Pointer& next ) : WireFormatNegotiator( next ), firstTime(true), wireInfoSentDownLatch(1), @@ -49,188 +48,154 @@ OpenWireFormatNegotiator::OpenWireFormat } //////////////////////////////////////////////////////////////////////////////// -OpenWireFormatNegotiator::~OpenWireFormatNegotiator() -{ - // Close the transport and destroy it. - close(); +OpenWireFormatNegotiator::~OpenWireFormatNegotiator() { + try { + close(); + } + AMQ_CATCHALL_NOTHROW() } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::oneway( const Pointer& command ) - throw( IOException, UnsupportedOperationException ) { +void OpenWireFormatNegotiator::oneway(const Pointer& command) throw (IOException, UnsupportedOperationException) { - try{ + try { - if( closed || next == NULL ){ - throw IOException( - __FILE__, __LINE__, - "OpenWireFormatNegotiator::oneway - transport already closed" ); + if (closed || next == NULL) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::oneway - transport already closed"); } - if( !readyCountDownLatch.await( negotiationTimeout ) ) { - throw IOException( - __FILE__, - __LINE__, - "OpenWireFormatNegotiator::oneway" - "Wire format negotiation timeout: peer did not " - "send his wire format." ); + if (!readyCountDownLatch.await(negotiationTimeout)) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::oneway" + "Wire format negotiation timeout: peer did not " + "send his wire format."); } - next->oneway( command ); + next->oneway(command); } - AMQ_CATCH_RETHROW( UnsupportedOperationException ) - AMQ_CATCH_RETHROW( IOException ) - AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, IOException ) - AMQ_CATCHALL_THROW( IOException ) + AMQ_CATCH_RETHROW(UnsupportedOperationException) + AMQ_CATCH_RETHROW(IOException) + AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, IOException) + AMQ_CATCHALL_THROW(IOException) } //////////////////////////////////////////////////////////////////////////////// -Pointer OpenWireFormatNegotiator::request( const Pointer& command ) - throw( IOException, UnsupportedOperationException ) { +Pointer OpenWireFormatNegotiator::request(const Pointer& command) throw (IOException, UnsupportedOperationException) { - try{ + try { - if( closed || next == NULL ){ - throw IOException( - __FILE__, __LINE__, - "OpenWireFormatNegotiator::request - transport already closed" ); + if (closed || next == NULL) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::request - transport already closed"); } - if( !readyCountDownLatch.await( negotiationTimeout ) ) { - throw IOException( - __FILE__, - __LINE__, - "OpenWireFormatNegotiator::request" - "Wire format negotiation timeout: peer did not " - "send his wire format." ); + if (!readyCountDownLatch.await(negotiationTimeout)) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::request" + "Wire format negotiation timeout: peer did not " + "send his wire format."); } - return next->request( command ); + return next->request(command); } - AMQ_CATCH_RETHROW( UnsupportedOperationException ) - AMQ_CATCH_RETHROW( IOException ) - AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, IOException ) - AMQ_CATCHALL_THROW( IOException ) + AMQ_CATCH_RETHROW(UnsupportedOperationException) + AMQ_CATCH_RETHROW(IOException) + AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, IOException) + AMQ_CATCHALL_THROW(IOException) } //////////////////////////////////////////////////////////////////////////////// -Pointer OpenWireFormatNegotiator::request( - const Pointer& command, unsigned int timeout ) - throw( IOException, UnsupportedOperationException ) { +Pointer OpenWireFormatNegotiator::request(const Pointer& command, unsigned int timeout) throw (IOException, UnsupportedOperationException) { - try{ + try { - if( closed || next == NULL ){ - throw IOException( - __FILE__, __LINE__, - "OpenWireFormatNegotiator::request - transport already closed" ); + if (closed || next == NULL) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::request - transport already closed"); } - if( !readyCountDownLatch.await( negotiationTimeout ) ) { - throw IOException( - __FILE__, - __LINE__, - "OpenWireFormatNegotiator::request" - "Wire format negotiation timeout: peer did not " - "send his wire format." ); + if (!readyCountDownLatch.await(negotiationTimeout)) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::request" + "Wire format negotiation timeout: peer did not " + "send his wire format."); } - return next->request( command, timeout ); + return next->request(command, timeout); } - AMQ_CATCH_RETHROW( UnsupportedOperationException ) - AMQ_CATCH_RETHROW( IOException ) - AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, IOException ) - AMQ_CATCHALL_THROW( IOException ) + AMQ_CATCH_RETHROW(UnsupportedOperationException) + AMQ_CATCH_RETHROW(IOException) + AMQ_CATCH_EXCEPTION_CONVERT(exceptions::ActiveMQException, IOException) + AMQ_CATCHALL_THROW(IOException) } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::onCommand( const Pointer& command ) { +void OpenWireFormatNegotiator::onCommand(const Pointer& command) { - if( command->isWireFormatInfo() ) { + if (command->isWireFormatInfo()) { - WireFormatInfo* info = dynamic_cast( command.get() ); + WireFormatInfo* info = dynamic_cast(command.get()); try { - if( !info->isValid() ) { - throw IOException( - __FILE__, - __LINE__, - "OpenWireFormatNegotiator::onCommand" - "Remote wire format magic is invalid" ); + if (!info->isValid()) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::onCommand" + "Remote wire format magic is invalid"); } - wireInfoSentDownLatch.await( negotiationTimeout ); - openWireFormat->renegotiateWireFormat( *info ); - + wireInfoSentDownLatch.await(negotiationTimeout); + openWireFormat->renegotiateWireFormat(*info); readyCountDownLatch.countDown(); - - } catch( exceptions::ActiveMQException& ex ) { - + } catch (exceptions::ActiveMQException& ex) { readyCountDownLatch.countDown(); - fire( ex ); + fire(ex); } } // Send along to the next interested party. - fire( command ); + fire(command); } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::onTransportException( - Transport* source AMQCPP_UNUSED, - const decaf::lang::Exception& ex ) { - +void OpenWireFormatNegotiator::onTransportException(Transport* source AMQCPP_UNUSED, const decaf::lang::Exception& ex) { readyCountDownLatch.countDown(); - fire( ex ); + fire(ex); } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::start() throw( IOException ){ +void OpenWireFormatNegotiator::start() throw (IOException) { /** * We're already started. */ - if( !closed ){ + if (!closed) { return; } - if( listener == NULL ){ - throw IOException( - __FILE__, __LINE__, - "OpenWireFormatNegotiator::start - TransportListener is invalid" ); - } - - if( next == NULL ){ - throw IOException( - __FILE__, __LINE__, - "OpenWireFormatNegotiator::start - next transport is NULL" ); - } - - if( openWireFormat == NULL ){ - throw IOException( - __FILE__, __LINE__, - "OpenWireFormatNegotiator::start - openWireFormat is NULL" ); + if (listener == NULL) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::start - TransportListener is invalid"); + } + + if (next == NULL) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::start - next transport is NULL"); + } + + if (openWireFormat == NULL) { + throw IOException(__FILE__, __LINE__, "OpenWireFormatNegotiator::start - openWireFormat is NULL"); } // Start the delegate transport object. next->start(); - if( firstTime.compareAndSet( true, false ) ) { + if (firstTime.compareAndSet(true, false)) { try { // We first send the WireFormat that we'd prefer. - this->next->oneway( openWireFormat->getPreferedWireFormatInfo() ); + this->next->oneway(openWireFormat->getPreferedWireFormatInfo()); // Mark the latch wireInfoSentDownLatch.countDown(); - } catch( decaf::lang::Exception& ex ) { - + } catch (decaf::lang::Exception& ex) { // Mark the latch wireInfoSentDownLatch.countDown(); - ex.setMark( __FILE__, __LINE__ ); + ex.setMark(__FILE__, __LINE__); throw; } } @@ -240,18 +205,17 @@ void OpenWireFormatNegotiator::start() t } //////////////////////////////////////////////////////////////////////////////// -void OpenWireFormatNegotiator::close() throw( IOException ){ +void OpenWireFormatNegotiator::close() throw (IOException) { - try{ + try { - if( !closed && next != NULL ){ + if (!closed && next != NULL) { next->close(); } closed = true; } - AMQ_CATCH_RETHROW( IOException ) - AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException ) - AMQ_CATCHALL_THROW( IOException ) + AMQ_CATCH_RETHROW(IOException) + AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException) + AMQ_CATCHALL_THROW(IOException) } - 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=1394091&r1=1394090&r2=1394091&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 Thu Oct 4 14:30:56 2012 @@ -34,7 +34,7 @@ namespace openwire{ using decaf::lang::Pointer; - class AMQCPP_API OpenWireFormatNegotiator : public wireformat::WireFormatNegotiator { + class AMQCPP_API OpenWireFormatNegotiator: public wireformat::WireFormatNegotiator { private: /** @@ -65,8 +65,8 @@ namespace openwire{ private: - OpenWireFormatNegotiator( const OpenWireFormatNegotiator& ); - OpenWireFormatNegotiator& operator= ( const OpenWireFormatNegotiator& ); + OpenWireFormatNegotiator(const OpenWireFormatNegotiator&); + OpenWireFormatNegotiator& operator=(const OpenWireFormatNegotiator&); public: @@ -75,8 +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& next ); + OpenWireFormatNegotiator(OpenWireFormat* wireFormat, const Pointer& next); virtual ~OpenWireFormatNegotiator(); @@ -91,9 +90,7 @@ namespace openwire{ * @throws UnsupportedOperationException if this method is not implemented * by this transport. */ - virtual void oneway( const Pointer& command ) - throw( decaf::io::IOException, - decaf::lang::exceptions::UnsupportedOperationException ); + virtual void oneway(const Pointer& command) throw (decaf::io::IOException, decaf::lang::exceptions::UnsupportedOperationException); /** * Sends the given request to the server and waits for the response. @@ -103,9 +100,8 @@ namespace openwire{ * @return the response from the server. * @throws IOException if an error occurs with the request. */ - virtual Pointer request( const Pointer& command ) - throw( decaf::io::IOException, - decaf::lang::exceptions::UnsupportedOperationException ); + virtual Pointer request(const Pointer& command) throw (decaf::io::IOException, + decaf::lang::exceptions::UnsupportedOperationException); /** * Sends the given request to the server and waits for the response. @@ -116,10 +112,8 @@ namespace openwire{ * @return the response from the server. * @throws IOException if an error occurs with the request. */ - virtual Pointer request( - const Pointer& command, unsigned int timeout ) - throw( decaf::io::IOException, - decaf::lang::exceptions::UnsupportedOperationException ); + virtual Pointer request(const Pointer& command, unsigned int timeout) throw (decaf::io::IOException, + decaf::lang::exceptions::UnsupportedOperationException); /** * This is called in the context of the nested transport's @@ -129,15 +123,14 @@ namespace openwire{ * the command listener. * @param command the received from the nested transport. */ - virtual void onCommand( const Pointer& command ); + virtual void onCommand(const Pointer& 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 onTransportException(transport::Transport* source, const decaf::lang::Exception& ex); /** * Starts this transport object and creates the thread for @@ -148,7 +141,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() throw (decaf::io::IOException); /** * Stops the polling thread and closes the streams. This can @@ -156,7 +149,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() throw (decaf::io::IOException); }; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp?rev=1394091&r1=1394090&r2=1394091&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.cpp Thu Oct 4 14:30:56 2012 @@ -46,14 +46,12 @@ using namespace decaf; using namespace decaf::lang; //////////////////////////////////////////////////////////////////////////////// -Pointer OpenWireResponseBuilder::buildResponse( - const Pointer& command ){ - - if( command->isResponseRequired() ) { +Pointer OpenWireResponseBuilder::buildResponse(const Pointer& command) { + if (command->isResponseRequired()) { // These Commands just require a response that matches their command IDs - Pointer response( new commands::Response() ); - response->setCorrelationId( command->getCommandId() ); + Pointer response(new commands::Response()); + response->setCorrelationId(command->getCommandId()); return response; } @@ -61,19 +59,16 @@ Pointer OpenWireResponseBuilde } //////////////////////////////////////////////////////////////////////////////// -void OpenWireResponseBuilder::buildIncomingCommands( - const Pointer& command, decaf::util::LinkedList< Pointer >& queue ){ +void OpenWireResponseBuilder::buildIncomingCommands(const Pointer& command, decaf::util::LinkedList >& queue) { // Delegate this to buildResponse - if( command->isResponseRequired() ) { - queue.push( buildResponse( command ) ); + if (command->isResponseRequired()) { + queue.push(buildResponse(command)); } - if( command->isWireFormatInfo() ) { - + if (command->isWireFormatInfo()) { // Return a copy of the callers own requested WireFormatInfo // so they get exactly the settings they asked for. - queue.push( Pointer( - dynamic_cast( command->cloneDataStructure() ) ) ); + queue.push(Pointer(dynamic_cast(command->cloneDataStructure()))); } } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h?rev=1394091&r1=1394090&r2=1394091&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/OpenWireResponseBuilder.h Thu Oct 4 14:30:56 2012 @@ -32,18 +32,16 @@ namespace openwire{ /** * Used to allow a MockTransport to generate response commands to OpenWire Commands. */ - class AMQCPP_API OpenWireResponseBuilder : public transport::mock::ResponseBuilder { + class AMQCPP_API OpenWireResponseBuilder: public transport::mock::ResponseBuilder { public: OpenWireResponseBuilder() {} virtual ~OpenWireResponseBuilder() {} - virtual Pointer buildResponse( - const Pointer& command ); + virtual Pointer buildResponse(const Pointer& command); - virtual void buildIncomingCommands( - const Pointer& command, - decaf::util::LinkedList< Pointer >& queue ); + virtual void buildIncomingCommands(const Pointer& command, + decaf::util::LinkedList >& queue); }; Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h?rev=1394091&r1=1394090&r2=1394091&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h Thu Oct 4 14:30:56 2012 @@ -36,7 +36,7 @@ namespace marshal{ * * @since 2.0 */ - class AMQCPP_API BaseDataStreamMarshaller : public DataStreamMarshaller { + class AMQCPP_API BaseDataStreamMarshaller: public DataStreamMarshaller { private: // Table for converting bytes to Hex Strings. @@ -53,9 +53,9 @@ namespace marshal{ * @param bs - boolean stream to marshal to. * @throws IOException if an error occurs. */ - virtual int tightMarshal1( OpenWireFormat* format AMQCPP_UNUSED, - commands::DataStructure* command AMQCPP_UNUSED, - utils::BooleanStream* bs AMQCPP_UNUSED ) { return 0; } + virtual int tightMarshal1(OpenWireFormat* format AMQCPP_UNUSED, commands::DataStructure* command AMQCPP_UNUSED, utils::BooleanStream* bs AMQCPP_UNUSED) { + return 0; + } /** * Tight Marshal to the given stream @@ -65,10 +65,10 @@ namespace marshal{ * @param bs - boolean stream to marshal to. * @throws IOException if an error occurs. */ - virtual void tightMarshal2( OpenWireFormat* format AMQCPP_UNUSED, - commands::DataStructure* command AMQCPP_UNUSED, - decaf::io::DataOutputStream* ds AMQCPP_UNUSED, - utils::BooleanStream* bs AMQCPP_UNUSED ) {} + virtual void tightMarshal2(OpenWireFormat* format AMQCPP_UNUSED, + commands::DataStructure* command AMQCPP_UNUSED, + decaf::io::DataOutputStream* ds AMQCPP_UNUSED, + utils::BooleanStream* bs AMQCPP_UNUSED) {} /** * Tight Un-Marshal to the given stream @@ -78,10 +78,10 @@ namespace marshal{ * @param bs - boolean stream to Un-Marshal from. * @throws IOException if an error occurs. */ - virtual void tightUnmarshal( OpenWireFormat* format AMQCPP_UNUSED, - commands::DataStructure* command AMQCPP_UNUSED, - decaf::io::DataInputStream* dis AMQCPP_UNUSED, - utils::BooleanStream* bs AMQCPP_UNUSED ) {} + virtual void tightUnmarshal(OpenWireFormat* format AMQCPP_UNUSED, + commands::DataStructure* command AMQCPP_UNUSED, + decaf::io::DataInputStream* dis AMQCPP_UNUSED, + utils::BooleanStream* bs AMQCPP_UNUSED) {} /** * Tight Marshal to the given stream @@ -90,9 +90,9 @@ namespace marshal{ * @param ds - DataOutputStream to marshal to * @throws IOException if an error occurs. */ - virtual void looseMarshal( OpenWireFormat* format AMQCPP_UNUSED, - commands::DataStructure* command AMQCPP_UNUSED, - decaf::io::DataOutputStream* ds AMQCPP_UNUSED ) {} + virtual void looseMarshal(OpenWireFormat* format AMQCPP_UNUSED, + commands::DataStructure* command AMQCPP_UNUSED, + decaf::io::DataOutputStream* ds AMQCPP_UNUSED) {} /** * Loose Un-Marshal to the given stream @@ -101,32 +101,33 @@ namespace marshal{ * @param dis - the DataInputStream to Un-Marshal from * @throws IOException if an error occurs. */ - virtual void looseUnmarshal( OpenWireFormat* format AMQCPP_UNUSED, - commands::DataStructure* command AMQCPP_UNUSED, - decaf::io::DataInputStream* dis AMQCPP_UNUSED ) {} + virtual void looseUnmarshal(OpenWireFormat* format AMQCPP_UNUSED, + commands::DataStructure* command AMQCPP_UNUSED, + decaf::io::DataInputStream* dis AMQCPP_UNUSED) {} - public: // Statics + public: + // Statics /** * Converts the object to a String * @param id - MessageId pointer * @returns string representing the id */ - static std::string toString( const commands::MessageId* id ); + static std::string toString(const commands::MessageId* id); /** * Converts the object to a String * @param id - ProducerId pointer * @returns string representing the id */ - static std::string toString( const commands::ProducerId* id ); + static std::string toString(const commands::ProducerId* id); /** * Converts the given transaction ID into a String * @param txnId - TransactionId poitner * @returns string representation of the id */ - static std::string toString( const commands::TransactionId* txnId ); + static std::string toString(const commands::TransactionId* txnId); /** * given an array of bytes, convert that array to a Hexidecimal @@ -134,8 +135,7 @@ namespace marshal{ * @param data - unsigned char data array pointer * @returns a string coded in hex that represents the data */ - static std::string toHexFromBytes( - const std::vector& data ); + static std::string toHexFromBytes(const std::vector& data); protected: @@ -147,10 +147,7 @@ namespace marshal{ * @returns pointer to a new DataStructure Object * @throws IOException if an error occurs. */ - virtual commands::DataStructure* tightUnmarshalCachedObject( - OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs ); + virtual commands::DataStructure* tightUnmarshalCachedObject(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs); /** * Tightly marshals the passed DataStructure based object to the passed @@ -161,9 +158,7 @@ namespace marshal{ * @returns size of data written. * @throws IOException if an error occurs. */ - virtual int tightMarshalCachedObject1( OpenWireFormat* wireFormat, - commands::DataStructure* data, - utils::BooleanStream* bs ); + virtual int tightMarshalCachedObject1(OpenWireFormat* wireFormat, commands::DataStructure* data, utils::BooleanStream* bs); /** * Tightly marshals the passed DataStructure based object to the passed @@ -174,10 +169,7 @@ namespace marshal{ * @param dataOut - stream to write marshaled data to * @throws IOException if an error occurs. */ - virtual void tightMarshalCachedObject2( OpenWireFormat* wireFormat, - commands::DataStructure* data, - decaf::io::DataOutputStream* dataOut, - utils::BooleanStream* bs ); + virtual void tightMarshalCachedObject2(OpenWireFormat* wireFormat, commands::DataStructure* data, decaf::io::DataOutputStream* dataOut,utils::BooleanStream* bs); /** * Loosely marshals the passed DataStructure based object to the passed @@ -187,9 +179,7 @@ namespace marshal{ * @param dataOut - stream to write marshaled data to * @throws IOException if an error occurs. */ - virtual void looseMarshalCachedObject( OpenWireFormat* wireFormat, - commands::DataStructure* data, - decaf::io::DataOutputStream* dataOut ); + virtual void looseMarshalCachedObject(OpenWireFormat* wireFormat, commands::DataStructure* data, decaf::io::DataOutputStream* dataOut); /** * Loose Unmarshal the cached object @@ -198,9 +188,7 @@ namespace marshal{ * @returns pointer to a new DataStructure Object * @throws IOException if an error occurs. */ - virtual commands::DataStructure* looseUnmarshalCachedObject( - OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn ); + virtual commands::DataStructure* looseUnmarshalCachedObject(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn); /** * Tightly marshals the passed DataStructure based object to the passed @@ -211,9 +199,7 @@ namespace marshal{ * @returns size of data written. * @throws IOException if an error occurs. */ - virtual int tightMarshalNestedObject1( OpenWireFormat* wireFormat, - commands::DataStructure* object, - utils::BooleanStream* bs ); + virtual int tightMarshalNestedObject1(OpenWireFormat* wireFormat, commands::DataStructure* object, utils::BooleanStream* bs); /** * Tightly marshals the passed DataStructure based object to the passed @@ -224,10 +210,8 @@ namespace marshal{ * @param dataOut - stream to write marshaled data to * @throws IOException if an error occurs. */ - virtual void tightMarshalNestedObject2( OpenWireFormat* wireFormat, - commands::DataStructure* object, - decaf::io::DataOutputStream* dataOut, - utils::BooleanStream* bs ); + virtual void tightMarshalNestedObject2(OpenWireFormat* wireFormat, commands::DataStructure* object, decaf::io::DataOutputStream* dataOut, + utils::BooleanStream* bs); /** * Tight Unmarshal the nested object @@ -237,10 +221,7 @@ namespace marshal{ * @returns pointer to a new DataStructure Object * @throws IOException if an error occurs. */ - virtual commands::DataStructure* tightUnmarshalNestedObject( - OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs ); + virtual commands::DataStructure* tightUnmarshalNestedObject(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs); /** * Loose Unmarshal the nested object @@ -249,9 +230,7 @@ namespace marshal{ * @returns pointer to a new DataStructure Object * @throws IOException if an error occurs. */ - virtual commands::DataStructure* looseUnmarshalNestedObject( - OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn ); + virtual commands::DataStructure* looseUnmarshalNestedObject(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn); /** * Loose marshall the nested object @@ -260,9 +239,7 @@ namespace marshal{ * @param dataOut - stream to write marshaled data to * @throws IOException if an error occurs. */ - virtual void looseMarshalNestedObject( OpenWireFormat* wireFormat, - commands::DataStructure* object, - decaf::io::DataOutputStream* dataOut ); + virtual void looseMarshalNestedObject(OpenWireFormat* wireFormat, commands::DataStructure* object, decaf::io::DataOutputStream* dataOut); /** * Performs Tight Unmarshaling of String Objects @@ -271,8 +248,7 @@ namespace marshal{ * @returns the unmarshaled string. * @throws IOException if an error occurs. */ - virtual std::string tightUnmarshalString( decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs ); + virtual std::string tightUnmarshalString(decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs); /** * Tight Marshals the String to a Booleans Stream Object, returns @@ -282,8 +258,7 @@ namespace marshal{ * @returns size of marshaled string. * @throws IOException if an error occurs. */ - virtual int tightMarshalString1( const std::string& value, - utils::BooleanStream* bs ); + virtual int tightMarshalString1(const std::string& value, utils::BooleanStream* bs); /** * Tight Marshals the passed string to the streams passed @@ -292,9 +267,7 @@ namespace marshal{ * @param bs - boolean stream to marshal to. * @throws IOException if an error occurs. */ - virtual void tightMarshalString2( const std::string& value, - decaf::io::DataOutputStream* dataOut, - utils::BooleanStream* bs ); + virtual void tightMarshalString2(const std::string& value, decaf::io::DataOutputStream* dataOut, utils::BooleanStream* bs); /** * Loose Marshal the String to the DataOuputStream passed @@ -302,8 +275,7 @@ namespace marshal{ * @param dataOut - stream to write marshaled form to * @throws IOException if an error occurs. */ - virtual void looseMarshalString( const std::string value, - decaf::io::DataOutputStream* dataOut ); + virtual void looseMarshalString(const std::string value, decaf::io::DataOutputStream* dataOut); /** * Loose Un-Marshal the String to the DataOuputStream passed @@ -311,7 +283,7 @@ namespace marshal{ * @return the unmarshaled string * @throws IOException if an error occurs. */ - virtual std::string looseUnmarshalString( decaf::io::DataInputStream* dataIn ); + virtual std::string looseUnmarshalString(decaf::io::DataInputStream* dataIn); /** * Tightly marshal the long long to the BooleanStream passed. @@ -321,9 +293,7 @@ namespace marshal{ * @returns size of data written. * @throws IOException if an error occurs. */ - virtual int tightMarshalLong1( OpenWireFormat* wireFormat, - long long value, - utils::BooleanStream* bs ); + virtual int tightMarshalLong1(OpenWireFormat* wireFormat, long long value, utils::BooleanStream* bs); /** * Tightly marshal the long long to the Streams passed. @@ -333,10 +303,7 @@ namespace marshal{ * @param bs - boolean stream to marshal to. * @throws IOException if an error occurs. */ - virtual void tightMarshalLong2( OpenWireFormat* wireFormat, - long long value, - decaf::io::DataOutputStream* dataOut, - utils::BooleanStream* bs ); + virtual void tightMarshalLong2(OpenWireFormat* wireFormat, long long value, decaf::io::DataOutputStream* dataOut, utils::BooleanStream* bs); /** * Tight marshal the long long type. @@ -346,9 +313,7 @@ namespace marshal{ * @returns the unmarshaled long long * @throws IOException if an error occurs. */ - virtual long long tightUnmarshalLong( OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs ); + virtual long long tightUnmarshalLong(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs); /** * Tightly marshal the long long to the BooleanStream passed. @@ -357,9 +322,7 @@ namespace marshal{ * @param dataOut - DataOutputStream to marshal to. * @throws IOException if an error occurs. */ - virtual void looseMarshalLong( OpenWireFormat* wireFormat, - long long value, - decaf::io::DataOutputStream* dataOut ); + virtual void looseMarshalLong(OpenWireFormat* wireFormat, long long value, decaf::io::DataOutputStream* dataOut); /** * Loose marshal the long long type. @@ -368,8 +331,7 @@ namespace marshal{ * @returns the unmarshaled long long * @throws IOException if an error occurs. */ - virtual long long looseUnmarshalLong( OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn ); + virtual long long looseUnmarshalLong(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn); /** * Tight Unmarshal an array of char @@ -378,9 +340,7 @@ namespace marshal{ * @returns the unmarshaled vector of chars. * @throws IOException if an error occurs. */ - virtual std::vector tightUnmarshalByteArray( - decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs ); + virtual std::vector tightUnmarshalByteArray(decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs); /** * Loose Unmarshal an array of char @@ -388,8 +348,7 @@ namespace marshal{ * @returns the unmarshalled vector of chars. * @throws IOException if an error occurs. */ - virtual std::vector looseUnmarshalByteArray( - decaf::io::DataInputStream* dataIn ); + virtual std::vector looseUnmarshalByteArray(decaf::io::DataInputStream* dataIn); /** * Tight Unmarshal a fixed size array from that data input stream @@ -400,10 +359,7 @@ namespace marshal{ * @returns the unmarshaled vector of chars. * @throws IOException if an error occurs. */ - virtual std::vector tightUnmarshalConstByteArray( - decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs, - int size ); + virtual std::vector tightUnmarshalConstByteArray(decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs, int size); /** * Tight Unmarshal a fixed size array from that data input stream @@ -413,8 +369,7 @@ namespace marshal{ * @returns the unmarshaled vector of chars. * @throws IOException if an error occurs. */ - virtual std::vector looseUnmarshalConstByteArray( - decaf::io::DataInputStream* dataIn, int size ); + virtual std::vector looseUnmarshalConstByteArray(decaf::io::DataInputStream* dataIn, int size); /** * Tight Unarshall the Error object @@ -424,10 +379,7 @@ namespace marshal{ * @returns pointer to a new DataStructure Object * @throws IOException if an error occurs. */ - virtual commands::DataStructure* tightUnmarshalBrokerError( - OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn, - utils::BooleanStream* bs ); + virtual commands::DataStructure* tightUnmarshalBrokerError(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs); /** * Tight Marshal the Error object @@ -437,9 +389,7 @@ namespace marshal{ * @returns size of the marshalled data * @throws IOException if an error occurs. */ - virtual int tightMarshalBrokerError1( OpenWireFormat* wireFormat, - commands::DataStructure* data, - utils::BooleanStream* bs ); + virtual int tightMarshalBrokerError1(OpenWireFormat* wireFormat, commands::DataStructure* data, utils::BooleanStream* bs); /** * Tight Marshal the Error object @@ -449,10 +399,7 @@ namespace marshal{ * @param bs - boolean stream to marshal to. * @throws IOException if an error occurs. */ - virtual void tightMarshalBrokerError2( OpenWireFormat* wireFormat, - commands::DataStructure* data, - decaf::io::DataOutputStream* dataOut, - utils::BooleanStream* bs ); + virtual void tightMarshalBrokerError2(OpenWireFormat* wireFormat, commands::DataStructure* data, decaf::io::DataOutputStream* dataOut,utils::BooleanStream* bs); /** * Loose Unarshal the Error object @@ -461,9 +408,7 @@ namespace marshal{ * @returns pointer to a new DataStructure Object * @throws IOException if an error occurs. */ - virtual commands::DataStructure* looseUnmarshalBrokerError( - OpenWireFormat* wireFormat, - decaf::io::DataInputStream* dataIn ); + virtual commands::DataStructure* looseUnmarshalBrokerError(OpenWireFormat* wireFormat, decaf::io::DataInputStream* dataIn); /** * Tight Marshal the Error object @@ -472,9 +417,7 @@ namespace marshal{ * @param dataOut - stream to write marshalled data to * @throws IOException if an error occurs. */ - virtual void looseMarshalBrokerError( OpenWireFormat* wireFormat, - commands::DataStructure* data, - decaf::io::DataOutputStream* dataOut ); + virtual void looseMarshalBrokerError(OpenWireFormat* wireFormat, commands::DataStructure* data, decaf::io::DataOutputStream* dataOut); /** * Tightly Marshal an array of DataStructure objects to the provided @@ -487,30 +430,26 @@ namespace marshal{ * @throws IOException if an error occurs. */ template - int tightMarshalObjectArray1( OpenWireFormat* wireFormat, - std::vector objects, - utils::BooleanStream* bs ) { - - try{ - if( !objects.empty() ) - { + int tightMarshalObjectArray1(OpenWireFormat* wireFormat, std::vector objects, utils::BooleanStream* bs) { + + try { + if (!objects.empty()) { int rc = 0; - bs->writeBoolean( true ); + bs->writeBoolean(true); rc += 2; - for( std::size_t i = 0; i < objects.size(); ++i ) { - rc += tightMarshalNestedObject1( - wireFormat, objects[i].get(), bs ); + for (std::size_t i = 0; i < objects.size(); ++i) { + rc += tightMarshalNestedObject1(wireFormat, objects[i].get(), bs); } return rc; } else { - bs->writeBoolean( false ); + bs->writeBoolean(false); return 0; } } - 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) } /** @@ -524,25 +463,21 @@ namespace marshal{ * @throws IOException if an error occurs. */ template - void tightMarshalObjectArray2( OpenWireFormat* wireFormat, - std::vector objects, - decaf::io::DataOutputStream* dataOut, - utils::BooleanStream* bs ) { + void tightMarshalObjectArray2(OpenWireFormat* wireFormat, std::vector objects, decaf::io::DataOutputStream* dataOut, utils::BooleanStream* bs) { try { - if( bs->readBoolean() ) { + if (bs->readBoolean()) { - dataOut->writeShort( (short)objects.size() ); - for( std::size_t i = 0; i < objects.size(); ++i ) { - tightMarshalNestedObject2( - wireFormat, objects[i].get(), dataOut, bs ); + dataOut->writeShort((short) objects.size()); + for (std::size_t i = 0; i < objects.size(); ++i) { + tightMarshalNestedObject2(wireFormat, objects[i].get(), dataOut, bs); } } } - 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) } /** @@ -555,25 +490,22 @@ namespace marshal{ * @throws IOException if an error occurs. */ template - void looseMarshalObjectArray( OpenWireFormat* wireFormat, - std::vector objects, - decaf::io::DataOutputStream* dataOut ) { + void looseMarshalObjectArray(OpenWireFormat* wireFormat, std::vector objects, decaf::io::DataOutputStream* dataOut) { try { - dataOut->writeBoolean( !objects.empty() ); - if( !objects.empty() ) { + dataOut->writeBoolean(!objects.empty()); + if (!objects.empty()) { - dataOut->writeShort( (short)objects.size() ); - for( std::size_t i = 0; i < objects.size(); ++i ) { - looseMarshalNestedObject( - wireFormat, objects[i].get(), dataOut ); + dataOut->writeShort((short) objects.size()); + for (std::size_t i = 0; i < objects.size(); ++i) { + looseMarshalNestedObject(wireFormat, objects[i].get(), dataOut); } } } - 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) } protected: @@ -584,7 +516,7 @@ namespace marshal{ * @param dataIn - DataInputStream to read from * @return string value read from stream */ - virtual std::string readAsciiString( decaf::io::DataInputStream* dataIn ); + virtual std::string readAsciiString(decaf::io::DataInputStream* dataIn); };