activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r662225 - in /activemq/activemq-cpp/trunk/src/main/activemq: cmsutil/CmsTemplate.h connector/openwire/marshal/PrimitiveMapMarshaller.cpp
Date Sun, 01 Jun 2008 14:40:58 GMT
Author: tabish
Date: Sun Jun  1 07:40:57 2008
New Revision: 662225

URL: http://svn.apache.org/viewvc?rev=662225&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-172

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h
    activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h?rev=662225&r1=662224&r2=662225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h Sun Jun  1 07:40:57
2008
@@ -33,27 +33,27 @@
 
     // Forward declarations.
     class MessageCreator;
-    
+
     /**
-     * <code>CmsTemplate</code> simplifies performing synchronous CMS 
-     * operations.  This class is intended to be for CMS what Spring's 
-     * <code>JmsTemplate</code> is for JMS.  Provided with a CMS 
-     * <code>ConnectionFactory</code>, creates and manages all other 
+     * <code>CmsTemplate</code> simplifies performing synchronous CMS
+     * operations.  This class is intended to be for CMS what Spring's
+     * <code>JmsTemplate</code> is for JMS.  Provided with a CMS
+     * <code>ConnectionFactory</code>, creates and manages all other
      * CMS resources internally.
      * <p>
      * Before using <code>CmsTemplate</code> the user must first set
-     * the destination (either by name or by setting the destiation 
+     * the destination (either by name or by setting the destiation
      * object directly) and then call <code>init</code> to initialize
      * the object for use.
      * <p>
      * <code>CmsTemplate</code> allows the user to get access to a CMS
      * <code>Session</code> through a user-defined <code>SessionCallback</code>.
      * Similarly, if the user wants direct access to a CMS
-     * <code>MessageProducer</code>, it can provide a 
+     * <code>MessageProducer</code>, it can provide a
      * <code>ProducerCallback</code>.  As a convenience, the user can bypass
      * having to provide callbacks altogether for sending messages, by calling
      * one of the <code>send</code> methods.
-     * 
+     *
      * @see SessionCallback
      * @see ProducerCallback
      * @see MessageCreator
@@ -61,30 +61,30 @@
     class CmsTemplate : public CmsDestinationAccessor
     {
     public:
-    
+
         /**
          * Timeout value indicating that a receive operation should
          * check if a message is immediately available without blocking.
          */
         static const long long RECEIVE_TIMEOUT_NO_WAIT = -1;
-    
+
         /**
          * Timeout value indicating a blocking receive without timeout.
          */
         static const long long RECEIVE_TIMEOUT_INDEFINITE_WAIT = 0;
-    
+
         /**
          * Default message priority.
          */
         static const int DEFAULT_PRIORITY = 4;
-    
+
         /**
          * My default, messages should live forever.
          */
-        static const long long DEFAULT_TIME_TO_LIVE = 0;                
-    
+        static const long long DEFAULT_TIME_TO_LIVE = 0;
+
     public:
-        
+
         /**
          * Session callback that executes a producer callback.
          */
@@ -92,30 +92,30 @@
         friend class ProducerExecutor;
         class ProducerExecutor : public SessionCallback {
         protected:
-            
+
             ProducerCallback* action;
             CmsTemplate* parent;
             cms::Destination* destination;
-            
+
         public:
-            
+
             ProducerExecutor(ProducerCallback* action,
                     CmsTemplate* parent, cms::Destination* destination){
                 this->action = action;
                 this->parent = parent;
                 this->destination = destination;
             }
-            
+
             virtual ~ProducerExecutor() {}
-            
+
             virtual void doInCms(cms::Session* session) throw (cms::CMSException);
-            
-            virtual cms::Destination* getDestination(cms::Session* session AMQCPP_UNUSED)

+
+            virtual cms::Destination* getDestination(cms::Session* session AMQCPP_UNUSED)
                 throw (cms::CMSException) {
                 return destination;
             }
         };
-        
+
         /**
          * Session callback that executes a producer callback for a named destination.
          */
@@ -123,25 +123,25 @@
         friend class ResolveProducerExecutor;
         class ResolveProducerExecutor : public ProducerExecutor {
         private:
-            
+
             std::string destinationName;
-            
+
         public:
-            
+
             ResolveProducerExecutor(ProducerCallback* action,
                     CmsTemplate* parent, const std::string& destinationName)
             :
                 ProducerExecutor(action, parent, NULL) {
-                
+
                 this->destinationName = destinationName;
             }
-            
+
             virtual ~ResolveProducerExecutor() {}
-            
-            virtual cms::Destination* getDestination(cms::Session* session) 
+
+            virtual cms::Destination* getDestination(cms::Session* session)
                 throw (cms::CMSException) ;
         };
