activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r424272 [4/10] - in /incubator/activemq/trunk/activemq-cpp: ./ src/examples/ src/main/activemq/concurrent/ src/main/activemq/connector/ src/main/activemq/connector/stomp/ src/main/activemq/connector/stomp/commands/ src/main/activemq/connect...
Date Fri, 21 Jul 2006 11:36:16 GMT
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp Fri Jul 21 04:36:09 2006
@@ -29,10 +29,10 @@
 using namespace activemq::concurrent;
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQConsumer::ActiveMQConsumer(connector::ConsumerInfo* consumerInfo,
-                                   ActiveMQSession* session)
+ActiveMQConsumer::ActiveMQConsumer( connector::ConsumerInfo* consumerInfo,
+                                    ActiveMQSession* session )
 {
-    if(session == NULL || consumerInfo == NULL)
+    if( session == NULL || consumerInfo == NULL )
     {
         throw NullPointerException(
             __FILE__, __LINE__,
@@ -54,7 +54,7 @@
     {
         // Dispose of the Consumer Info, this should stop us from getting
         // any more messages.
-        session->onDestroySessionResource(this);
+        session->onDestroySessionResource( this );
         
         // Stop the asynchronous message processin thread if it's
         // running.
@@ -85,11 +85,11 @@
 {
     try
     {
-        synchronized(&msgQueue)
+        synchronized( &msgQueue )
         {
             // Check for empty in case of spurious wakeup, or race to
             // queue lock.
-            while(!shutdown && msgQueue.empty())
+            while( !shutdown && msgQueue.empty() )
             {
                 msgQueue.wait();
             }
@@ -123,12 +123,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::Message* ActiveMQConsumer::receive(int millisecs) 
+cms::Message* ActiveMQConsumer::receive( int millisecs ) 
     throw ( cms::CMSException )
 {
     try
     {
-        synchronized(&msgQueue)
+        synchronized( &msgQueue )
         {
             // Check for empty, and wait if its not
             if( msgQueue.empty() ){
@@ -166,9 +166,9 @@
 {
     try
     {
-        synchronized(&msgQueue)
+        synchronized( &msgQueue )
         {
-            if(!msgQueue.empty())
+            if( !msgQueue.empty() )
             {
                 // Fetch the Message then copy it so it can be handed off
                 // to the user.
@@ -192,11 +192,11 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConsumer::setMessageListener(cms::MessageListener* listener)
+void ActiveMQConsumer::setMessageListener( cms::MessageListener* listener )
 {
     try
     {
-        synchronized(&listenerLock)
+        synchronized( &listenerLock )
         {
             this->listener = listener;
         }
@@ -220,7 +220,7 @@
         // Delegate the Ack to the Session, we cast away copnstness since
         // in a transactional session we might need to redeliver this
         // message and update its data.
-        session->acknowledge(this, const_cast< ActiveMQMessage*>( message ) );
+        session->acknowledge( this, const_cast< ActiveMQMessage*>( message ) );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -231,18 +231,18 @@
 {
     try
     {
-        while(!shutdown)
+        while( !shutdown )
         {
             Message* message = NULL;
 
-            synchronized(&msgQueue)
+            synchronized( &msgQueue )
             {
                 
                 // Gaurd against spurious wakeup or race to sync lock
                 // also if the listner has been unregistered we don't
                 // have anyone to notify, so we wait till a new one is
                 // registered, and then we will deliver the backlog
-                while(msgQueue.empty() || listener == NULL)
+                while( msgQueue.empty() || listener == NULL )
                 {
                     if( shutdown )
                     {
@@ -252,7 +252,7 @@
                 }
                 
                 // don't want to process messages if we are shutting down.
-                if(shutdown)
+                if( shutdown )
                 {
                     return;
                 }
@@ -275,18 +275,18 @@
     {
         cms::ExceptionListener* listener = session->getExceptionListener();
         
-        if(listener != NULL)
+        if( listener != NULL )
         {
             listener->onException( ActiveMQException(
                 __FILE__, __LINE__,
                 "ActiveMQConsumer::run - "
-                "MessageListener threw an unknown Exception, recovering..."));
+                "MessageListener threw an unknown Exception, recovering..." ) );
         }
     }        
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQConsumer::dispatch(ActiveMQMessage* message) 
+void ActiveMQConsumer::dispatch( ActiveMQMessage* message ) 
     throw ( cms::CMSException )
 {
     try
@@ -294,19 +294,19 @@
         // If the Session is in ClientAcknowledge mode, then we set the 
         // handler in the message to this object and send it out.  Otherwise
         // we ack it here for all the other Modes.
-        if(session->getAcknowledgeMode() == Session::ClientAcknowledge)
+        if( session->getAcknowledgeMode() == Session::CLIENT_ACKNOWLEDGE )
         {
             // Register ourself so that we can handle the Message's
             // acknowledge method.
-            message->setAckHandler(this);
+            message->setAckHandler( this );
         }
         else
         {
-            session->acknowledge(this, message);
+            session->acknowledge( this, message );
         }
 
         // No listener, so we queue it
-        synchronized(&msgQueue)
+        synchronized( &msgQueue )
         {
             msgQueue.push( dynamic_cast< cms::Message* >( message ) );
             msgQueue.notifyAll();
@@ -321,9 +321,9 @@
 {
     try
     {
-        synchronized(&msgQueue)
+        synchronized( &msgQueue )
         {
-            while(!msgQueue.empty())
+            while( !msgQueue.empty() )
             {
                 // destroy these messages if this is not a transacted
                 // session, if it is then the tranasction will clean 
@@ -361,13 +361,13 @@
     try
     {
         MessageListener* listener = NULL;
-        synchronized(&listenerLock)
+        synchronized( &listenerLock )
         {
             listener = getMessageListener();                
         }
         if(listener != NULL)
         {
-            listener->onMessage(*message);
+            listener->onMessage( message );
         }
     }        
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -398,14 +398,14 @@
     try
     {
         // Start the thread, if it's not already started.
-        if(listenerThread == NULL)
+        if( listenerThread == NULL )
         {
-            listenerThread = new Thread(this);        
+            listenerThread = new Thread( this );        
             listenerThread->start();                        
         }
         
         // notify the Queue so that any pending messages get delivered
-        synchronized(&msgQueue)
+        synchronized( &msgQueue )
         {
             msgQueue.notifyAll();
         }
@@ -423,7 +423,7 @@
         
         // if the thread is running signal it to quit and then
         // wait for run to return so thread can die
-        if(listenerThread != NULL)
+        if( listenerThread != NULL )
         {                        
             synchronized( &msgQueue )
             {

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.h Fri Jul 21 04:36:09 2006
@@ -57,7 +57,7 @@
         concurrent::Mutex listenerLock;
         
         // Message Queue
-        util::Queue<cms::Message*> msgQueue;
+        util::Queue< cms::Message* > msgQueue;
         
         // Thread to notif a listener if one is added
         concurrent::Thread* listenerThread;
@@ -71,12 +71,9 @@
         /**
          * Constructor
          */
-        ActiveMQConsumer(connector::ConsumerInfo* consumerInfo,
-                         ActiveMQSession* session);
+        ActiveMQConsumer( connector::ConsumerInfo* consumerInfo,
+                          ActiveMQSession* session );
 
-        /**
-         * Destructor
-         */
         virtual ~ActiveMQConsumer(void);
 
     public:  // Interface Implementation
@@ -94,7 +91,7 @@
          * @return new message
          * @throws CMSException
          */
-        virtual cms::Message* receive(int millisecs) throw ( cms::CMSException );
+        virtual cms::Message* receive( int millisecs ) throw ( cms::CMSException );
 
         /**
          * Receive a Message, does not wait if there isn't a new message
@@ -108,7 +105,7 @@
          * Sets the MessageListener that this class will send notifs on
          * @param MessageListener interface pointer
          */
-        virtual void setMessageListener(cms::MessageListener* listener);
+        virtual void setMessageListener( cms::MessageListener* listener );
 
         /**
          * Gets the MessageListener that this class will send notifs on
@@ -178,7 +175,7 @@
          * @param cms::Message pointer to the message to dispatch
          * @throw cms::CMSException
          */
-        virtual void dispatch(ActiveMQMessage* message) 
+        virtual void dispatch( ActiveMQMessage* message ) 
             throw ( cms::CMSException );
 
         /**
@@ -220,6 +217,7 @@
          * Stops the asynchronous message processing thread if it's started.
          */
         void stopThread();
+
     };
 
 }}

Added: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h?rev=424272&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h (added)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQDestination.h Fri Jul 21 04:36:09 2006
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_CORE_ACTIVEMQDESTINATION_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQDESTINATION_H_
+
+#include <activemq/util/SimpleProperties.h>
+#include <activemq/util/StringTokenizer.h>
+#include <activemq/exceptions/IllegalArgumentException.h>
+
+#include <cms/Destination.h>
+
+namespace activemq{
+namespace core{
+
+    template< typename T >
+    class ActiveMQDestination : public T
+    {
+    private:
+
+        // Params that are optional on the destination    
+        util::SimpleProperties properties;
+
+        // Destination type
+        cms::Destination::DestinationType destType;
+
+        // Name of the Destination
+        std::string name;
+
+    public:
+
+        /**
+         * Copy Consturctor
+         * @param CMS Dest to Copy, must be a compatible type
+         */
+        ActiveMQDestination( const cms::Destination* source ){
+            this->copy( *source );
+        }
+
+        /**
+         * Custom Constructor
+         * @param string destination name plus any params
+         * @param type of destination this represents.
+         */
+        ActiveMQDestination( const std::string& dest,
+                             cms::Destination::DestinationType destType )
+        {
+            try
+            {
+                util::StringTokenizer tokenizer(dest, "?&");
+                std::vector<std::string> tokens;
+
+                // Set the type, we know that much anyway
+                this->destType = destType;
+
+                // Require that there at least one token, the dest
+                if( tokenizer.countTokens() < 1 )
+                {
+                    throw exceptions::IllegalArgumentException(
+                        __FILE__, __LINE__,
+                        ( std::string( 
+                            "ActiveMQDestination::ActiveMQDestination - "
+                            "Marlformed Dest: " ) + dest ).c_str() );
+                }
+
+                // Grab the name, that's always first.
+                this->name = tokenizer.nextToken();
+                
+                // Now get all the optional parameters and store them as properties
+                int count = tokenizer.toArray( tokens );
+                
+                for( int i = 0; i < count; ++i )
+                {
+                    tokenizer.reset( tokens[i], "=" );
+            
+                    if( tokenizer.countTokens() != 2 )
+                    {
+                        throw exceptions::IllegalArgumentException(
+                            __FILE__, __LINE__,
+                            ( std::string( 
+                                "ActiveMQDestination::ActiveMQDestination - "
+                                "Marlformed Parameter = ") + tokens[i] ).c_str() );
+                    }
+
+                    // Get the out in the right order
+                    std::string key   = tokenizer.nextToken();
+                    std::string value = tokenizer.nextToken();
+
+                    // Store this param as a property
+                    properties.setProperty( key, value );
+                }
+            }
+            AMQ_CATCH_RETHROW( exceptions::IllegalArgumentException )
+            AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, exceptions::IllegalArgumentException )
+            AMQ_CATCHALL_THROW( exceptions::IllegalArgumentException )            
+        }
+        
+        virtual ~ActiveMQDestination() {}
+        
+        /**
+         * Get the properties of this Destination, these are the optional
+         * params that can be specified on a destination name i.e/
+         * TEST.QUEUE?consumer.dispatchAsync=false&consumer.prefetchSize=10
+         * @returns const reference to a properties object
+         */
+        virtual const util::Properties& getProperties() const {
+            return properties;
+        }
+        
+        /**
+         * Copy the contents of the given properties object to this
+         * objects Properties object.  Existing values are erased.
+         * @param Properties to copy to this object.
+         */
+        virtual void setProperties( const util::Properties& properties ){
+            this->properties.copy( &properties );
+        }
+        
+        /**
+         * Gets the Destination Name minus any optional params that can
+         * be appended to the destination with an ?
+         * @returns destination name minus params
+         */
+        virtual const std::string& getName() const {
+            return name;
+        }
+        
+        /**
+         * Sets the Destination Name minus any optional params that can
+         * be appended to the destination with an ?
+         * @param destination name minus params
+         */
+        virtual void setName( const std::string& ) {
+            this->name = name;
+        }
+        
+        /**
+         * Retrieve the Destination Type for this Destination
+         * @return The Destination Type
+         */
+        virtual cms::Destination::DestinationType getDestinationType() const {
+            return destType;
+        }
+        
+        /**
+         * Set the Destination Type for this Destination
+         * @param The Destination Type
+         */
+        virtual void setDestinationType( cms::Destination::DestinationType destType ) {
+            this->destType = destType;
+        }
+
+        /**
+         * Copies the contents of the given Destinastion object to this one.
+         * @param source The source Destination object.
+         */
+        virtual void copy( const cms::Destination& source ) {
+
+            try
+            {            
+                // This will throw an Bad Cast Exception if the destination
+                // isn't a compatible type
+                const ActiveMQDestination<T>& destination = 
+                    dynamic_cast< const ActiveMQDestination<T>& >( source );
+                
+                this->name     = destination.getName();
+                this->destType = destination.getDestinationType();
+
+                this->properties.copy( &destination.getProperties() );
+            }
+            AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
+        }
+
+    };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQDESTINATION_H_*/

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessage.h Fri Jul 21 04:36:09 2006
@@ -36,17 +36,14 @@
     {
     public:
 
-        /**
-         * Destructor
-         */
-    	virtual ~ActiveMQMessage(void) {}
+        virtual ~ActiveMQMessage(void) {}
 
         /**
          * Sets the Acknowledgement Handler that this Message will use
          * when the Acknowledge method is called.
          * @param ActiveMQAckHandler
          */
-        virtual void setAckHandler(ActiveMQAckHandler* handler) = 0;
+        virtual void setAckHandler( ActiveMQAckHandler* handler ) = 0;
         
         /**
          * Gets the number of times this message has been redelivered.
@@ -59,7 +56,7 @@
          * redelivered
          * @param redelivery count
          */
-        virtual void setRedeliveryCount(int count) = 0;
+        virtual void setRedeliveryCount( int count ) = 0;
 
     };
 

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQMessageListener.h Fri Jul 21 04:36:09 2006
@@ -29,7 +29,7 @@
     {
     public:
 
-    	virtual ~ActiveMQMessageListener(void) {}
+        virtual ~ActiveMQMessageListener(void) {}
 
         /**
          * Called asynchronously when a new message is received, the message

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Fri Jul 21 04:36:09 2006
@@ -26,14 +26,14 @@
 using namespace activemq::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQProducer::ActiveMQProducer(connector::ProducerInfo* producerInfo,
-                                   ActiveMQSession* session)
+ActiveMQProducer::ActiveMQProducer( connector::ProducerInfo* producerInfo,
+                                    ActiveMQSession* session )
 {
-    if(session == NULL || producerInfo == NULL)
+    if( session == NULL || producerInfo == NULL )
     {
         throw NullPointerException(
             __FILE__, __LINE__,
-            "ActiveMQProducer::ActiveMQProducer - Init with NULL Session");
+            "ActiveMQProducer::ActiveMQProducer - Init with NULL Session" );
     }
     
     // Init Producer Data
@@ -41,7 +41,7 @@
     this->producerInfo = producerInfo;
 
     // Default the Delivery options
-    deliveryMode      = cms::Message::PERSISTANT;
+    deliveryMode      = cms::DeliveryMode::PERSISTANT;
     disableMsgId      = false;
     disableTimestamps = false;
     priority          = 4;
@@ -54,37 +54,37 @@
     try
     {
         // Dispose of the ProducerInfo
-        session->onDestroySessionResource(this);
+        session->onDestroySessionResource( this );
     }
     AMQ_CATCH_NOTHROW( ActiveMQException )
     AMQ_CATCHALL_NOTHROW( )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProducer::send(cms::Message& message) 
+void ActiveMQProducer::send( cms::Message* message ) 
     throw ( cms::CMSException )
 {
     try
     {
-        send(producerInfo->getDestination(), message);
+        send( &producerInfo->getDestination(), message );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProducer::send(const cms::Destination& destination,
-                            cms::Message& message) throw ( cms::CMSException )
+void ActiveMQProducer::send( const cms::Destination* destination,
+                             cms::Message* message) throw ( cms::CMSException )
 {
     try
     {
         // configure the message
-        message.setCMSDestination(destination);
-        message.setCMSDeliveryMode(deliveryMode);
-        message.setCMSPriority(priority);
-        message.setCMSExpiration(timeToLive);
+        message->setCMSDestination( destination );
+        message->setCMSDeliveryMode( deliveryMode );
+        message->setCMSPriority( priority );
+        message->setCMSExpiration( timeToLive );
 
-        session->send(&message, this);
+        session->send( message, this );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.h Fri Jul 21 04:36:09 2006
@@ -20,6 +20,7 @@
 #include <cms/MessageProducer.h>
 #include <cms/Message.h>
 #include <cms/Destination.h>
+#include <cms/DeliveryMode.h>
 
 #include <activemq/core/ActiveMQSessionResource.h>
 #include <activemq/connector/ProducerInfo.h>
@@ -35,7 +36,7 @@
     private:
    
         // Delivery Mode of this Producer
-        cms::Message::DeliveryMode deliveryMode;
+        int deliveryMode;
       
         // Disable the Message Id
         bool disableMsgId;
@@ -63,9 +64,6 @@
         ActiveMQProducer( connector::ProducerInfo* producerInfo,
                           ActiveMQSession* session );
 
-        /**
-         * Destructor
-         */
         virtual ~ActiveMQProducer(void);
 
         /**
@@ -73,21 +71,21 @@
          * @param a Message Object Pointer
          * @throws CMSException
          */
-        virtual void send( cms::Message& message ) throw ( cms::CMSException );
+        virtual void send( cms::Message* message ) throw ( cms::CMSException );
       
         /**
          * Sends the message to the designated destination.
          * @param a Message Object Pointer
          * @throws CMSException
          */
-        virtual void send( const cms::Destination& destination,
-                           cms::Message& message) throw ( cms::CMSException );
+        virtual void send( const cms::Destination* destination,
+                           cms::Message* message ) throw ( cms::CMSException );
 
         /** 
          * Sets the delivery mode for this Producer
          * @param The DeliveryMode
          */
-        virtual void setDeliveryMode(cms::Message::DeliveryMode mode) {
+        virtual void setDeliveryMode( int mode ) {
             deliveryMode = mode; 
         }
       
@@ -95,7 +93,7 @@
          * Gets the delivery mode for this Producer
          * @return The DeliveryMode
          */
-        virtual cms::Message::DeliveryMode getDeliveryMode(void) const {
+        virtual int getDeliveryMode(void) const {
             return deliveryMode; 
         }
       

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Fri Jul 21 04:36:09 2006
@@ -40,7 +40,7 @@
                                   const Properties& properties,
                                   ActiveMQConnection* connection)
 {
-    if(sessionInfo == NULL || connection == NULL)
+    if( sessionInfo == NULL || connection == NULL )
     {
         throw NullPointerException(
             __FILE__, __LINE__,
@@ -53,7 +53,7 @@
     this->closed      = false;
 
     // Create a Transaction object only if the session is transactional
-    if(isTransacted())
+    if( isTransacted() )
     {
         transaction = 
             new ActiveMQTransaction(connection, this, properties );
@@ -87,7 +87,7 @@
 
         // Destroy this sessions resources
         connection->getConnectionData()->
-            getConnector()->destroyResource(sessionInfo);
+            getConnector()->destroyResource( sessionInfo );
 
         // mark as done
         closed = true;
@@ -101,7 +101,7 @@
 {
     try
     {
-        if(closed || !isTransacted())
+        if( closed || !isTransacted() )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
@@ -120,11 +120,11 @@
 {
     try
     {
-        if(closed || !isTransacted())
+        if( closed || !isTransacted() )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::rollback - This Session Can't Rollback");
+                "ActiveMQSession::rollback - This Session Can't Rollback" );
         }
 
         // Rollback the Transaction
@@ -136,19 +136,19 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MessageConsumer* ActiveMQSession::createConsumer(
-    cms::Destination& destination)
+    const cms::Destination* destination )
         throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createConsumer - Session Already Closed");
+                "ActiveMQSession::createConsumer - Session Already Closed" );
         }
 
-        return createConsumer(destination, "");
+        return createConsumer( destination, "" );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -156,22 +156,22 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MessageConsumer* ActiveMQSession::createConsumer(
-    cms::Destination& destination,
-    const std::string& selector)
+    const cms::Destination* destination,
+    const std::string& selector )
         throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createConsumer - Session Already Closed");
+                "ActiveMQSession::createConsumer - Session Already Closed" );
         }
 
         ActiveMQConsumer* consumer = new ActiveMQConsumer(
             connection->getConnectionData()->getConnector()->
-                createConsumer(&destination, sessionInfo, selector), this);
+                createConsumer( destination, sessionInfo, selector), this );
 
         connection->addMessageListener(
             consumer->getConsumerInfo()->getConsumerId(), consumer );
@@ -184,7 +184,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MessageConsumer* ActiveMQSession::createDurableConsumer(
-    cms::Topic& destination,
+    const cms::Topic* destination,
     const std::string& name,
     const std::string& selector,
     bool noLocal )
@@ -192,16 +192,16 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createProducer - Session Already Closed");
+                "ActiveMQSession::createProducer - Session Already Closed" );
         }
 
         ActiveMQConsumer* consumer = new ActiveMQConsumer(
             connection->getConnectionData()->getConnector()->
-                createDurableConsumer( &destination, sessionInfo, name, selector, noLocal ), this);
+                createDurableConsumer( destination, sessionInfo, name, selector, noLocal ), this );
 
         connection->addMessageListener(
             consumer->getConsumerInfo()->getConsumerId(), consumer );
@@ -214,53 +214,53 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::MessageProducer* ActiveMQSession::createProducer(
-    cms::Destination& destination)
+    const cms::Destination* destination )
         throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createProducer - Session Already Closed");
+                "ActiveMQSession::createProducer - Session Already Closed" );
         }
 
         return new ActiveMQProducer(
             connection->getConnectionData()->getConnector()->
-                createProducer(&destination, sessionInfo), this);
+                createProducer( destination, sessionInfo ), this );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::Queue* ActiveMQSession::createQueue(const std::string& queueName)
+cms::Queue* ActiveMQSession::createQueue( const std::string& queueName )
     throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createQueue - Session Already Closed");
+                "ActiveMQSession::createQueue - Session Already Closed" );
         }
 
         return connection->getConnectionData()->
-            getConnector()->createQueue(queueName, sessionInfo);
+            getConnector()->createQueue( queueName, sessionInfo );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::Topic* ActiveMQSession::createTopic(const std::string& topicName)
+cms::Topic* ActiveMQSession::createTopic( const std::string& topicName )
     throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
@@ -268,7 +268,7 @@
         }
 
         return connection->getConnectionData()->
-            getConnector()->createTopic(topicName, sessionInfo);
+            getConnector()->createTopic( topicName, sessionInfo );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -280,15 +280,16 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createTemporaryQueue - Session Already Closed");
+                "ActiveMQSession::createTemporaryQueue - "
+                "Session Already Closed" );
         }
 
         return connection->getConnectionData()->
-            getConnector()->createTemporaryQueue(sessionInfo);
+            getConnector()->createTemporaryQueue( sessionInfo );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -300,15 +301,16 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createTemporaryTopic - Session Already Closed");
+                "ActiveMQSession::createTemporaryTopic - "
+                "Session Already Closed" );
         }
 
         return connection->getConnectionData()->
-            getConnector()->createTemporaryTopic(sessionInfo);
+            getConnector()->createTemporaryTopic( sessionInfo );
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCHALL_THROW( ActiveMQException )
@@ -320,11 +322,11 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createMessage - Session Already Closed");
+                "ActiveMQSession::createMessage - Session Already Closed" );
         }
 
         return connection->getConnectionData()->
@@ -336,15 +338,15 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::BytesMessage* ActiveMQSession::createBytesMessage(void) 
-    throw ( cms::CMSException)
+    throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createBytesMessage - Session Already Closed");
+                "ActiveMQSession::createBytesMessage - Session Already Closed" );
         }
 
         return connection->getConnectionData()->
@@ -357,14 +359,14 @@
 ////////////////////////////////////////////////////////////////////////////////
 cms::BytesMessage* ActiveMQSession::createBytesMessage(
     const unsigned char* bytes,
-    unsigned long bytesSize) 
-        throw ( cms::CMSException)
+    unsigned long bytesSize ) 
+        throw ( cms::CMSException )
 {
     try
     {
         BytesMessage* msg = createBytesMessage();
 
-        msg->setBodyBytes(bytes, bytesSize);
+        msg->setBodyBytes( bytes, bytesSize );
 
         return msg;
     }
@@ -378,11 +380,11 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createTextMessage - Session Already Closed");
+                "ActiveMQSession::createTextMessage - Session Already Closed" );
         }
 
         return connection->getConnectionData()->
@@ -393,14 +395,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::TextMessage* ActiveMQSession::createTextMessage(const std::string& text) 
+cms::TextMessage* ActiveMQSession::createTextMessage( const std::string& text ) 
     throw ( cms::CMSException )
 {
     try
     {
         TextMessage* msg = createTextMessage();
 
-        msg->setText(text.c_str());
+        msg->setText( text.c_str() );
 
         return msg;
     }
@@ -414,11 +416,11 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createMapMessage - Session Already Closed");
+                "ActiveMQSession::createMapMessage - Session Already Closed" );
         }
 
         return connection->
@@ -433,19 +435,19 @@
 cms::Session::AcknowledgeMode ActiveMQSession::getAcknowledgeMode(void) const
 {
     return sessionInfo != NULL ? 
-        sessionInfo->getAckMode() : Session::AutoAcknowledge;
+        sessionInfo->getAckMode() : Session::AUTO_ACKNOWLEDGE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 bool ActiveMQSession::isTransacted(void) const
 {
     return sessionInfo != NULL ? 
-        sessionInfo->getAckMode() == Session::Transactional : false;
+        sessionInfo->getAckMode() == Session::SESSION_TRANSACTED : false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::acknowledge(ActiveMQConsumer* consumer,
-                                  ActiveMQMessage* message)
+void ActiveMQSession::acknowledge( ActiveMQConsumer* consumer,
+                                   ActiveMQMessage* message )
     throw ( cms::CMSException )
 {
     try
@@ -454,12 +456,12 @@
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::acknowledgeMessage - Session Already Closed");
+                "ActiveMQSession::acknowledgeMessage - Session Already Closed" );
         }
 
         // Stores the Message and its consumer in the tranasction, if the
         // session is a transactional one.
-        if(isTransacted())
+        if( isTransacted() )
         {      
             transaction->addToTransaction( message, consumer );
         }
@@ -474,16 +476,16 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQSession::send(cms::Message* message, ActiveMQProducer* producer)
+void ActiveMQSession::send( cms::Message* message, ActiveMQProducer* producer )
     throw ( cms::CMSException )
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::onProducerClose - Session Already Closed");
+                "ActiveMQSession::onProducerClose - Session Already Closed" );
         }
 
         // Send via the connection
@@ -501,7 +503,7 @@
 {
     try
     {
-        if(closed)
+        if( closed )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
@@ -515,13 +517,13 @@
         {
             // Remove this Consumer from the Connection
             connection->removeMessageListener(
-                consumer->getConsumerInfo()->getConsumerId());
+                consumer->getConsumerInfo()->getConsumerId() );
 
             // Remove this consumer from the Transaction if we are
             // transactional
             if( transaction != NULL )
             {
-                transaction->removeFromTransaction(consumer);
+                transaction->removeFromTransaction( consumer );
             }
         }
 
@@ -536,7 +538,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 cms::ExceptionListener* ActiveMQSession::getExceptionListener(void)
 {
-    if(connection != NULL)
+    if( connection != NULL )
     {
         return connection->getExceptionListener();
     }

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.h Fri Jul 21 04:36:09 2006
@@ -25,244 +25,242 @@
 namespace activemq{
 namespace core{
 
-   class ActiveMQTransaction;
-   class ActiveMQConnection;
-   class ActiveMQConsumer;
-   class ActiveMQMessage;
-   class ActiveMQProducer;
-   class ActiveMQConsumer;
-   
-   class ActiveMQSession : public cms::Session
-   {
-   private:
-   
-      // SessionInfo for this Session
-      connector::SessionInfo* sessionInfo;
-      
-      // Transaction Management object
-      ActiveMQTransaction* transaction;
-      
-      // Connection
-      ActiveMQConnection* connection;
-      
-      // Bool to indicate if this session was closed.
-      bool closed;
-      
-   public:
-   
-      /**
-       * Constructor
-       */
-      ActiveMQSession( connector::SessionInfo* sessionInfo,
-                       const util::Properties& properties,
-                       ActiveMQConnection* connection);
-   
-      /**
-       * Destructor
-       */
-      virtual ~ActiveMQSession(void);
-   
-   public:   // Implements Mehtods
-   
-      /**
-       * Closes the Session
-       * @throw CMSException
-       */
-      virtual void close(void) throw ( cms::CMSException );
-      
-      /**
-       * Commits all messages done in this transaction and releases any 
-       * locks currently held.
-       * @throws CMSException
-       */
-      virtual void commit(void) throw ( cms::CMSException );
-
-      /**
-       * Rollsback all messages done in this transaction and releases any 
-       * locks currently held.
-       * @throws CMSException
-       */
-      virtual void rollback(void) throw ( cms::CMSException );
-
-      /**
-       * Creates a MessageConsumer for the specified destination.
-       * @param the Destination that this consumer receiving messages for.
-       * @throws CMSException
-       */
-      virtual cms::MessageConsumer* createConsumer(cms::Destination& destination)
-         throw ( cms::CMSException );
-
-      /**
-       * Creates a MessageConsumer for the specified destination, using a 
-       * message selector.
-       * @param the Destination that this consumer receiving messages for.
-       * @throws CMSException
-       */
-      virtual cms::MessageConsumer* createConsumer(cms::Destination& destination,
-                                                   const std::string& selector)
-         throw ( cms::CMSException );
+    class ActiveMQTransaction;
+    class ActiveMQConnection;
+    class ActiveMQConsumer;
+    class ActiveMQMessage;
+    class ActiveMQProducer;
+    class ActiveMQConsumer;
+   
+    class ActiveMQSession : public cms::Session
+    {
+    private:
+   
+        // SessionInfo for this Session
+        connector::SessionInfo* sessionInfo;
+      
+        // Transaction Management object
+        ActiveMQTransaction* transaction;
+      
+        // Connection
+        ActiveMQConnection* connection;
+      
+        // Bool to indicate if this session was closed.
+        bool closed;
+      
+    public:
+   
+        ActiveMQSession( connector::SessionInfo* sessionInfo,
+                         const util::Properties& properties,
+                         ActiveMQConnection* connection );
+   
+        virtual ~ActiveMQSession(void);
+   
+    public:   // Implements Mehtods
+   
+        /**
+         * Closes the Session
+         * @throw CMSException
+         */
+        virtual void close(void) throw ( cms::CMSException );
+      
+        /**
+         * Commits all messages done in this transaction and releases any 
+         * locks currently held.
+         * @throws CMSException
+         */
+        virtual void commit(void) throw ( cms::CMSException );
+
+        /**
+         * Rollsback all messages done in this transaction and releases any 
+         * locks currently held.
+         * @throws CMSException
+         */
+        virtual void rollback(void) throw ( cms::CMSException );
+
+        /**
+         * Creates a MessageConsumer for the specified destination.
+         * @param the Destination that this consumer receiving messages for.
+         * @throws CMSException
+         */
+        virtual cms::MessageConsumer* createConsumer(
+            const cms::Destination* destination )
+                throw ( cms::CMSException );
+
+        /**
+         * Creates a MessageConsumer for the specified destination, using a 
+         * message selector.
+         * @param the Destination that this consumer receiving messages for.
+         * @throws CMSException
+         */
+        virtual cms::MessageConsumer* createConsumer(
+            const cms::Destination* destination,
+            const std::string& selector )
+                throw ( cms::CMSException );
          
-      /**
-       * Creates a durable subscriber to the specified topic, using a 
-       * message selector
-       * @param the topic to subscribe to
-       * @param name used to identify the subscription
-       * @param only messages matching the selector are received
-       * @throws CMSException
-       */
-      virtual cms::MessageConsumer* createDurableConsumer(
-         cms::Topic& destination,
-         const std::string& name,
-         const std::string& selector,
-         bool noLocal = false)
-            throw ( cms::CMSException );
-
-      /**
-       * Creates a MessageProducer to send messages to the specified 
-       * destination.
-       * @param the Destination to publish on
-       * @throws CMSException
-       */
-      virtual cms::MessageProducer* createProducer(cms::Destination& destination)
-         throw ( cms::CMSException );
+        /**
+         * Creates a durable subscriber to the specified topic, using a 
+         * message selector
+         * @param the topic to subscribe to
+         * @param name used to identify the subscription
+         * @param only messages matching the selector are received
+         * @throws CMSException
+         */
+        virtual cms::MessageConsumer* createDurableConsumer(
+            const cms::Topic* destination,
+            const std::string& name,
+            const std::string& selector,
+            bool noLocal = false )
+                throw ( cms::CMSException );
+
+        /**
+         * Creates a MessageProducer to send messages to the specified 
+         * destination.
+         * @param the Destination to publish on
+         * @throws CMSException
+         */
+        virtual cms::MessageProducer* createProducer(
+            const cms::Destination* destination )
+                throw ( cms::CMSException );
          
-      /**
-       * Creates a queue identity given a Queue name.
-       * @param the name of the new Queue
-       * @throws CMSException
-       */
-      virtual cms::Queue* createQueue(const std::string& queueName)
-         throw ( cms::CMSException );
-      
-      /**
-       * Creates a topic identity given a Queue name.
-       * @param the name of the new Topic
-       * @throws CMSException
-       */
-      virtual cms::Topic* createTopic(const std::string& topicName)
-         throw ( cms::CMSException );
-
-      /**
-       * Creates a TemporaryQueue object.
-       * @throws CMSException
-       */
-      virtual cms::TemporaryQueue* createTemporaryQueue(void)
-         throw ( cms::CMSException );
-
-      /**
-       * Creates a TemporaryTopic object.
-       * @throws CMSException
-       */
-      virtual cms::TemporaryTopic* createTemporaryTopic(void)
-         throw ( cms::CMSException );
+        /**
+         * Creates a queue identity given a Queue name.
+         * @param the name of the new Queue
+         * @throws CMSException
+         */
+        virtual cms::Queue* createQueue( const std::string& queueName )
+            throw ( cms::CMSException );
+      
+        /**
+         * Creates a topic identity given a Queue name.
+         * @param the name of the new Topic
+         * @throws CMSException
+         */
+        virtual cms::Topic* createTopic( const std::string& topicName )
+            throw ( cms::CMSException );
+
+        /**
+         * Creates a TemporaryQueue object.
+         * @throws CMSException
+         */
+        virtual cms::TemporaryQueue* createTemporaryQueue(void)
+            throw ( cms::CMSException );
+
+        /**
+         * Creates a TemporaryTopic object.
+         * @throws CMSException
+         */
+        virtual cms::TemporaryTopic* createTemporaryTopic(void)
+            throw ( cms::CMSException );
          
-      /**
-       * Creates a new Message
-       * @throws CMSException
-       */
-      virtual cms::Message* createMessage(void) 
-         throw ( cms::CMSException );
-
-      /**
-       * Creates a BytesMessage
-       * @throws CMSException
-       */
-      virtual cms::BytesMessage* createBytesMessage(void) 
-         throw ( cms::CMSException);
-
-      /**
-       * Creates a BytesMessage and sets the paylod to the passed value
-       * @param an array of bytes to set in the message
-       * @param the size of the bytes array, or number of bytes to use
-       * @throws CMSException
-       */
-      virtual cms::BytesMessage* createBytesMessage(const unsigned char* bytes,
-                                                    unsigned long bytesSize) 
-         throw ( cms::CMSException);
-
-      /**
-       * Creates a new TextMessage
-       * @throws CMSException
-       */
-      virtual cms::TextMessage* createTextMessage(void) 
-         throw ( cms::CMSException );
-      
-      /**
-       * Creates a new TextMessage and set the text to the value given
-       * @param the initial text for the message
-       * @throws CMSException
-       */
-      virtual cms::TextMessage* createTextMessage(const std::string& text) 
-         throw ( cms::CMSException );
-
-      /**
-       * Creates a new TextMessage
-       * @throws CMSException
-       */
-      virtual cms::MapMessage* createMapMessage(void) 
-         throw ( cms::CMSException );
-
-      /**
-       * Returns the acknowledgement mode of the session.
-       * @return the Sessions Acknowledge Mode
-       */
-      virtual cms::Session::AcknowledgeMode getAcknowledgeMode(void) const;
-      
-      /**
-       * Gets if the Sessions is a Transacted Session
-       * @return transacted true - false.
-       */
-      virtual bool isTransacted(void) const;
+        /**
+         * Creates a new Message
+         * @throws CMSException
+         */
+        virtual cms::Message* createMessage(void) 
+            throw ( cms::CMSException );
+
+        /**
+         * Creates a BytesMessage
+         * @throws CMSException
+         */
+        virtual cms::BytesMessage* createBytesMessage(void) 
+            throw ( cms::CMSException );
+
+        /**
+         * Creates a BytesMessage and sets the paylod to the passed value
+         * @param an array of bytes to set in the message
+         * @param the size of the bytes array, or number of bytes to use
+         * @throws CMSException
+         */
+        virtual cms::BytesMessage* createBytesMessage( 
+            const unsigned char* bytes,
+            unsigned long bytesSize ) 
+                throw ( cms::CMSException );
+
+        /**
+         * Creates a new TextMessage
+         * @throws CMSException
+         */
+        virtual cms::TextMessage* createTextMessage(void) 
+            throw ( cms::CMSException );
+      
+        /**
+         * Creates a new TextMessage and set the text to the value given
+         * @param the initial text for the message
+         * @throws CMSException
+         */
+        virtual cms::TextMessage* createTextMessage( const std::string& text ) 
+            throw ( cms::CMSException );
+
+        /**
+         * Creates a new TextMessage
+         * @throws CMSException
+         */
+        virtual cms::MapMessage* createMapMessage(void) 
+            throw ( cms::CMSException );
+
+        /**
+         * Returns the acknowledgement mode of the session.
+         * @return the Sessions Acknowledge Mode
+         */
+        virtual cms::Session::AcknowledgeMode getAcknowledgeMode(void) const;
+      
+        /**
+         * Gets if the Sessions is a Transacted Session
+         * @return transacted true - false.
+         */
+        virtual bool isTransacted(void) const;
           
    public:   // ActiveMQSession specific Methods
    
-      /**
-       * Sends a message from the Producer specified
-       * @param cms::Message pointer
-       * @param Producer Information
-       * @throws CMSException
-       */
-      virtual void send(cms::Message* message, ActiveMQProducer* producer)
-         throw ( cms::CMSException );
+        /**
+         * Sends a message from the Producer specified
+         * @param cms::Message pointer
+         * @param Producer Information
+         * @throws CMSException
+         */
+        virtual void send( cms::Message* message, ActiveMQProducer* producer )
+            throw ( cms::CMSException );
          
-      /**
-       * When a ActiveMQ core object is closed or destroyed it should call 
-       * back and let the session know that it is going away, this allows 
-       * the session to clean up any associated resources.  This method 
-       * destroy's the data that is associated with a Producer object
-       * @param The Producer that is being destoryed
-       * @throw CMSException
-       */
-      virtual void onDestroySessionResource( ActiveMQSessionResource* resource )
-         throw ( cms::CMSException );
-
-      /**
-       * Called to acknowledge the receipt of a message.  
-       * @param The consumer that received the message
-       * @param The Message to acknowledge.
-       * @throws CMSException
-       */
-      virtual void acknowledge(ActiveMQConsumer* consumer,
-                               ActiveMQMessage* message)
-         throw ( cms::CMSException);
+        /**
+         * When a ActiveMQ core object is closed or destroyed it should call 
+         * back and let the session know that it is going away, this allows 
+         * the session to clean up any associated resources.  This method 
+         * destroy's the data that is associated with a Producer object
+         * @param The Producer that is being destoryed
+         * @throw CMSException
+         */
+        virtual void onDestroySessionResource( ActiveMQSessionResource* resource )
+            throw ( cms::CMSException );
+
+        /**
+         * Called to acknowledge the receipt of a message.  
+         * @param The consumer that received the message
+         * @param The Message to acknowledge.
+         * @throws CMSException
+         */
+        virtual void acknowledge( ActiveMQConsumer* consumer,
+                                  ActiveMQMessage* message )
+            throw ( cms::CMSException );
          
-      /**
-       * This method gets any registered exception listener of this sessions
-       * connection and returns it.  Mainly intended for use by the objects
-       * that this session creates so that they can notify the client of
-       * exceptions that occur in the context of another thread.
-       * @returns cms::ExceptionListener pointer or NULL
-       */
-      virtual cms::ExceptionListener* getExceptionListener(void);
-
-      /**
-       * Gets the Session Information object for this session, if the
-       * session is closed than this returns null
-       * @return SessionInfo Pointer
-       */
-      virtual connector::SessionInfo* getSessionInfo(void) {
-         return sessionInfo;
-      }
+        /**
+         * This method gets any registered exception listener of this sessions
+         * connection and returns it.  Mainly intended for use by the objects
+         * that this session creates so that they can notify the client of
+         * exceptions that occur in the context of another thread.
+         * @returns cms::ExceptionListener pointer or NULL
+         */
+        virtual cms::ExceptionListener* getExceptionListener(void);
+
+        /**
+         * Gets the Session Information object for this session, if the
+         * session is closed than this returns null
+         * @return SessionInfo Pointer
+         */
+        virtual connector::SessionInfo* getSessionInfo(void) {
+            return sessionInfo;
+        }
       
    };
 

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionResource.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionResource.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionResource.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionResource.h Fri Jul 21 04:36:09 2006
@@ -26,7 +26,7 @@
     {
     public:
     
-    	virtual ~ActiveMQSessionResource(void) {}
+        virtual ~ActiveMQSessionResource(void) {}
     
         /**
          * Retrieve the Connector resource that is associated with

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.cpp Fri Jul 21 04:36:09 2006
@@ -41,7 +41,7 @@
 {
     try
     {
-        if(connection == NULL || session == NULL)
+        if( connection == NULL || session == NULL )
         {
             throw NullPointerException(
                 __FILE__, __LINE__,
@@ -56,9 +56,9 @@
             
         // convert from property Strings to int.
         redeliveryDelay = Integer::parseInt( 
-            properties.getProperty("transaction.redeliveryDelay", "25") );
+            properties.getProperty( "transaction.redeliveryDelay", "25" ) );
         maxRedeliveries = Integer::parseInt( 
-            properties.getProperty("transaction.maxRedeliveryCount", "5") );
+            properties.getProperty( "transaction.maxRedeliveryCount", "5" ) );
 
         // Start a new Transaction
         transactionInfo = connection->getConnectionData()->
@@ -76,16 +76,16 @@
         // Inform the connector we are rolling back before we close so that
         // the provider knows we didn't complete this transaction
         connection->getConnectionData()->getConnector()->
-            rollback(transactionInfo, session->getSessionInfo());
+            rollback( transactionInfo, session->getSessionInfo() );
 
         // Clean up
         clearTransaction();
         
         // Must allow all the tasks to complete before we destruct otherwise
         // the callbacks will cause an exception.
-        synchronized(&tasksDone)
+        synchronized( &tasksDone )
         {
-            while(taskCount != 0)
+            while( taskCount != 0 )
             {
                 tasksDone.wait(1000);
                 
@@ -102,24 +102,24 @@
 {
     try
     {
-        if(transactionInfo != NULL)
+        if( transactionInfo != NULL )
         {
             // Dispose of the ProducerInfo
             connection->getConnectionData()->
-                getConnector()->destroyResource(transactionInfo);
+                getConnector()->destroyResource( transactionInfo );
         }
 
-        synchronized(&rollbackLock)
+        synchronized( &rollbackLock )
         {
             // If there are any messages that are being transacted, then 
             // they die once and for all here.
             RollbackMap::iterator itr = rollbackMap.begin();
             
-            for(; itr != rollbackMap.end(); ++itr)
+            for( ; itr != rollbackMap.end(); ++itr )
             {
                 MessageList::iterator msgItr = itr->second.begin();
                 
-                for(; msgItr != itr->second.end(); ++msgItr)
+                for( ; msgItr != itr->second.end(); ++msgItr )
                 {
                    delete *msgItr;
                 }
@@ -136,10 +136,10 @@
 void ActiveMQTransaction::addToTransaction( ActiveMQMessage* message,
                                             ActiveMQMessageListener* listener )
 {
-    synchronized(&rollbackLock)
+    synchronized( &rollbackLock )
     {
         // Store in the Multi Map
-        rollbackMap[listener].push_back(message);
+        rollbackMap[listener].push_back( message );
     }
 }
 
@@ -151,7 +151,7 @@
     {
         // Delete all the messages, then remove the consumer's entry from
         // the Rollback Map.
-        synchronized(&rollbackLock)
+        synchronized( &rollbackLock )
         {
             RollbackMap::iterator rb_itr = rollbackMap.find( listener );
             
@@ -162,13 +162,13 @@
             
             MessageList::iterator itr = rb_itr->second.begin();
             
-            for(; itr != rollbackMap[listener].end(); ++itr)
+            for( ; itr != rollbackMap[listener].end(); ++itr )
             {
                delete *itr;
             }
             
             // Erase the entry from the map
-            rollbackMap.erase(listener);
+            rollbackMap.erase( listener );
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
@@ -180,7 +180,7 @@
 {
     try
     {    
-        if(this->transactionInfo == NULL)
+        if( this->transactionInfo == NULL )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
@@ -208,7 +208,7 @@
 {
     try
     {    
-        if(this->transactionInfo == NULL)
+        if( this->transactionInfo == NULL )
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
@@ -222,7 +222,7 @@
 
         // Dispose of the ProducerInfo
         connection->getConnectionData()->
-            getConnector()->destroyResource(transactionInfo);
+            getConnector()->destroyResource( transactionInfo );
 
         // Start a new Transaction
         transactionInfo = connection->getConnectionData()->
@@ -235,7 +235,7 @@
         //  doesn't have to wait on this method to complete an release its
         //  mutex so it can dispatch new messages.  That would however requre
         //  copying the whole map over to the thread.
-        synchronized(&rollbackLock)
+        synchronized( &rollbackLock )
         {
             RollbackMap::iterator itr = rollbackMap.begin();
             
@@ -247,7 +247,7 @@
                                       session,
                                       itr->second,
                                       maxRedeliveries,
-                                      redeliveryDelay) , this));
+                                      redeliveryDelay ) , this ) );
 
                 // Count the tasks started.
                 taskCount++;
@@ -273,9 +273,9 @@
         
         taskCount--;
         
-        if(taskCount == 0)
+        if( taskCount == 0 )
         {
-            synchronized(&tasksDone)
+            synchronized( &tasksDone )
             {
                 tasksDone.notifyAll();
             }
@@ -292,12 +292,12 @@
     try
     {
         // Delegate
-        onTaskComplete(task);
+        onTaskComplete( task );
         
         // Route the Error
         ExceptionListener* listener = connection->getExceptionListener();
         
-        if(listener != NULL)
+        if( listener != NULL )
         {
             listener->onException( ex );
         }
@@ -313,20 +313,20 @@
     {        
         MessageList::iterator itr = messages.begin();
 
-        for(; itr != messages.end(); ++itr)
+        for( ; itr != messages.end(); ++itr )
         {
-            (*itr)->setRedeliveryCount((*itr)->getRedeliveryCount() + 1);
+            ( *itr )->setRedeliveryCount( ( *itr )->getRedeliveryCount() + 1 );
             
             // Redeliver Messages at some point in the future
-            Thread::sleep(redeliveryDelay);
+            Thread::sleep( redeliveryDelay );
             
-            if((*itr)->getRedeliveryCount() >= maxRedeliveries)
+            if( ( *itr )->getRedeliveryCount() >= maxRedeliveries )
             {
                 // Poison Ack the Message, we give up processing this one
                 connection->getConnectionData()->getConnector()->
                     acknowledge( 
                         session->getSessionInfo(), 
-                        dynamic_cast< Message* >(*itr), 
+                        dynamic_cast< Message* >( *itr ), 
                         Connector::PoisonAck );
 
                 // Won't redeliver this so we kill it here.
@@ -335,7 +335,7 @@
                 return;
             }
             
-            listener->onActiveMQMessage(*itr);
+            listener->onActiveMQMessage( *itr );
         }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h Fri Jul 21 04:36:09 2006
@@ -107,10 +107,7 @@
                              ActiveMQSession* session,
                              const util::Properties& properties );
     
-        /**
-         * Destructor
-         */
-    	virtual ~ActiveMQTransaction(void);
+        virtual ~ActiveMQTransaction(void);
                                   
         /**
          * Adds the Message as a part of the Transaction for the specified

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp Fri Jul 21 04:36:09 2006
@@ -39,6 +39,11 @@
             
             // Guessed size was enough. Assign the string.
             message.assign (buffer, written);
+            
+            // assign isn't passing ownership, just copying, delete
+            // the allocated buffer.
+            delete buffer;
+            
             break;
         }
                 

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h Fri Jul 21 04:36:09 2006
@@ -25,151 +25,153 @@
 namespace activemq{
 namespace exceptions{
 
-   /*
-    * Base class for all exceptions.
-    */
-   class ActiveMQException : public cms::CMSException
-   {
-   private:
+    /*
+     * Base class for all exceptions.
+     */
+    class ActiveMQException : public cms::CMSException
+    {
+    private:
     
-      /**
-       * The cause of this exception.
-       */
-      std::string message;
-        
-      /**
-       * The stack trace.
-       */
-      std::vector< std::pair< std::string, int> > stackTrace;
+        /**
+         * The cause of this exception.
+         */
+        std::string message;
+
+        /**
+         * The stack trace.
+         */
+        std::vector< std::pair< std::string, int> > stackTrace;
    
-   public:
+    public:
     
-      /**
-       * Default Constructor
-       */
-      ActiveMQException(void) {}
+        /**
+         * Default Constructor
+         */
+        ActiveMQException(void) {}
        
-      /**
-       * Copy Constructor
-       */
-      ActiveMQException( const ActiveMQException& ex ){
-           *this = ex;
-      }
+        /**
+         * Copy Constructor
+         */
+        ActiveMQException( const ActiveMQException& ex ){
+            *this = ex;
+        }
        
-      /**
-       * Constructor - Initializes the file name and line number where
-       * this message occured.  Sets the message to report, using an 
-       * optional list of arguments to parse into the message
-       * @param file name where exception occurs
-       * @param line number where the exception occurred.
-       * @param message to report
-       * @param list of primitives that are formatted into the message
-       */
-      ActiveMQException(const char* file, const int lineNumber, 
-           const char* msg, ...)
-      {
-         va_list vargs ;
-         va_start(vargs, msg) ;
-         buildMessage(msg, vargs) ;
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occured.  Sets the message to report, using an 
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        ActiveMQException( const char* file, const int lineNumber, 
+                           const char* msg, ... )
+        {
+            va_list vargs;
+            va_start( vargs, msg ) ;
+            buildMessage( msg, vargs );
             
-         // Set the first mark for this exception.
-         setMark( file, lineNumber );
-      }
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
 
-      /**
-       * Destructor
-       */
-      virtual ~ActiveMQException(){}
+        virtual ~ActiveMQException(){}
    
-      /**
-       * Gets the message for this exception.
-       */
-      virtual const char* getMessage() const{ return message.c_str(); }
+        /**
+         * Gets the message for this exception.
+         * @return Text formatted error message
+         */
+        virtual const char* getMessage() const{ return message.c_str(); }
    
-      /**
-       * Sets the cause for this exception.
-       * @param msg the format string for the msg.
-       */
-      virtual void setMessage( const char* msg, ... ){
-          va_list vargs ;
-          va_start(vargs, msg) ;
-          buildMessage(msg, vargs) ;
-      }
-        
-      /**
-       * Adds a file/line number to the stack trace.
-       * @param file The name of the file calling this method (use __FILE__).
-       * @param lineNumber The line number in the calling file (use __LINE__).
-       */
-      virtual void setMark( const char* file, const int lineNumber );
-        
-      /**
-       * Clones this exception.  This is useful for cases where you need
-       * to preserve the type of the original exception as well as the message.
-       * All subclasses should override.
-       */
-      virtual ActiveMQException* clone() const{
-          return new ActiveMQException( *this );
-      }
-        
-      /**
-       * Provides the stack trace for every point where
-       * this exception was caught, marked, and rethrown.  The first
-       * item in the returned vector is the first point where the mark
-       * was set (e.g. where the exception was created).  
-       * @return the stack trace.
-       */
-      virtual std::vector< std::pair< std::string, int> > getStackTrace() const{ 
-          return stackTrace; 
-      }
-        
-      /**
-       * Prints the stack trace to std::err
-       */
-      virtual void printStackTrace() const{
-          printStackTrace( std::cerr );
-      }
-        
-      /**
-       * Prints the stack trace to the given output stream.
-       * @param stream the target output stream.
-       */
-      virtual void printStackTrace( std::ostream& stream ) const{
-          stream << getStackTraceString();
-      }
-        
-      /**
-       * Gets the stack trace as one contiguous string.
-       */
-      virtual std::string getStackTraceString() const{
+        /**
+         * Sets the cause for this exception.
+         * @param msg the format string for the msg.
+         * @param variable - params to format into the string
+         */
+        virtual void setMessage( const char* msg, ... ){
+            va_list vargs;
+            va_start(vargs, msg);
+            buildMessage(msg, vargs);
+        }
+        
+        /**
+         * Adds a file/line number to the stack trace.
+         * @param file The name of the file calling this method (use __FILE__).
+         * @param lineNumber The line number in the calling file (use __LINE__).
+         */
+        virtual void setMark( const char* file, const int lineNumber );
+        
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         * @return Copy of this Exception object
+         */
+        virtual ActiveMQException* clone() const{
+            return new ActiveMQException( *this );
+        }
+        
+        /**
+         * Provides the stack trace for every point where
+         * this exception was caught, marked, and rethrown.  The first
+         * item in the returned vector is the first point where the mark
+         * was set (e.g. where the exception was created).  
+         * @return the stack trace.
+         */
+        virtual std::vector< std::pair< std::string, int> > getStackTrace() const{ 
+            return stackTrace; 
+        }
+
+        /**
+         * Prints the stack trace to std::err
+         */
+        virtual void printStackTrace() const{
+            printStackTrace( std::cerr );
+        }
+        
+        /**
+         * Prints the stack trace to the given output stream.
+         * @param stream the target output stream.
+         */
+        virtual void printStackTrace( std::ostream& stream ) const{
+            stream << getStackTraceString();
+        }
+        
+        /**
+         * Gets the stack trace as one contiguous string.
+         * @return string with formatted stack trace data
+         */
+        virtual std::string getStackTraceString() const{
             
-         // Create the output stream.
-         std::ostringstream stream;
+            // Create the output stream.
+            std::ostringstream stream;
             
-         // Write the message and each stack entry.
-         stream << message << std::endl;
-         for( unsigned int ix=0; ix<stackTrace.size(); ++ix ){
-             stream << "\tFILE: " << stackTrace[ix].first;
-             stream << ", LINE: " << stackTrace[ix].second;
-             stream << std::endl;                    
-         }
+            // Write the message and each stack entry.
+            stream << message << std::endl;
+            for( unsigned int ix=0; ix<stackTrace.size(); ++ix ){
+                stream << "\tFILE: " << stackTrace[ix].first;
+                stream << ", LINE: " << stackTrace[ix].second;
+                stream << std::endl;                    
+            }
             
-         // Return the string from the output stream.
-         return stream.str();
-      }
-        
-      /**
-       * Assignment operator.
-       */
-      virtual ActiveMQException& operator =( const ActiveMQException& ex ){
-          this->message = ex.message;
-          this->stackTrace = ex.stackTrace;
-          return *this;
-      }
+            // Return the string from the output stream.
+            return stream.str();
+        }
+        
+        /**
+         * Assignment operator.
+         * @param const reference to another ActiveMQException
+         */
+        virtual ActiveMQException& operator =( const ActiveMQException& ex ){
+            this->message = ex.message;
+            this->stackTrace = ex.stackTrace;
+            return *this;
+        }
         
-   protected:
+    protected:
    
-      virtual void buildMessage(const char* format, va_list& vargs);
+        virtual void buildMessage( const char* format, va_list& vargs );
 
    };
 

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/IllegalMonitorStateException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/IllegalMonitorStateException.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/IllegalMonitorStateException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/IllegalMonitorStateException.h Fri Jul 21 04:36:09 2006
@@ -22,68 +22,65 @@
 namespace activemq{
 namespace exceptions{
 
-   /*
-    * Thrown when an error occurs from calling a method from syncronizable
-    * and the caller doesn't hold a lock on the object.
-    */
-   class IllegalMonitorStateException : public ActiveMQException
-   {
-   public:
-
-      /**
-       * Default Constructor
-       */
-      IllegalMonitorStateException(void) {};
-
-      /**
-       * Conversion Constructor from some other ActiveMQException
-       * @param An exception that should become this type of Exception
-       */
-      IllegalMonitorStateException(const ActiveMQException& ex){
-         *(ActiveMQException*)this = ex;
-      }
-
-      /**
-       * Copy Constructor
-       */
-      IllegalMonitorStateException(const IllegalMonitorStateException& ex){
-         *(ActiveMQException*)this = ex;
-      }
-
-      /**
-       * Constructor - Initializes the file name and line number where
-       * this message occured.  Sets the message to report, using an 
-       * optional list of arguments to parse into the message
-       * @param file name where exception occurs
-       * @param line number where the exception occurred.
-       * @param message to report
-       * @param list of primitives that are formatted into the message
-       */
-      IllegalMonitorStateException(const char* file, 
-                                   const int lineNumber,
-                                   const char* msg, ...)
-      {
-         va_list vargs;
-         va_start(vargs, msg);
-         buildMessage(msg, vargs);
+    /*
+     * Thrown when an error occurs from calling a method from syncronizable
+     * and the caller doesn't hold a lock on the object.
+     */
+    class IllegalMonitorStateException : public ActiveMQException
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        IllegalMonitorStateException(void) {};
+
+        /**
+         * Conversion Constructor from some other ActiveMQException
+         * @param An exception that should become this type of Exception
+         */
+        IllegalMonitorStateException(const ActiveMQException& ex){
+            *(ActiveMQException*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        IllegalMonitorStateException(const IllegalMonitorStateException& ex){
+            *(ActiveMQException*)this = ex;
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occured.  Sets the message to report, using an 
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        IllegalMonitorStateException( const char* file, 
+                                      const int lineNumber,
+                                      const char* msg, ...)
+        {
+            va_list vargs;
+            va_start(vargs, msg);
+            buildMessage(msg, vargs);
             
-         // Set the first mark for this exception.
-         setMark(file, lineNumber);
-      }
-
-      /**
-       * Clones this exception.  This is useful for cases where you need
-       * to preserve the type of the original exception as well as the message.
-       * All subclasses should override.
-       */
-      virtual ActiveMQException* clone(void) const{
-         return new IllegalMonitorStateException(*this);
-      }
-
-      /**
-       * Destructor
-       */
-      virtual ~IllegalMonitorStateException(void) {}
+            // Set the first mark for this exception.
+            setMark(file, lineNumber);
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual ActiveMQException* clone(void) const{
+            return new IllegalMonitorStateException(*this);
+        }
+
+        virtual ~IllegalMonitorStateException(void) {}
 
    };
 

Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InterruptedException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InterruptedException.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InterruptedException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InterruptedException.h Fri Jul 21 04:36:09 2006
@@ -22,67 +22,64 @@
 namespace activemq{
 namespace exceptions{
 
-   /*
-    * Thrown when an Thread is interrupted during a wait.
-    */
-   class InterruptedException : public ActiveMQException
-   {
-   public:
+    /*
+     * Thrown when an Thread is interrupted during a wait.
+     */
+    class InterruptedException : public ActiveMQException
+    {
+    public:
 
-      /**
-       * Default Constructor
-       */
-      InterruptedException(void) {};
+        /**
+         * Default Constructor
+         */
+        InterruptedException(void) {};
         
-      /**
-       * Conversion Constructor from some other ActiveMQException
-       * @param An exception that should become this type of Exception
-       */
-      InterruptedException(const ActiveMQException& ex){
-         *(ActiveMQException*)this = ex;
-      }
+        /**
+         * Conversion Constructor from some other ActiveMQException
+         * @param An exception that should become this type of Exception
+         */
+        InterruptedException(const ActiveMQException& ex){
+            *(ActiveMQException*)this = ex;
+        }
 
-      /**
-       * Copy Constructor
-       */
-      InterruptedException(const InterruptedException& ex){
-         *(ActiveMQException*)this = ex;
-      }
+        /**
+         * Copy Constructor
+         */
+        InterruptedException(const InterruptedException& ex){
+            *(ActiveMQException*)this = ex;
+        }
 
-      /**
-       * Constructor - Initializes the file name and line number where
-       * this message occured.  Sets the message to report, using an 
-       * optional list of arguments to parse into the message
-       * @param file name where exception occurs
-       * @param line number where the exception occurred.
-       * @param message to report
-       * @param list of primitives that are formatted into the message
-       */
-      InterruptedException(const char* file, 
-                           const int lineNumber,
-                           const char* msg, ...)
-      {
-         va_list vargs;
-         va_start(vargs, msg);
-         buildMessage(msg, vargs);
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occured.  Sets the message to report, using an 
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        InterruptedException( const char* file, 
+                              const int lineNumber,
+                              const char* msg, ... )
+        {
+            va_list vargs;
+            va_start(vargs, msg);
+            buildMessage(msg, vargs);
             
-         // Set the first mark for this exception.
-         setMark(file, lineNumber);
-      }
+            // Set the first mark for this exception.
+            setMark(file, lineNumber);
+        }
 
-      /**
-       * Clones this exception.  This is useful for cases where you need
-       * to preserve the type of the original exception as well as the message.
-       * All subclasses should override.
-       */
-      virtual ActiveMQException* clone(void) const{
-         return new InterruptedException(*this);
-      }
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual ActiveMQException* clone(void) const{
+            return new InterruptedException(*this);
+        }
 
-      /**
-       * Destructor
-       */
-      virtual ~InterruptedException(void) {}
+        virtual ~InterruptedException(void) {}
 
    };
 



Mime
View raw message