activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r474108 [2/10] - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main: ./ activemq/connector/openwire/commands/ activemq/connector/openwire/marshal/ activemq/connector/openwire/marshal/v2/
Date Mon, 13 Nov 2006 00:46:30 GMT
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/DataResponse.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -45,24 +47,32 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-DataResponse* DataResponse::clone() const {
+DataStructure* DataResponse::cloneDataStructure() const {
     DataResponse* dataResponse = new DataResponse();
 
     // Copy the data from the base class or classes
-    Response::copy( dataResponse );
+    dataResponse->copyDataStructure( this );
 
-    dataResponse->data = this->getData();
-
-    return dataResponse
+    return dataResponse;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataResponse::copy( DataResponse* dest ) const {
+void DataResponse::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    Response::copy( dataResponse );
+    // Copy the data of the base class or classes
+    Response::copyDataStructure( src );
+
+    const DataResponse* srcPtr = dynamic_cast<const DataResponse*>( src );
 
-    dest->setData( this->getData() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "DataResponse::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setData( 
+        dynamic_cast<DataStructure*>( 
+            srcPtr->getData()->cloneDataStructure() ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataResponse.h Sun Nov 12 16:46:23 2006
@@ -70,14 +70,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual DataResponse* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( DataResponse* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const DataStructure* getData() const;
         virtual DataStructure* getData();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataStructure.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataStructure.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataStructure.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DataStructure.h Sun Nov 12 16:46:23 2006
@@ -46,14 +46,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual DataStructure* cloneCommand() const = 0;
+        virtual DataStructure* cloneDataStructure() const = 0;
 
         /**
          * Copy the contents of the passed object into this objects
          * members, overwriting any existing data.
          * @return src - Source Object
          */
-        virtual void copyCommand( const DataStructure* src ) = 0;
+        virtual void copyDataStructure( const DataStructure* src ) = 0;
 
     };
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/DestinationInfo.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -52,37 +54,40 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-DestinationInfo* DestinationInfo::clone() const {
+DataStructure* DestinationInfo::cloneDataStructure() const {
     DestinationInfo* destinationInfo = new DestinationInfo();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( destinationInfo );
+    destinationInfo->copyDataStructure( this );
 
-    destinationInfo->connectionId = this->getConnectionId();
-    destinationInfo->destination = this->getDestination();
-    destinationInfo->operationType = this->getOperationType()->clone();
-    destinationInfo->timeout = this->getTimeout()->clone();
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        destinationInfo->getBrokerPath().push_back( 
-            this->brokerPath[ibrokerPath]->clone();
-    }
-
-    return destinationInfo
+    return destinationInfo;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DestinationInfo::copy( DestinationInfo* dest ) const {
+void DestinationInfo::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( destinationInfo );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
 
-    dest->setConnectionId( this->getConnectionId() );
-    dest->setDestination( this->getDestination() );
-    dest->setOperationType( this->getOperationType()->clone() );
-    dest->setTimeout( this->getTimeout()->clone() );
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        dest->getBrokerPath().push_back( 
-            this->brokerPath[ibrokerPath]->clone() );
+    const DestinationInfo* srcPtr = dynamic_cast<const DestinationInfo*>( src );
+
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "DestinationInfo::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setConnectionId( 
+        dynamic_cast<ConnectionId*>( 
+            srcPtr->getConnectionId()->cloneDataStructure() ) );
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setOperationType( srcPtr->getOperationType() );
+    this->setTimeout( srcPtr->getTimeout() );
+    for( size_t ibrokerPath = 0; ibrokerPath < srcPtr->getBrokerPath().size(); ++ibrokerPath ) {
+        this->getBrokerPath().push_back( 
+            srcPtr->getBrokerPath()[ibrokerPath]->cloneDataStructure() );
     }
 }
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DestinationInfo.h Sun Nov 12 16:46:23 2006
@@ -76,14 +76,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual DestinationInfo* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( DestinationInfo* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ConnectionId* getConnectionId() const;
         virtual ConnectionId* getConnectionId();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/DiscoveryEvent.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -45,26 +47,31 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-DiscoveryEvent* DiscoveryEvent::clone() const {
+DataStructure* DiscoveryEvent::cloneDataStructure() const {
     DiscoveryEvent* discoveryEvent = new DiscoveryEvent();
 
     // Copy the data from the base class or classes
-    BaseDataStructure::copy( discoveryEvent );
+    discoveryEvent->copyDataStructure( this );
 
-    discoveryEvent->serviceName = this->getServiceName();
-    discoveryEvent->brokerName = this->getBrokerName();
-
-    return discoveryEvent
+    return discoveryEvent;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DiscoveryEvent::copy( DiscoveryEvent* dest ) const {
+void DiscoveryEvent::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseDataStructure::copy( discoveryEvent );
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const DiscoveryEvent* srcPtr = dynamic_cast<const DiscoveryEvent*>( src );
 
-    dest->setServiceName( this->getServiceName() );
-    dest->setBrokerName( this->getBrokerName() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "DiscoveryEvent::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setServiceName( srcPtr->getServiceName() );
+    this->setBrokerName( srcPtr->getBrokerName() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/DiscoveryEvent.h Sun Nov 12 16:46:23 2006
@@ -70,14 +70,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual DiscoveryEvent* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( DiscoveryEvent* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const std::string& getServiceName() const;
         virtual std::string& getServiceName();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/ExceptionResponse.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -45,24 +47,32 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ExceptionResponse* ExceptionResponse::clone() const {
+DataStructure* ExceptionResponse::cloneDataStructure() const {
     ExceptionResponse* exceptionResponse = new ExceptionResponse();
 
     // Copy the data from the base class or classes
-    Response::copy( exceptionResponse );
+    exceptionResponse->copyDataStructure( this );
 
-    exceptionResponse->exception = this->getException();
-
-    return exceptionResponse
+    return exceptionResponse;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ExceptionResponse::copy( ExceptionResponse* dest ) const {
+void ExceptionResponse::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    Response::copy( exceptionResponse );
+    // Copy the data of the base class or classes
+    Response::copyDataStructure( src );
+
+    const ExceptionResponse* srcPtr = dynamic_cast<const ExceptionResponse*>( src );
 
-    dest->setException( this->getException() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "ExceptionResponse::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setException( 
+        dynamic_cast<BrokerError*>( 
+            srcPtr->getException()->cloneDataStructure() ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ExceptionResponse.h Sun Nov 12 16:46:23 2006
@@ -70,14 +70,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual ExceptionResponse* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( ExceptionResponse* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const BrokerError* getException() const;
         virtual BrokerError* getException();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/FlushCommand.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -43,22 +45,29 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-FlushCommand* FlushCommand::clone() const {
+DataStructure* FlushCommand::cloneDataStructure() const {
     FlushCommand* flushCommand = new FlushCommand();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( flushCommand );
+    flushCommand->copyDataStructure( this );
 
-
-    return flushCommand
+    return flushCommand;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void FlushCommand::copy( FlushCommand* dest ) const {
+void FlushCommand::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( flushCommand );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
+
+    const FlushCommand* srcPtr = dynamic_cast<const FlushCommand*>( src );
 
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "FlushCommand::copyDataStructure - src is NULL or invalid" );
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/FlushCommand.h Sun Nov 12 16:46:23 2006
@@ -68,14 +68,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual FlushCommand* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( FlushCommand* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
     };
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/IntegerResponse.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -44,24 +46,30 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-IntegerResponse* IntegerResponse::clone() const {
+DataStructure* IntegerResponse::cloneDataStructure() const {
     IntegerResponse* integerResponse = new IntegerResponse();
 
     // Copy the data from the base class or classes
-    Response::copy( integerResponse );
+    integerResponse->copyDataStructure( this );
 
-    integerResponse->result = this->getResult()->clone();
-
-    return integerResponse
+    return integerResponse;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void IntegerResponse::copy( IntegerResponse* dest ) const {
+void IntegerResponse::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    Response::copy( integerResponse );
+    // Copy the data of the base class or classes
+    Response::copyDataStructure( src );
+
+    const IntegerResponse* srcPtr = dynamic_cast<const IntegerResponse*>( src );
 
-    dest->setResult( this->getResult()->clone() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "IntegerResponse::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setResult( srcPtr->getResult() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/IntegerResponse.h Sun Nov 12 16:46:23 2006
@@ -69,14 +69,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual IntegerResponse* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( IntegerResponse* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const int getResult() const;
         virtual int getResult();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/JournalQueueAck.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -47,26 +49,35 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-JournalQueueAck* JournalQueueAck::clone() const {
+DataStructure* JournalQueueAck::cloneDataStructure() const {
     JournalQueueAck* journalQueueAck = new JournalQueueAck();
 
     // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalQueueAck );
+    journalQueueAck->copyDataStructure( this );
 
-    journalQueueAck->destination = this->getDestination();
-    journalQueueAck->messageAck = this->getMessageAck();
-
-    return journalQueueAck
+    return journalQueueAck;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void JournalQueueAck::copy( JournalQueueAck* dest ) const {
+void JournalQueueAck::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalQueueAck );
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const JournalQueueAck* srcPtr = dynamic_cast<const JournalQueueAck*>( src );
 
-    dest->setDestination( this->getDestination() );
-    dest->setMessageAck( this->getMessageAck() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "JournalQueueAck::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setMessageAck( 
+        dynamic_cast<MessageAck*>( 
+            srcPtr->getMessageAck()->cloneDataStructure() ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalQueueAck.h Sun Nov 12 16:46:23 2006
@@ -72,14 +72,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual JournalQueueAck* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( JournalQueueAck* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ActiveMQDestination* getDestination() const;
         virtual ActiveMQDestination* getDestination();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/JournalTopicAck.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -52,34 +54,41 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-JournalTopicAck* JournalTopicAck::clone() const {
+DataStructure* JournalTopicAck::cloneDataStructure() const {
     JournalTopicAck* journalTopicAck = new JournalTopicAck();
 
     // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalTopicAck );
+    journalTopicAck->copyDataStructure( this );
 
-    journalTopicAck->destination = this->getDestination();
-    journalTopicAck->messageId = this->getMessageId();
-    journalTopicAck->messageSequenceId = this->getMessageSequenceId()->clone();
-    journalTopicAck->subscritionName = this->getSubscritionName();
-    journalTopicAck->clientId = this->getClientId();
-    journalTopicAck->transactionId = this->getTransactionId();
-
-    return journalTopicAck
+    return journalTopicAck;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void JournalTopicAck::copy( JournalTopicAck* dest ) const {
+void JournalTopicAck::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalTopicAck );
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const JournalTopicAck* srcPtr = dynamic_cast<const JournalTopicAck*>( src );
 
-    dest->setDestination( this->getDestination() );
-    dest->setMessageId( this->getMessageId() );
-    dest->setMessageSequenceId( this->getMessageSequenceId()->clone() );
-    dest->setSubscritionName( this->getSubscritionName() );
-    dest->setClientId( this->getClientId() );
-    dest->setTransactionId( this->getTransactionId() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "JournalTopicAck::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setMessageId( 
+        dynamic_cast<MessageId*>( 
+            srcPtr->getMessageId()->cloneDataStructure() ) );
+    this->setMessageSequenceId( srcPtr->getMessageSequenceId() );
+    this->setSubscritionName( srcPtr->getSubscritionName() );
+    this->setClientId( srcPtr->getClientId() );
+    this->setTransactionId( 
+        dynamic_cast<TransactionId*>( 
+            srcPtr->getTransactionId()->cloneDataStructure() ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTopicAck.h Sun Nov 12 16:46:23 2006
@@ -77,14 +77,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual JournalTopicAck* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( JournalTopicAck* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ActiveMQDestination* getDestination() const;
         virtual ActiveMQDestination* getDestination();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/JournalTrace.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -44,24 +46,30 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-JournalTrace* JournalTrace::clone() const {
+DataStructure* JournalTrace::cloneDataStructure() const {
     JournalTrace* journalTrace = new JournalTrace();
 
     // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalTrace );
+    journalTrace->copyDataStructure( this );
 
-    journalTrace->message = this->getMessage();
-
-    return journalTrace
+    return journalTrace;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void JournalTrace::copy( JournalTrace* dest ) const {
+void JournalTrace::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalTrace );
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const JournalTrace* srcPtr = dynamic_cast<const JournalTrace*>( src );
 
-    dest->setMessage( this->getMessage() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "JournalTrace::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setMessage( srcPtr->getMessage() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTrace.h Sun Nov 12 16:46:23 2006
@@ -69,14 +69,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual JournalTrace* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( JournalTrace* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const std::string& getMessage() const;
         virtual std::string& getMessage();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/JournalTransaction.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -47,28 +49,34 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-JournalTransaction* JournalTransaction::clone() const {
+DataStructure* JournalTransaction::cloneDataStructure() const {
     JournalTransaction* journalTransaction = new JournalTransaction();
 
     // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalTransaction );
+    journalTransaction->copyDataStructure( this );
 
-    journalTransaction->transactionId = this->getTransactionId();
-    journalTransaction->type = this->getType()->clone();
-    journalTransaction->wasPrepared = this->getWasPrepared()->clone();
-
-    return journalTransaction
+    return journalTransaction;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void JournalTransaction::copy( JournalTransaction* dest ) const {
+void JournalTransaction::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseDataStructure::copy( journalTransaction );
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const JournalTransaction* srcPtr = dynamic_cast<const JournalTransaction*>( src );
 
-    dest->setTransactionId( this->getTransactionId() );
-    dest->setType( this->getType()->clone() );
-    dest->setWasPrepared( this->getWasPrepared()->clone() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "JournalTransaction::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setTransactionId( 
+        dynamic_cast<TransactionId*>( 
+            srcPtr->getTransactionId()->cloneDataStructure() ) );
+    this->setType( srcPtr->getType() );
+    this->setWasPrepared( srcPtr->getWasPrepared() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/JournalTransaction.h Sun Nov 12 16:46:23 2006
@@ -72,14 +72,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual JournalTransaction* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( JournalTransaction* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const TransactionId* getTransactionId() const;
         virtual TransactionId* getTransactionId();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/KeepAliveInfo.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -43,22 +45,29 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-KeepAliveInfo* KeepAliveInfo::clone() const {
+DataStructure* KeepAliveInfo::cloneDataStructure() const {
     KeepAliveInfo* keepAliveInfo = new KeepAliveInfo();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( keepAliveInfo );
+    keepAliveInfo->copyDataStructure( this );
 
-
-    return keepAliveInfo
+    return keepAliveInfo;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void KeepAliveInfo::copy( KeepAliveInfo* dest ) const {
+void KeepAliveInfo::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( keepAliveInfo );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
+
+    const KeepAliveInfo* srcPtr = dynamic_cast<const KeepAliveInfo*>( src );
 
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "KeepAliveInfo::copyDataStructure - src is NULL or invalid" );
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/KeepAliveInfo.h Sun Nov 12 16:46:23 2006
@@ -68,14 +68,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual KeepAliveInfo* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( KeepAliveInfo* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
     };
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/LastPartialCommand.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -43,22 +45,29 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-LastPartialCommand* LastPartialCommand::clone() const {
+DataStructure* LastPartialCommand::cloneDataStructure() const {
     LastPartialCommand* lastPartialCommand = new LastPartialCommand();
 
     // Copy the data from the base class or classes
-    PartialCommand::copy( lastPartialCommand );
+    lastPartialCommand->copyDataStructure( this );
 
-
-    return lastPartialCommand
+    return lastPartialCommand;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void LastPartialCommand::copy( LastPartialCommand* dest ) const {
+void LastPartialCommand::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    PartialCommand::copy( lastPartialCommand );
+    // Copy the data of the base class or classes
+    PartialCommand::copyDataStructure( src );
+
+    const LastPartialCommand* srcPtr = dynamic_cast<const LastPartialCommand*>( src );
 
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "LastPartialCommand::copyDataStructure - src is NULL or invalid" );
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LastPartialCommand.h Sun Nov 12 16:46:23 2006
@@ -68,14 +68,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual LastPartialCommand* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( LastPartialCommand* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
     };
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/LocalTransactionId.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -46,26 +48,33 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-LocalTransactionId* LocalTransactionId::clone() const {
+DataStructure* LocalTransactionId::cloneDataStructure() const {
     LocalTransactionId* localTransactionId = new LocalTransactionId();
 
     // Copy the data from the base class or classes
-    TransactionId::copy( localTransactionId );
+    localTransactionId->copyDataStructure( this );
 
-    localTransactionId->value = this->getValue()->clone();
-    localTransactionId->connectionId = this->getConnectionId();
-
-    return localTransactionId
+    return localTransactionId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void LocalTransactionId::copy( LocalTransactionId* dest ) const {
+void LocalTransactionId::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    TransactionId::copy( localTransactionId );
+    // Copy the data of the base class or classes
+    TransactionId::copyDataStructure( src );
+
+    const LocalTransactionId* srcPtr = dynamic_cast<const LocalTransactionId*>( src );
 
-    dest->setValue( this->getValue()->clone() );
-    dest->setConnectionId( this->getConnectionId() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "LocalTransactionId::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setValue( srcPtr->getValue() );
+    this->setConnectionId( 
+        dynamic_cast<ConnectionId*>( 
+            srcPtr->getConnectionId()->cloneDataStructure() ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/LocalTransactionId.h Sun Nov 12 16:46:23 2006
@@ -71,14 +71,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual LocalTransactionId* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( LocalTransactionId* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const long long getValue() const;
         virtual long long getValue();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/Message.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -78,80 +80,76 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-Message* Message::clone() const {
+DataStructure* Message::cloneDataStructure() const {
     Message* message = new Message();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( message );
+    message->copyDataStructure( this );
 
-    message->producerId = this->getProducerId();
-    message->destination = this->getDestination();
-    message->transactionId = this->getTransactionId();
-    message->originalDestination = this->getOriginalDestination();
-    message->messageId = this->getMessageId();
-    message->originalTransactionId = this->getOriginalTransactionId();
-    message->groupID = this->getGroupID();
-    message->groupSequence = this->getGroupSequence()->clone();
-    message->correlationId = this->getCorrelationId();
-    message->persistent = this->getPersistent()->clone();
-    message->expiration = this->getExpiration()->clone();
-    message->priority = this->getPriority()->clone();
-    message->replyTo = this->getReplyTo();
-    message->timestamp = this->getTimestamp()->clone();
-    message->type = this->getType();
-    message->content = this->getContent()->clone();
-    message->marshalledProperties = this->getMarshalledProperties()->clone();
-    message->dataStructure = this->getDataStructure();
-    message->targetConsumerId = this->getTargetConsumerId();
-    message->compressed = this->getCompressed()->clone();
-    message->redeliveryCounter = this->getRedeliveryCounter()->clone();
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        message->getBrokerPath().push_back( 
-            this->brokerPath[ibrokerPath]->clone();
-    }
-    message->arrival = this->getArrival()->clone();
-    message->userID = this->getUserID();
-    message->recievedByDFBridge = this->getRecievedByDFBridge()->clone();
-    message->droppable = this->getDroppable()->clone();
-
-    return message
+    return message;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Message::copy( Message* dest ) const {
+void Message::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( message );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
 
-    dest->setProducerId( this->getProducerId() );
-    dest->setDestination( this->getDestination() );
-    dest->setTransactionId( this->getTransactionId() );
-    dest->setOriginalDestination( this->getOriginalDestination() );
-    dest->setMessageId( this->getMessageId() );
-    dest->setOriginalTransactionId( this->getOriginalTransactionId() );
-    dest->setGroupID( this->getGroupID() );
-    dest->setGroupSequence( this->getGroupSequence()->clone() );
-    dest->setCorrelationId( this->getCorrelationId() );
-    dest->setPersistent( this->getPersistent()->clone() );
-    dest->setExpiration( this->getExpiration()->clone() );
-    dest->setPriority( this->getPriority()->clone() );
-    dest->setReplyTo( this->getReplyTo() );
-    dest->setTimestamp( this->getTimestamp()->clone() );
-    dest->setType( this->getType() );
-    dest->setContent( this->getContent()->clone() );
-    dest->setMarshalledProperties( this->getMarshalledProperties()->clone() );
-    dest->setDataStructure( this->getDataStructure() );
-    dest->setTargetConsumerId( this->getTargetConsumerId() );
-    dest->setCompressed( this->getCompressed()->clone() );
-    dest->setRedeliveryCounter( this->getRedeliveryCounter()->clone() );
-    for( size_t ibrokerPath = 0; ibrokerPath < brokerPath.size(); ++ibrokerPath ) {
-        dest->getBrokerPath().push_back( 
-            this->brokerPath[ibrokerPath]->clone() );
+    const Message* srcPtr = dynamic_cast<const Message*>( src );
+
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "Message::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setProducerId( 
+        dynamic_cast<ProducerId*>( 
+            srcPtr->getProducerId()->cloneDataStructure() ) );
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setTransactionId( 
+        dynamic_cast<TransactionId*>( 
+            srcPtr->getTransactionId()->cloneDataStructure() ) );
+    this->setOriginalDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getOriginalDestination()->cloneDataStructure() ) );
+    this->setMessageId( 
+        dynamic_cast<MessageId*>( 
+            srcPtr->getMessageId()->cloneDataStructure() ) );
+    this->setOriginalTransactionId( 
+        dynamic_cast<TransactionId*>( 
+            srcPtr->getOriginalTransactionId()->cloneDataStructure() ) );
+    this->setGroupID( srcPtr->getGroupID() );
+    this->setGroupSequence( srcPtr->getGroupSequence() );
+    this->setCorrelationId( srcPtr->getCorrelationId() );
+    this->setPersistent( srcPtr->getPersistent() );
+    this->setExpiration( srcPtr->getExpiration() );
+    this->setPriority( srcPtr->getPriority() );
+    this->setReplyTo( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getReplyTo()->cloneDataStructure() ) );
+    this->setTimestamp( srcPtr->getTimestamp() );
+    this->setType( srcPtr->getType() );
+    this->setContent( srcPtr->getContent() );
+    this->setMarshalledProperties( srcPtr->getMarshalledProperties() );
+    this->setDataStructure( 
+        dynamic_cast<DataStructure*>( 
+            srcPtr->getDataStructure()->cloneDataStructure() ) );
+    this->setTargetConsumerId( 
+        dynamic_cast<ConsumerId*>( 
+            srcPtr->getTargetConsumerId()->cloneDataStructure() ) );
+    this->setCompressed( srcPtr->getCompressed() );
+    this->setRedeliveryCounter( srcPtr->getRedeliveryCounter() );
+    for( size_t ibrokerPath = 0; ibrokerPath < srcPtr->getBrokerPath().size(); ++ibrokerPath ) {
+        this->getBrokerPath().push_back( 
+            srcPtr->getBrokerPath()[ibrokerPath]->cloneDataStructure() );
     }
-    dest->setArrival( this->getArrival()->clone() );
-    dest->setUserID( this->getUserID() );
-    dest->setRecievedByDFBridge( this->getRecievedByDFBridge()->clone() );
-    dest->setDroppable( this->getDroppable()->clone() );
+    this->setArrival( srcPtr->getArrival() );
+    this->setUserID( srcPtr->getUserID() );
+    this->setRecievedByDFBridge( srcPtr->getRecievedByDFBridge() );
+    this->setDroppable( srcPtr->getDroppable() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/Message.h Sun Nov 12 16:46:23 2006
@@ -104,14 +104,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual Message* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( Message* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ProducerId* getProducerId() const;
         virtual ProducerId* getProducerId();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/MessageAck.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -55,36 +57,46 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageAck* MessageAck::clone() const {
+DataStructure* MessageAck::cloneDataStructure() const {
     MessageAck* messageAck = new MessageAck();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( messageAck );
+    messageAck->copyDataStructure( this );
 
-    messageAck->destination = this->getDestination();
-    messageAck->transactionId = this->getTransactionId();
-    messageAck->consumerId = this->getConsumerId();
-    messageAck->ackType = this->getAckType()->clone();
-    messageAck->firstMessageId = this->getFirstMessageId();
-    messageAck->lastMessageId = this->getLastMessageId();
-    messageAck->messageCount = this->getMessageCount()->clone();
-
-    return messageAck
+    return messageAck;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageAck::copy( MessageAck* dest ) const {
+void MessageAck::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( messageAck );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
+
+    const MessageAck* srcPtr = dynamic_cast<const MessageAck*>( src );
 
-    dest->setDestination( this->getDestination() );
-    dest->setTransactionId( this->getTransactionId() );
-    dest->setConsumerId( this->getConsumerId() );
-    dest->setAckType( this->getAckType()->clone() );
-    dest->setFirstMessageId( this->getFirstMessageId() );
-    dest->setLastMessageId( this->getLastMessageId() );
-    dest->setMessageCount( this->getMessageCount()->clone() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "MessageAck::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setTransactionId( 
+        dynamic_cast<TransactionId*>( 
+            srcPtr->getTransactionId()->cloneDataStructure() ) );
+    this->setConsumerId( 
+        dynamic_cast<ConsumerId*>( 
+            srcPtr->getConsumerId()->cloneDataStructure() ) );
+    this->setAckType( srcPtr->getAckType() );
+    this->setFirstMessageId( 
+        dynamic_cast<MessageId*>( 
+            srcPtr->getFirstMessageId()->cloneDataStructure() ) );
+    this->setLastMessageId( 
+        dynamic_cast<MessageId*>( 
+            srcPtr->getLastMessageId()->cloneDataStructure() ) );
+    this->setMessageCount( srcPtr->getMessageCount() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageAck.h Sun Nov 12 16:46:23 2006
@@ -80,14 +80,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual MessageAck* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( MessageAck* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ActiveMQDestination* getDestination() const;
         virtual ActiveMQDestination* getDestination();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/MessageDispatch.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -50,30 +52,39 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageDispatch* MessageDispatch::clone() const {
+DataStructure* MessageDispatch::cloneDataStructure() const {
     MessageDispatch* messageDispatch = new MessageDispatch();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( messageDispatch );
+    messageDispatch->copyDataStructure( this );
 
-    messageDispatch->consumerId = this->getConsumerId();
-    messageDispatch->destination = this->getDestination();
-    messageDispatch->message = this->getMessage();
-    messageDispatch->redeliveryCounter = this->getRedeliveryCounter()->clone();
-
-    return messageDispatch
+    return messageDispatch;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatch::copy( MessageDispatch* dest ) const {
+void MessageDispatch::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( messageDispatch );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
+
+    const MessageDispatch* srcPtr = dynamic_cast<const MessageDispatch*>( src );
 
-    dest->setConsumerId( this->getConsumerId() );
-    dest->setDestination( this->getDestination() );
-    dest->setMessage( this->getMessage() );
-    dest->setRedeliveryCounter( this->getRedeliveryCounter()->clone() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "MessageDispatch::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setConsumerId( 
+        dynamic_cast<ConsumerId*>( 
+            srcPtr->getConsumerId()->cloneDataStructure() ) );
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setMessage( 
+        dynamic_cast<Message*>( 
+            srcPtr->getMessage()->cloneDataStructure() ) );
+    this->setRedeliveryCounter( srcPtr->getRedeliveryCounter() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatch.h Sun Nov 12 16:46:23 2006
@@ -75,14 +75,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual MessageDispatch* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( MessageDispatch* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ConsumerId* getConsumerId() const;
         virtual ConsumerId* getConsumerId();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/MessageDispatchNotification.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -50,30 +52,39 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageDispatchNotification* MessageDispatchNotification::clone() const {
+DataStructure* MessageDispatchNotification::cloneDataStructure() const {
     MessageDispatchNotification* messageDispatchNotification = new MessageDispatchNotification();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( messageDispatchNotification );
+    messageDispatchNotification->copyDataStructure( this );
 
-    messageDispatchNotification->consumerId = this->getConsumerId();
-    messageDispatchNotification->destination = this->getDestination();
-    messageDispatchNotification->deliverySequenceId = this->getDeliverySequenceId()->clone();
-    messageDispatchNotification->messageId = this->getMessageId();
-
-    return messageDispatchNotification
+    return messageDispatchNotification;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageDispatchNotification::copy( MessageDispatchNotification* dest ) const {
+void MessageDispatchNotification::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( messageDispatchNotification );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
+
+    const MessageDispatchNotification* srcPtr = dynamic_cast<const MessageDispatchNotification*>( src );
 
-    dest->setConsumerId( this->getConsumerId() );
-    dest->setDestination( this->getDestination() );
-    dest->setDeliverySequenceId( this->getDeliverySequenceId()->clone() );
-    dest->setMessageId( this->getMessageId() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "MessageDispatchNotification::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setConsumerId( 
+        dynamic_cast<ConsumerId*>( 
+            srcPtr->getConsumerId()->cloneDataStructure() ) );
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setDeliverySequenceId( srcPtr->getDeliverySequenceId() );
+    this->setMessageId( 
+        dynamic_cast<MessageId*>( 
+            srcPtr->getMessageId()->cloneDataStructure() ) );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageDispatchNotification.h Sun Nov 12 16:46:23 2006
@@ -75,14 +75,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual MessageDispatchNotification* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( MessageDispatchNotification* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ConsumerId* getConsumerId() const;
         virtual ConsumerId* getConsumerId();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/MessageId.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -47,28 +49,34 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessageId* MessageId::clone() const {
+DataStructure* MessageId::cloneDataStructure() const {
     MessageId* messageId = new MessageId();
 
     // Copy the data from the base class or classes
-    BaseDataStructure::copy( messageId );
+    messageId->copyDataStructure( this );
 
-    messageId->producerId = this->getProducerId();
-    messageId->producerSequenceId = this->getProducerSequenceId()->clone();
-    messageId->brokerSequenceId = this->getBrokerSequenceId()->clone();
-
-    return messageId
+    return messageId;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessageId::copy( MessageId* dest ) const {
+void MessageId::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseDataStructure::copy( messageId );
+    // Copy the data of the base class or classes
+    BaseDataStructure::copyDataStructure( src );
+
+    const MessageId* srcPtr = dynamic_cast<const MessageId*>( src );
 
-    dest->setProducerId( this->getProducerId() );
-    dest->setProducerSequenceId( this->getProducerSequenceId()->clone() );
-    dest->setBrokerSequenceId( this->getBrokerSequenceId()->clone() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "MessageId::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setProducerId( 
+        dynamic_cast<ProducerId*>( 
+            srcPtr->getProducerId()->cloneDataStructure() ) );
+    this->setProducerSequenceId( srcPtr->getProducerSequenceId() );
+    this->setBrokerSequenceId( srcPtr->getBrokerSequenceId() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.h?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessageId.h Sun Nov 12 16:46:23 2006
@@ -72,14 +72,14 @@
          * caller now owns, this will be an exact copy of this one
          * @returns new copy of this object.
          */
-        virtual MessageId* clone() const;
+        virtual DataStructure* cloneDataStructure() const;
 
         /**
-         * Copy the contents of this object and place them into the
-         * instance of this object type that was passed in.
-         * @return dest - Destination Object
+         * Copy the contents of the passed object into this objects
+         * members, overwriting any existing data.
+         * @return src - Source Object
          */
-        virtual void clone( MessageId* dest ) const;
+        virtual void copyDataStructure( const DataStructure* src );
 
         virtual const ProducerId* getProducerId() const;
         virtual ProducerId* getProducerId();

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessagePull.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessagePull.cpp?view=diff&rev=474108&r1=474107&r2=474108
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessagePull.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/MessagePull.cpp Sun Nov 12 16:46:23 2006
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 #include <activemq/connector/openwire/commands/MessagePull.h>
+#include <activemq/exceptions/NullPointerException.h>
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::exceptions;
 using namespace activemq::connector;
 using namespace activemq::connector::openwire;
 using namespace activemq::connector::openwire::commands;
@@ -48,28 +50,36 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-MessagePull* MessagePull::clone() const {
+DataStructure* MessagePull::cloneDataStructure() const {
     MessagePull* messagePull = new MessagePull();
 
     // Copy the data from the base class or classes
-    BaseCommand::copy( messagePull );
+    messagePull->copyDataStructure( this );
 
-    messagePull->consumerId = this->getConsumerId();
-    messagePull->destination = this->getDestination();
-    messagePull->timeout = this->getTimeout()->clone();
-
-    return messagePull
+    return messagePull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void MessagePull::copy( MessagePull* dest ) const {
+void MessagePull::copyDataStructure( const DataStructure* src ) {
 
-    // Copy the data from the base class or classes
-    BaseCommand::copy( messagePull );
+    // Copy the data of the base class or classes
+    BaseCommand::copyDataStructure( src );
+
+    const MessagePull* srcPtr = dynamic_cast<const MessagePull*>( src );
 
-    dest->setConsumerId( this->getConsumerId() );
-    dest->setDestination( this->getDestination() );
-    dest->setTimeout( this->getTimeout()->clone() );
+    if( srcPtr == NULL || src == NULL ) {
+    
+        throw exceptions::NullPointerException(
+            __FILE__, __LINE__,
+            "MessagePull::copyDataStructure - src is NULL or invalid" );
+    }
+    this->setConsumerId( 
+        dynamic_cast<ConsumerId*>( 
+            srcPtr->getConsumerId()->cloneDataStructure() ) );
+    this->setDestination( 
+        dynamic_cast<ActiveMQDestination*>( 
+            srcPtr->getDestination()->cloneDataStructure() ) );
+    this->setTimeout( srcPtr->getTimeout() );
 }
 
 ////////////////////////////////////////////////////////////////////////////////



Mime
View raw message