-        
+
         /**
          * Session callback that sends to the given destination.
          */
@@ -149,26 +149,26 @@
         friend class SendExecutor;
         class SendExecutor : public ProducerCallback {
         private:
-            
+
             MessageCreator* messageCreator;
             CmsTemplate* parent;
-            
+
         public:
-            
+
             SendExecutor( MessageCreator* messageCreator,
                     CmsTemplate* parent) {
                 this->messageCreator = messageCreator;
                 this->parent = parent;
             }
-            
+
             virtual ~SendExecutor() {}
-            
+
             virtual void doInCms(cms::Session* session,
                     cms::MessageProducer* producer) throw (cms::CMSException) {
                 parent->doSend(session, producer, messageCreator);
             }
         };
-        
+
         /**
          * Session callback that receives from the given destination.
          */
@@ -176,13 +176,13 @@
         friend class ReceiveExecutor;
         class ReceiveExecutor : public SessionCallback {
         protected:
-            
+
             cms::Destination* destination;
             std::string selector;
             bool noLocal;
             cms::Message* message;
             CmsTemplate* parent;
-            
+
         public:
             ReceiveExecutor( CmsTemplate* parent,
                     cms::Destination* destination,
@@ -194,22 +194,22 @@
                 this->noLocal = noLocal;
                 this->message = NULL;
             }
-            
+
             virtual ~ReceiveExecutor() {}
-            
-            virtual void doInCms(cms::Session* session) 
+
+            virtual void doInCms(cms::Session* session)
                 throw (cms::CMSException);
-            
-            virtual cms::Destination* getDestination(cms::Session* session AMQCPP_UNUSED)

+
+            virtual cms::Destination* getDestination(cms::Session* session AMQCPP_UNUSED)
                 throw (cms::CMSException) {
                 return destination;
             }
-            
+
             cms::Message* getMessage() {
                 return message;
             }
         };
-        
+
         /**
          * Session callback that executes a receive callback for a named destination.
          */
@@ -217,77 +217,77 @@
         friend class ResolveReceiveExecutor;
         class ResolveReceiveExecutor : public ReceiveExecutor {
         private:
-            
+
             std::string destinationName;
-            
+
         public:
-            
+
             ResolveReceiveExecutor(CmsTemplate* parent,
                     const std::string& selector,
                     bool noLocal,
                     const std::string& destinationName)
             :
                 ReceiveExecutor( parent, NULL, selector, noLocal) {
-                
+
                 this->destinationName = destinationName;
             }
-            
+
             virtual ~ResolveReceiveExecutor() {}
-            
-            virtual cms::Destination* getDestination(cms::Session* session) 
+
+            virtual cms::Destination* getDestination(cms::Session* session)
                 throw (cms::CMSException);
         };
-        
+
     private:
-                
+
         static const int NUM_SESSION_POOLS = (int)cms::Session::SESSION_TRANSACTED + 1;
-    
+
         cms::Connection* connection;
-        
+
         SessionPool* sessionPools[NUM_SESSION_POOLS];
-        
+
         cms::Destination* defaultDestination;
-    
+
         std::string defaultDestinationName;
-    
+
         bool messageIdEnabled;
-    
+
         bool messageTimestampEnabled;
-    
+
         bool noLocal;
-    
+
         long long receiveTimeout;
-    
+
         bool explicitQosEnabled;
-    
+
         int deliveryMode;
-    
+
         int priority;
-    
+
         long long timeToLive;
-        
+
         bool initialized;
-    
+
     public:
-    
+
         CmsTemplate();
         CmsTemplate(cms::ConnectionFactory* connectionFactory);
-    
-        virtual ~CmsTemplate();            
-        
+
+        virtual ~CmsTemplate();
+
         /**
          * Sets the destination object to be used by default for send/receive operations.
          * If no default destination is provided, the <code>defaultDestinationName</code>
-         * property is used to resolve this default destination for send/receive 
+         * property is used to resolve this default destination for send/receive
          * operations.
-         * 
+         *
          * @param defaultDestination
          *          the default destination
          */
         virtual void setDefaultDestination(cms::Destination* defaultDestination) {
             this->defaultDestination = defaultDestination;
         }
-    
+
         /**
          * Retrieves the default destination to be used for send/receive operations.
          * @return the default destination. Const version of this method.
@@ -295,7 +295,7 @@
         virtual const cms::Destination* getDefaultDestination() const {
             return this->defaultDestination;
         }
-        
+
         /**
          * Retrieves the default destination to be used for send/receive operations.
          * @return the default destination. Non-const version of this method.
@@ -303,13 +303,13 @@
         virtual cms::Destination* getDefaultDestination() {
             return this->defaultDestination;
         }
-    
+
         /**
          * Sets the name of the default destination to be used from send/receive operations.
          * Calling this method will set the <code>defaultDestination</code> property
to NULL.
          * The destination type (topic/queue) is determined by the
          * <code>pubSubDomain</code> property.
-         * 
+         *
          * @param defaultDestinationName
          *          the name of the destination for send/receive to by default.
          */
@@ -319,68 +319,68 @@
                 this->defaultDestinationName = defaultDestinationName;
             }
         }
-    
+
         /**
          * Gets the name of the default destination to be used for send/receive operations.
          * The destination type (topic/queue) is determined by the
          * <code>pubSubDomain</code> property.
-         * 
+         *
          * @return the default name of the destination for send/receive operations.
          */
         virtual const std::string getDefaultDestinationName() const {
             return this->defaultDestinationName;
         }
-        
+
         /**
          * Indicates whether the default destination is a topic (true) or a queue (false).
          * Calling this method will set the <code>defaultDestination</code> property
to NULL.
-         * 
+         *
          * @param pubSubDomain
          *          indicates whether to use pub-sub messaging (topics).
          */
         virtual void setPubSubDomain( bool pubSubDomain ) {
             if( pubSubDomain != isPubSubDomain() ) {
                 this->defaultDestination = NULL;
-                CmsDestinationAccessor::setPubSubDomain(pubSubDomain);                
+                CmsDestinationAccessor::setPubSubDomain(pubSubDomain);
             }
         }
-    
+
         virtual void setMessageIdEnabled(bool messageIdEnabled) {
             this->messageIdEnabled = messageIdEnabled;
         }
-    
+
         virtual bool isMessageIdEnabled() const {
             return this->messageIdEnabled;
         }
-    
+
         virtual void setMessageTimestampEnabled(bool messageTimestampEnabled) {
             this->messageTimestampEnabled = messageTimestampEnabled;
         }
-    
+
         virtual bool isMessageTimestampEnabled() const {
             return this->messageTimestampEnabled;
         }
-    
+
         virtual void setNoLocal(bool noLocal) {
             this->noLocal = noLocal;
         }
-    
+
         virtual bool isNoLocal() const {
             return this->noLocal;
         }
-    
+
         virtual void setReceiveTimeout(long long receiveTimeout) {
             this->receiveTimeout = receiveTimeout;
         }
-    
+
         virtual long long getReceiveTimeout() const {
             return this->receiveTimeout;
         }
-    
+
         /**
          * Set if the QOS values (deliveryMode, priority, timeToLive)
          * should be used for sending a message.
-         * 
+         *
          * @see #setDeliveryMode
          * @see #setPriority
          * @see #setTimeToLive
@@ -388,15 +388,15 @@
         virtual void setExplicitQosEnabled(bool explicitQosEnabled) {
             this->explicitQosEnabled = explicitQosEnabled;
         }
-    
+
         /**
          * If "true", then the values of deliveryMode, priority, and timeToLive
          * will be used when sending a message. Otherwise, the default values,
          * that may be set administratively, will be used.
-         * 
+         *
          * @return true if overriding default values of QOS parameters
          * (deliveryMode, priority, and timeToLive)
-         * 
+         *
          * @see #setDeliveryMode
          * @see #setPriority
          * @see #setTimeToLive
@@ -404,19 +404,19 @@
         virtual bool isExplicitQosEnabled() const {
             return this->explicitQosEnabled;
         }
-    
+
         /**
          * Set whether message delivery should be persistent or non-persistent,
          * specified as boolean value ("true" or "false"). This will set the delivery
          * mode accordingly, to either "PERSISTENT" or "NON_PERSISTENT".
          * <p>Default it "true" aka delivery mode "PERSISTENT".
-         * 
+         *
          * @see #setDeliveryMode(int)
          */
         virtual void setDeliveryPersistent(bool deliveryPersistent) {
-            this->deliveryMode = (deliveryPersistent ? cms::DeliveryMode::PERSISTENT :
cms::DeliveryMode::NON_PERSISTENT);
+            this->deliveryMode = (deliveryPersistent ? 0 : 1);
         }
-    
+
         /**
          * Set the delivery mode to use when sending a message.
          * Default is the Message default: "PERSISTENT".
@@ -428,51 +428,51 @@
         virtual void setDeliveryMode(int deliveryMode) {
             this->deliveryMode = deliveryMode;
         }
-    
+
         /**
          * Return the delivery mode to use when sending a message.
          */
         virtual int getDeliveryMode() const {
             return this->deliveryMode;
         }
-    
+
         /**
          * Set the priority of a message when sending.
          * <p>Since a default value may be defined administratively,
          * this is only used when "isExplicitQosEnabled" equals "true".
-         * 
+         *
          * @see #isExplicitQosEnabled
          */
         virtual void setPriority(int priority) {
             this->priority = priority;
         }
-    
+
         /**
          * Return the priority of a message when sending.
          */
         virtual int getPriority() const {
             return this->priority;
         }
-    
+
         /**
          * Set the time-to-live of the message when sending.
          * <p>Since a default value may be defined administratively,
          * this is only used when "isExplicitQosEnabled" equals "true".
          * @param timeToLive the message's lifetime (in milliseconds)
-         * 
+         *
          * @see #isExplicitQosEnabled
          */
         virtual void setTimeToLive(long long timeToLive) {
             this->timeToLive = timeToLive;
         }
-    
+
         /**
          * Return the time-to-live of the message when sending.
          */
         virtual long long getTimeToLive() const {
             return this->timeToLive;
         }
-        
+
         /**
          * Executes the given action within a CMS Session.
          * @param action
@@ -480,21 +480,21 @@
          * @throws cms::CMSException thrown if an error occurs.
          */
         virtual void execute(SessionCallback* action) throw (cms::CMSException);
-        
+
         /**
-         * Executes the given action and provides it with a CMS Session and 
+         * Executes the given action and provides it with a CMS Session and
          * producer
-         * 
+         *
          * @param action
          *          the action to perform
          * @throws cms::CMSException thrown if an error occurs.
          */
         virtual void execute(ProducerCallback* action) throw (cms::CMSException);
-        
+
         /**
-         * Executes the given action and provides it with a CMS Session and 
+         * Executes the given action and provides it with a CMS Session and
          * producer
-         * 
+         *
          * @param dest
          *          the destination to send messages to
          * @param action
@@ -503,11 +503,11 @@
          */
         virtual void execute(cms::Destination* dest,
                 ProducerCallback* action) throw (cms::CMSException);
-        
+
         /**
-         * Executes the given action and provides it with a CMS Session and 
+         * Executes the given action and provides it with a CMS Session and
          * producer
-         * 
+         *
          * @param dest
          *          the name of the destination to send messages to
          *          (to internally be resolved to an actual destination)
@@ -517,43 +517,43 @@
          */
         virtual void execute(const std::string& destinationName,
                 ProducerCallback* action) throw (cms::CMSException);
-    
+
         /**
          * Convenience method for sending a message to the default destination.
-         * 
+         *
          * @param messageCreator
          *          Responsible for creating the message to be sent
          * @throws cms::CMSException thrown if an error occurs.
          */
-        virtual void send(MessageCreator* messageCreator) 
+        virtual void send(MessageCreator* messageCreator)
         throw (cms::CMSException);
 
         /**
          * Convenience method for sending a message to the specified destination.
-         * 
+         *
          * @param dest
          *          The destination to send to
          * @param messageCreator
          *          Responsible for creating the message to be sent
          * @throws cms::CMSException thrown if an error occurs.
          */
-        virtual void send(cms::Destination* dest, 
+        virtual void send(cms::Destination* dest,
                 MessageCreator* messageCreator)
         throw (cms::CMSException);
-        
+
         /**
          * Convenience method for sending a message to the specified destination.
-         * 
+         *
          * @param destinationName
          *          The name of the destination to send to.
          * @param messageCreator
          *          Responsible for creating the message to be sent
          * @throws cms::CMSException thrown if an error occurs.
          */
-        virtual void send(const std::string& destinationName, 
+        virtual void send(const std::string& destinationName,
                 MessageCreator* messageCreator)
         throw (cms::CMSException);
-        
+
         /**
          * Performs a synchronous read from the default destination.
          * @return the message
@@ -561,7 +561,7 @@
          */
         virtual cms::Message* receive()
         throw (cms::CMSException);
-        
+
         /**
          * Performs a synchronous read from the specified destination.
          * @param destination
@@ -571,7 +571,7 @@
          */
         virtual cms::Message* receive(cms::Destination* destination )
         throw (cms::CMSException);
-        
+
         /**
          * Performs a synchronous read from the specified destination.
          * @param destinationName
@@ -582,11 +582,11 @@
          */
         virtual cms::Message* receive(const std::string& destinationName )
         throw (cms::CMSException);
-        
+
         /**
          * Performs a synchronous read consuming only messages identified by the
          * given selector.
-         * 
+         *
          * @param selector
          *          the selector expression.
          * @return the message
@@ -594,11 +594,11 @@
          */
         virtual cms::Message* receiveSelected(const std::string& selector )
         throw (cms::CMSException);
-        
+
         /**
-         * Performs a synchronous read from the specified destination, consuming 
+         * Performs a synchronous read from the specified destination, consuming
          * only messages identified by the given selector.
-         * 
+         *
          * @param destination
          *          the destination to receive on.
          * @param selector
@@ -609,11 +609,11 @@
         virtual cms::Message* receiveSelected( cms::Destination* destination,
                 const std::string& selector )
                 throw (cms::CMSException);
-        
+
         /**
-         * Performs a synchronous read from the specified destination, consuming 
+         * Performs a synchronous read from the specified destination, consuming
          * only messages identified by the given selector.
-         * 
+         *
          * @param destinationName
          *          the name of the destination to receive on
          *          (will be resolved to destination internally).
@@ -625,39 +625,39 @@
         virtual cms::Message* receiveSelected( const std::string& destinationName,
                 const std::string& selector )
                 throw (cms::CMSException);
-        
+
     protected:
-        
+
         /**
          * Initializes this object and prepares it for use.  This should be called
          * before any other methds are called.
          */
         void init()
         throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-    
+
         /**
          * Clears all internal resources.
          */
-        void destroy() 
+        void destroy()
         throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
-                
+
     private:
-    
+
         /**
          * Initializes all members to their defaults.
          */
         void initDefaults();
-        
+
         /**
          * Creates the session pools objects.
          */
         void createSessionPools();
-        
+
         /**
          * Destroys the session pool objects.
          */
         void destroySessionPools();
-    
+
         /**
          * Checks that the default destination is valid, if not throws
          * an exception.
@@ -666,22 +666,22 @@
          */
         void checkDefaultDestination()
         throw (decaf::lang::exceptions::IllegalStateException);
-    
+
         /**
          * Gets the connection, creating it if it doesn't already exist.
          * @return the connection
          * @throws cms::CMSException if any of the CMS methods throw.
          */
         cms::Connection* getConnection() throw (cms::CMSException);
-        
+
         /**
          * Creates a session initialized with the proper values.
-         * 
+         *
          * @return the session
          * @throws cms::CMSException if any of the CMS methods throw.
          */
         PooledSession* takeSession() throw (cms::CMSException);
-    
+
         /**
          * Closes, but does not destroy the pooled session resource.
          * @aaram session
@@ -689,10 +689,10 @@
          * @throws cms::CMSException thrown if the CMS methods throw.
          */
         void returnSession( PooledSession*& session ) throw (cms::CMSException);
-    
+
         /**
          * Allocates a producer initialized with the proper values.
-         * 
+         *
          * @param session
          *          The session from which to create a producer
          * @param dest
@@ -703,7 +703,7 @@
          */
         cms::MessageProducer* createProducer(cms::Session* session,
                 cms::Destination* dest) throw (cms::CMSException);
-        
+
         /**
          * Closes and destroys a producer resource
          * @aaram producer
@@ -711,10 +711,10 @@
          * @throws cms::CMSException thrown if the CMS methods throw.
          */
         void destroyProducer( cms::MessageProducer*& producer ) throw (cms::CMSException);
-                
+
         /**
          * Allocates a consumer initialized with the proper values.
-         * 
+         *
          * @param session
          *          The session from which to create a consumer
          * @param dest
@@ -727,7 +727,7 @@
                 cms::Destination* dest,
                 const std::string& selector,
                 bool noLocal ) throw (cms::CMSException);
-        
+
         /**
          * Closes and destroys a consumer resource
          * @aaram consumer
@@ -735,14 +735,14 @@
          * @throws cms::CMSException thrown if the CMS methods throw.
          */
         void destroyConsumer( cms::MessageConsumer*& consumer ) throw (cms::CMSException);
-        
+
         /**
          * Destroys the given message
-         * @param message   
+         * @param message
          *          the message to destroy
          */
         void destroyMessage( cms::Message*& message );
-        
+
         /**
          * Sends a message to a destination.
          * @param session
@@ -754,19 +754,19 @@
          * @throws cms::CMSException thrown if the CMS API throws.
          */
         void doSend(cms::Session* session,
-                cms::MessageProducer* producer, 
+                cms::MessageProducer* producer,
                 MessageCreator* messageCreator) throw (cms::CMSException);
-        
+
         /**
          * Receives a message from a destination.
-         * @param consumer 
+         * @param consumer
          *          the consumer to receive from
          * @return the message that was read
          * @throws cms::CMSException thrown if the CMS API throws.
          */
-        cms::Message* doReceive(cms::MessageConsumer* consumer ) 
+        cms::Message* doReceive(cms::MessageConsumer* consumer )
         throw (cms::CMSException);
-        
+
         /**
          * Resolves the default destination and returns it.
          * @param session

Modified: activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp?rev=662225&r1=662224&r2=662225&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/connector/openwire/marshal/PrimitiveMapMarshaller.cpp
Sun Jun  1 07:40:57 2008
@@ -290,49 +290,63 @@
 
         unsigned char type = dataIn.readByte();
 
+        PrimitiveValueNode value;
+
         switch( type ) {
 
             case PrimitiveValueNode::NULL_TYPE:
-                return PrimitiveValueNode( "" );
+                value.clear();
+                break;
             case PrimitiveValueNode::BYTE_TYPE:
-                return PrimitiveValueNode( dataIn.readByte() );
+                value.setByte( dataIn.readByte() );
+                break;
             case PrimitiveValueNode::BOOLEAN_TYPE:
-                return PrimitiveValueNode( dataIn.readBoolean() );
+                value.setBool( dataIn.readBoolean() );
+                break;
             case PrimitiveValueNode::CHAR_TYPE:
-                return PrimitiveValueNode( dataIn.readChar() );
+                value.setChar( dataIn.readChar() );
+                break;
             case PrimitiveValueNode::SHORT_TYPE:
-                return PrimitiveValueNode( dataIn.readShort() );
+                value.setShort( dataIn.readShort() );
+                break;
             case PrimitiveValueNode::INTEGER_TYPE:
-                return PrimitiveValueNode( dataIn.readInt() );
+                value.setInt( dataIn.readInt() );
+                break;
             case PrimitiveValueNode::LONG_TYPE:
-                return PrimitiveValueNode( dataIn.readLong() );
+                value.setLong( dataIn.readLong() );
+                break;
             case PrimitiveValueNode::FLOAT_TYPE:
-                return PrimitiveValueNode( dataIn.readFloat() );
+                value.setFloat( dataIn.readFloat() );
+                break;
             case PrimitiveValueNode::DOUBLE_TYPE:
-                return PrimitiveValueNode( dataIn.readDouble() );
+                value.setDouble( dataIn.readDouble() );
+                break;
             case PrimitiveValueNode::BYTE_ARRAY_TYPE:
             {
                 int size = dataIn.readInt();
                 std::vector<unsigned char> data;
                 data.resize( size );
                 dataIn.readFully( data );
-                return PrimitiveValueNode( data );
+                value.setByteArray( data );
+                break;
             }
             case PrimitiveValueNode::STRING_TYPE:
             case PrimitiveValueNode::BIG_STRING_TYPE:
-                return PrimitiveValueNode(
-                    OpenwireStringSupport::readString( dataIn ) );
+                value.setString( OpenwireStringSupport::readString( dataIn ) );
+                break;
             case PrimitiveValueNode::LIST_TYPE:
             {
                 PrimitiveList list;
                 PrimitiveMapMarshaller::unmarshalPrimitiveList( dataIn, list );
-                return PrimitiveValueNode( list );
+                value.setList( list );
+                break;
             }
             case PrimitiveValueNode::MAP_TYPE:
             {
                 PrimitiveMap map;
                 PrimitiveMapMarshaller::unmarshalPrimitiveMap( dataIn, map );
-                return PrimitiveValueNode( map );
+                value.setMap( map );
+                break;
             }
             default:
                 throw IOException(
@@ -341,6 +355,8 @@
                     "PrimitiveMapMarshaller::unmarshalPrimitive - "
                     "Unsupported data type: ");
         }
+
+        return value;
     }
     AMQ_CATCH_RETHROW( io::IOException )
     AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )



Mime
View raw message