You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/01/11 21:22:43 UTC
svn commit: r733509 [3/33] - in
/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire: ./
marshal/ marshal/v1/ marshal/v2/ marshal/v3/ utils/
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,622 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_BASEDATASTREAMMARSHALLER_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_BASEDATASTREAMMARSHALLER_H_
+
+#include <activemq/wireformat/openwire/marshal/DataStreamMarshaller.h>
+#include <activemq/wireformat/openwire/utils/HexTable.h>
+#include <activemq/commands/MessageId.h>
+#include <activemq/commands/ProducerId.h>
+#include <activemq/commands/TransactionId.h>
+#include <activemq/util/Config.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace marshal{
+
+ /**
+ * Base class for all Marshallers that marshal DataStructures to and
+ * from the wire using the OpenWire protocal.
+ */
+ class AMQCPP_API BaseDataStreamMarshaller : public DataStreamMarshaller {
+ private:
+
+ // Table for converting bytes to Hex Strings.
+ static utils::HexTable hexTable;
+
+ public:
+
+ virtual ~BaseDataStreamMarshaller() {}
+
+ /**
+ * Tight Marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Marshal
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshal1( OpenWireFormat* format AMQCPP_UNUSED,
+ commands::DataStructure* command AMQCPP_UNUSED,
+ utils::BooleanStream* bs AMQCPP_UNUSED )
+ throw ( decaf::io::IOException ) { return 0; }
+
+ /**
+ * Tight Marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Marshal
+ * @param ds - the DataOutputStream to Marshal to
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshal2( OpenWireFormat* format AMQCPP_UNUSED,
+ commands::DataStructure* command AMQCPP_UNUSED,
+ decaf::io::DataOutputStream* ds AMQCPP_UNUSED,
+ utils::BooleanStream* bs AMQCPP_UNUSED )
+ throw ( decaf::io::IOException ) {}
+
+ /**
+ * Tight Un-marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Un-Marshal
+ * @param dis - the DataInputStream to Un-Marshal from
+ * @param bs - boolean stream to unmarshal from.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightUnmarshal( OpenWireFormat* format AMQCPP_UNUSED,
+ commands::DataStructure* command AMQCPP_UNUSED,
+ decaf::io::DataInputStream* dis AMQCPP_UNUSED,
+ utils::BooleanStream* bs AMQCPP_UNUSED )
+ throw ( decaf::io::IOException ) {}
+
+ /**
+ * Tight Marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Marshal
+ * @param ds - DataOutputStream to marshal to
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshal( OpenWireFormat* format AMQCPP_UNUSED,
+ commands::DataStructure* command AMQCPP_UNUSED,
+ decaf::io::DataOutputStream* ds AMQCPP_UNUSED )
+ throw ( decaf::io::IOException ) {}
+
+ /**
+ * Loose Un-marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Un-Marshal
+ * @param dis - the DataInputStream to Un-Marshal from
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseUnmarshal( OpenWireFormat* format AMQCPP_UNUSED,
+ commands::DataStructure* command AMQCPP_UNUSED,
+ decaf::io::DataInputStream* dis AMQCPP_UNUSED )
+ throw ( decaf::io::IOException ) {}
+
+ public: // Statics
+
+ /**
+ * Converts the object to a String
+ * @param id - MessageId pointer
+ * @returns string representing the id
+ */
+ static std::string toString( const commands::MessageId* id );
+
+ /**
+ * Converts the object to a String
+ * @param id - ProducerId pointer
+ * @returns string representing the id
+ */
+ static std::string toString( const commands::ProducerId* id );
+
+ /**
+ * Converts the given transaction ID into a String
+ * @param txnId - TransactionId poitner
+ * @returns string representation of the id
+ */
+ static std::string toString( const commands::TransactionId* txnId );
+
+ /**
+ * given an array of bytes, convert that array to a Hexidecimal
+ * coded string that represents that data.
+ * @param data - unsigned char data array pointer
+ * @returns a string coded in hex that represents the data
+ */
+ static std::string toHexFromBytes(
+ const std::vector<unsigned char>& data );
+
+ protected:
+
+ /**
+ * Tight Unmarshall the cached object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @param bs - boolean stream to marshal to.
+ * @returns pointer to a new DataStructure Object
+ * @throws IOException if an error occurs.
+ */
+ virtual commands::DataStructure* tightUnmarshalCachedObject(
+ OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs ) throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshalls the passed DataStructure based object to the passed
+ * BooleanStream returning the size of the data marshalled
+ * @param wireFormat - The OpenwireFormat properties
+ * @param data - DataStructure Object Pointer to marshal
+ * @param bs - boolean stream to marshal to.
+ * @returns size of data written.
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshalCachedObject1( OpenWireFormat* wireFormat,
+ commands::DataStructure* data,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshalls the passed DataStructure based object to the passed
+ * streams returning nothing
+ * @param wireFormat - The OpenwireFormat properties
+ * @param data - DataStructure Object Pointer to marshal
+ * @param bs - boolean stream to marshal to.
+ * @param dataOut - stream to write marshalled data to
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshalCachedObject2( OpenWireFormat* wireFormat,
+ commands::DataStructure* data,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Loosely marshalls the passed DataStructure based object to the passed
+ * stream returning nothing
+ * @param wireFormat - The OpenwireFormat properties
+ * @param data - DataStructure Object Pointer to marshal
+ * @param bs - boolean stream to marshal to.
+ * @param dataOut - stream to write marshalled data to
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshalCachedObject( OpenWireFormat* wireFormat,
+ commands::DataStructure* data,
+ decaf::io::DataOutputStream* dataOut )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Loose Unmarshall the cached object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @returns pointer to a new DataStructure Object
+ * @throws IOException if an error occurs.
+ */
+ virtual commands::DataStructure* looseUnmarshalCachedObject(
+ OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn ) throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshalls the passed DataStructure based object to the passed
+ * BooleanStream returning the size of the data marshalled
+ * @param wireFormat - The OpenwireFormat properties
+ * @param object - DataStructure Object Pointer to marshal
+ * @param bs - boolean stream to marshal to.
+ * @returns size of data written.
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshalNestedObject1( OpenWireFormat* wireFormat,
+ commands::DataStructure* object,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshalls the passed DataStructure based object to the passed
+ * streams returning nothing
+ * @param wireFormat - The OpenwireFormat properties
+ * @param object - DataStructure Object Pointer to marshal
+ * @param bs - boolean stream to marshal to.
+ * @param dataOut - stream to write marshalled data to
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshalNestedObject2( OpenWireFormat* wireFormat,
+ commands::DataStructure* object,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tight Unmarshall the nested object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @param bs - boolean stream to marshal to.
+ * @returns pointer to a new DataStructure Object
+ * @throws IOException if an error occurs.
+ */
+ virtual commands::DataStructure* tightUnmarshalNestedObject(
+ OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs ) throw ( decaf::io::IOException );
+
+ /**
+ * Loose Unmarshall the nested object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @returns pointer to a new DataStructure Object
+ * @throws IOException if an error occurs.
+ */
+ virtual commands::DataStructure* looseUnmarshalNestedObject(
+ OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn ) throw ( decaf::io::IOException );
+
+ /**
+ * Loose marshall the nested object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param object - DataStructure Object Pointer to marshal
+ * @param dataOut - stream to write marshalled data to
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshalNestedObject( OpenWireFormat* wireFormat,
+ commands::DataStructure* object,
+ decaf::io::DataOutputStream* dataOut )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Performs Tight Unmarshalling of String Objects
+ * @param dataIn - the DataInputStream to Un-Marshal from
+ * @param bs - boolean stream to unmarshal from.
+ * @returns the unmarshalled string.
+ * @throws IOException if an error occurs.
+ */
+ virtual std::string tightUnmarshalString( decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tight Marshals the String to a Booleans Stream Object, returns
+ * the marshalled size.
+ * @param value - string to marshal
+ * @param bs - BooleanStream to use.
+ * @returns size of marshalled string.
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshalString1( const std::string& value,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tight Marshals the passed string to the streams passed
+ * @param value - string to marshal
+ * @param dataOut - the DataOutputStream to Marshal to
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshalString2( const std::string& value,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Loose Marshal the String to the DataOuputStream passed
+ * @param value - string to marshal
+ * @param dataOut - stream to write marshalled form to
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshalString( const std::string value,
+ decaf::io::DataOutputStream* dataOut )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Loose Un-Marshal the String to the DataOuputStream passed
+ * @param dataIn - stream to read marshalled form from
+ * @return the unmarshalled string
+ * @throws IOException if an error occurs.
+ */
+ virtual std::string looseUnmarshalString( decaf::io::DataInputStream* dataIn )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshal the long long to the BooleanStream passed.
+ * @param wireFormat - The OpenwireFormat properties
+ * @param value - long long to marshal
+ * @param bs - boolean stream to marshal to.
+ * @returns size of data written.
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshalLong1( OpenWireFormat* wireFormat,
+ long long value,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshal the long long to the Streams passed.
+ * @param wireFormat - The OpenwireFormat properties
+ * @param value - long long to marshal
+ * @param dataOut - stream to write marshalled form to
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshalLong2( OpenWireFormat* wireFormat,
+ long long value,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tight marshal the long long type.
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @param bs - boolean stream to marshal to.
+ * @returns the unmarshalled long long
+ * @throws IOException if an error occurs.
+ */
+ virtual long long tightUnmarshalLong( OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tightly marshal the long long to the BooleanStream passed.
+ * @param wireFormat - The OpenwireFormat properties
+ * @param value - long long to marshal
+ * @param dataOut - DataOutputStream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshalLong( OpenWireFormat* wireFormat,
+ long long value,
+ decaf::io::DataOutputStream* dataOut )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Loose marshal the long long type.
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @returns the unmarshalled long long
+ * @throws IOException if an error occurs.
+ */
+ virtual long long looseUnmarshalLong( OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tight Unmarshal an array of char
+ * @param dataIn - the DataInputStream to Un-Marshal from
+ * @param bs - boolean stream to unmarshal from.
+ * @returns the unmarshalled vector of chars.
+ * @throws IOException if an error occurs.
+ */
+ virtual std::vector<unsigned char> tightUnmarshalByteArray(
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs ) throw ( decaf::io::IOException );
+
+ /**
+ * Loose Unmarshal an array of char
+ * @param dataIn - the DataInputStream to Un-Marshal from
+ * @returns the unmarshalled vector of chars.
+ * @throws IOException if an error occurs.
+ */
+ virtual std::vector<unsigned char> looseUnmarshalByteArray(
+ decaf::io::DataInputStream* dataIn ) throw ( decaf::io::IOException );
+
+ /**
+ * Tight Unmarshal a fixed size array from that data input stream
+ * and return an stl vector of char as the resultant.
+ * @param dataIn - the DataInputStream to Un-Marshal from
+ * @param bs - boolean stream to unmarshal from.
+ * @param size - size of the const array to unmarshal
+ * @returns the unmarshalled vector of chars.
+ * @throws IOException if an error occurs.
+ */
+ virtual std::vector<unsigned char> tightUnmarshalConstByteArray(
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs,
+ int size ) throw ( decaf::io::IOException );
+
+ /**
+ * Tight Unmarshal a fixed size array from that data input stream
+ * and return an stl vector of char as the resultant.
+ * @param dataIn - the DataInputStream to Un-Marshal from
+ * @param bs - boolean stream to unmarshal from.
+ * @param size - size of the const array to unmarshal
+ * @returns the unmarshalled vector of chars.
+ * @throws IOException if an error occurs.
+ */
+ virtual std::vector<unsigned char> looseUnmarshalConstByteArray(
+ decaf::io::DataInputStream* dataIn,
+ int size ) throw ( decaf::io::IOException );
+
+ /**
+ * Tight Unarshall the Error object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @param bs - boolean stream to marshal to.
+ * @returns pointer to a new DataStructure Object
+ * @throws IOException if an error occurs.
+ */
+ virtual commands::DataStructure* tightUnmarshalBrokerError(
+ OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs ) throw ( decaf::io::IOException );
+
+ /**
+ * Tight Marshall the Error object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param data - Error to Marshal
+ * @param bs - boolean stream to marshal to.
+ * @returns size of the marshalled data
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshalBrokerError1( OpenWireFormat* wireFormat,
+ commands::DataStructure* data,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tight Marshall the Error object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param data - Error to Marshal
+ * @param dataOut - stream to write marshalled data to
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshalBrokerError2( OpenWireFormat* wireFormat,
+ commands::DataStructure* data,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Loose Unarshall the Error object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param dataIn - stream to read marshalled form from
+ * @returns pointer to a new DataStructure Object
+ * @throws IOException if an error occurs.
+ */
+ virtual commands::DataStructure* looseUnmarshalBrokerError(
+ OpenWireFormat* wireFormat,
+ decaf::io::DataInputStream* dataIn ) throw ( decaf::io::IOException );
+
+ /**
+ * Tight Marshall the Error object
+ * @param wireFormat - The OpenwireFormat properties
+ * @param data - Error to Marshal
+ * @param dataOut - stream to write marshalled data to
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshalBrokerError( OpenWireFormat* wireFormat,
+ commands::DataStructure* data,
+ decaf::io::DataOutputStream* dataOut )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Tightly Marshal an array of DataStructure objects to the provided
+ * boolean stream, and return the size that the tight marshalling is
+ * going to take.
+ * @param wireFormat - The OpenwireFormat properties
+ * @param objects - array of DataStructure object pointers.
+ * @param bs - boolean stream to marshal to.
+ * @returns size of the marshalled data
+ * @throws IOException if an error occurs.
+ */
+ template<typename T>
+ int tightMarshalObjectArray1( OpenWireFormat* wireFormat,
+ std::vector<T*> objects,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException )
+ {
+ try{
+ if( !objects.empty() )
+ {
+ int rc = 0;
+ bs->writeBoolean( true );
+ rc += 2;
+ for( std::size_t i = 0; i < objects.size(); ++i ) {
+ rc += tightMarshalNestedObject1(
+ wireFormat, objects[i], bs );
+ }
+ return rc;
+
+ } else {
+ bs->writeBoolean( false );
+ return 0;
+ }
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+ }
+
+ /**
+ * Tightly Marshal an array of DataStructure objects to the provided
+ * boolean stream and data output stream
+ * @param wireFormat - The OpenwireFormat properties
+ * @param objects - array of DataStructure object pointers.
+ * @param dataOut - stream to write marshalled data to
+ * @param bs - boolean stream to marshal to.
+ * @returns size of the marshalled data
+ * @throws IOException if an error occurs.
+ */
+ template<typename T>
+ void tightMarshalObjectArray2( OpenWireFormat* wireFormat,
+ std::vector<T*> objects,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException ) {
+
+ try {
+
+ if( bs->readBoolean() ) {
+
+ dataOut->writeShort( (short)objects.size() );
+ for( std::size_t i = 0; i < objects.size(); ++i ) {
+ tightMarshalNestedObject2(
+ wireFormat, objects[i], dataOut, bs );
+ }
+ }
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+ }
+
+ /**
+ * Loosely Marshal an array of DataStructure objects to the provided
+ * boolean stream and data output stream
+ * @param wireFormat - The OpenwireFormat properties
+ * @param objects - array of DataStructure object pointers.
+ * @param dataOut - stream to write marshalled data to
+ * @returns size of the marshalled data
+ * @throws IOException if an error occurs.
+ */
+ template<typename T>
+ void looseMarshalObjectArray( OpenWireFormat* wireFormat,
+ std::vector<T*> objects,
+ decaf::io::DataOutputStream* dataOut )
+ throw ( decaf::io::IOException ) {
+
+ try {
+
+ dataOut->writeBoolean( !objects.empty() );
+ if( !objects.empty() ) {
+
+ dataOut->writeShort( (short)objects.size() );
+ for( std::size_t i = 0; i < objects.size(); ++i ) {
+ looseMarshalNestedObject(
+ wireFormat, objects[i], dataOut );
+ }
+ }
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( decaf::lang::Exception, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+ }
+
+ protected:
+
+ /**
+ * Given an DataInputStream read a know ASCII formatted string from
+ * the input and return that string
+ * @param dataIn - DataInputStream to read from
+ * @return string value read from stream
+ */
+ virtual std::string readAsciiString( decaf::io::DataInputStream* dataIn )
+ throw ( decaf::io::IOException );
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_BASEDATASTREAMMARSHALLER_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/DataStreamMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/DataStreamMarshaller.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/DataStreamMarshaller.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/DataStreamMarshaller.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_DATASTREAMMARSHALLER_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_DATASTREAMMARSHALLER_H_
+
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <decaf/io/IOException.h>
+#include <activemq/commands/DataStructure.h>
+#include <activemq/wireformat/openwire/utils/BooleanStream.h>
+#include <activemq/wireformat/openwire/OpenWireFormat.h>
+#include <activemq/util/Config.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace marshal{
+
+ /**
+ * Base class for all classes that marshal commands for Openwire
+ */
+ class AMQCPP_API DataStreamMarshaller {
+ public:
+
+ virtual ~DataStreamMarshaller() {}
+
+ /**
+ * Gets the DataStructureType that this class marshals/unmarshals
+ * @returns byte Id of this classes DataStructureType
+ */
+ virtual unsigned char getDataStructureType() const = 0;
+
+ /**
+ * Creates a new instance of the class that this class is a marshaling
+ * director for.
+ * @returns newly allocated Command
+ */
+ virtual commands::DataStructure* createObject() const = 0;
+
+ /**
+ * Tight Marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Marshal
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual int tightMarshal1( OpenWireFormat* format,
+ commands::DataStructure* command,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException ) = 0;
+
+ /**
+ * Tight Marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Marshal
+ * @param ds - the DataOutputStream to Marshal to
+ * @param bs - boolean stream to marshal to.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightMarshal2( OpenWireFormat* format,
+ commands::DataStructure* command,
+ decaf::io::DataOutputStream* ds,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException ) = 0;
+
+ /**
+ * Tight Un-marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Un-Marshal
+ * @param dis - the DataInputStream to Un-Marshal from
+ * @param bs - boolean stream to unmarshal from.
+ * @throws IOException if an error occurs.
+ */
+ virtual void tightUnmarshal( OpenWireFormat* format,
+ commands::DataStructure* command,
+ decaf::io::DataInputStream* dis,
+ utils::BooleanStream* bs )
+ throw ( decaf::io::IOException ) = 0;
+
+ /**
+ * Tight Marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Marshal
+ * @param ds - DataOutputStream to marshal to
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseMarshal( OpenWireFormat* format,
+ commands::DataStructure* command,
+ decaf::io::DataOutputStream* ds )
+ throw ( decaf::io::IOException ) = 0;
+
+ /**
+ * Loose Un-marhsal to the given stream
+ * @param format - The OpenwireFormat properties
+ * @param command - the object to Un-Marshal
+ * @param dis - the DataInputStream to Un-Marshal from
+ * @throws IOException if an error occurs.
+ */
+ virtual void looseUnmarshal( OpenWireFormat* format,
+ commands::DataStructure* command,
+ decaf::io::DataInputStream* dis )
+ throw ( decaf::io::IOException ) = 0;
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_DATASTREAMMARSHALLER_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/DataStreamMarshaller.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,364 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "PrimitiveMapMarshaller.h"
+
+#include <decaf/io/ByteArrayInputStream.h>
+#include <decaf/io/ByteArrayOutputStream.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <activemq/wireformat/openwire/utils/OpenwireStringSupport.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::utils;
+using namespace activemq::wireformat::openwire::marshal;
+using namespace decaf;
+using namespace decaf::io;
+using namespace decaf::lang;
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::marshal( const activemq::util::PrimitiveMap* map,
+ std::vector<unsigned char>& dest )
+ throw ( cms::CMSException ) {
+
+ try {
+
+ ByteArrayOutputStream bytesOut( dest );
+ DataOutputStream dataOut( &bytesOut );
+
+ if( map == NULL ) {
+ dataOut.writeInt( -1 );
+ } else {
+ PrimitiveMapMarshaller::marshalPrimitiveMap( dataOut, *map );
+ }
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+PrimitiveMap* PrimitiveMapMarshaller::unmarshal(
+ const std::vector<unsigned char>& src )
+ throw ( cms::CMSException ) {
+
+ try{
+
+ ByteArrayInputStream bytesIn( src );
+ DataInputStream dataIn( &bytesIn );
+
+ int size = dataIn.readInt();
+
+ if( size > 0 ) {
+ PrimitiveMap* map = new PrimitiveMap;
+
+ for( int i=0; i < size; i++ ) {
+ std::string key = OpenwireStringSupport::readString( dataIn );
+ map->setValue( key, unmarshalPrimitive( dataIn ) );
+ }
+
+ return map;
+ }
+
+ return NULL;
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::unmarshal(
+ activemq::util::PrimitiveMap* map,
+ const std::vector<unsigned char>& src ) throw ( cms::CMSException ) {
+
+ try {
+
+ if( map == NULL || src.empty() ) {
+ return;
+ }
+
+ // Clear old data
+ map->clear();
+
+ ByteArrayInputStream bytesIn( src );
+ DataInputStream dataIn( &bytesIn );
+ PrimitiveMapMarshaller::unmarshalPrimitiveMap( dataIn, *map );
+ }
+ AMQ_CATCH_RETHROW( ActiveMQException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+ AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::marshalPrimitiveMap(
+ decaf::io::DataOutputStream& dataOut,
+ const decaf::util::Map<std::string, PrimitiveValueNode>& map )
+ throw ( decaf::io::IOException ) {
+
+ try{
+
+ dataOut.writeInt( (int)map.size() );
+
+ std::vector<std::string> keys = map.getKeys();
+ std::vector<std::string>::const_iterator iter = keys.begin();
+
+ for(; iter != keys.end(); ++iter ) {
+
+ OpenwireStringSupport::writeString( dataOut, &(*iter) );
+ PrimitiveValueNode value = map.getValue( *iter );
+ marshalPrimitive( dataOut, value );
+ }
+ }
+ AMQ_CATCH_RETHROW( io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+ AMQ_CATCHALL_THROW( io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::marshalPrimitiveList(
+ decaf::io::DataOutputStream& dataOut,
+ const decaf::util::List<PrimitiveValueNode>& list )
+ throw ( decaf::io::IOException ) {
+
+ try{
+ dataOut.writeInt( (int)list.size() );
+
+ for( std::size_t ix = 0; ix < list.size(); ++ix ) {
+ marshalPrimitive( dataOut, list.get( ix ) );
+ }
+ }
+ AMQ_CATCH_RETHROW( io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+ AMQ_CATCHALL_THROW( io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::marshalPrimitive( io::DataOutputStream& dataOut,
+ const activemq::util::PrimitiveValueNode& value )
+ throw ( decaf::io::IOException ) {
+
+ try {
+
+ if( value.getValueType() == PrimitiveValueNode::BOOLEAN_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::BOOLEAN_TYPE );
+ dataOut.writeBoolean( value.getBool() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::BYTE_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::BYTE_TYPE );
+ dataOut.writeByte( value.getByte() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::CHAR_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::CHAR_TYPE );
+ dataOut.writeChar( value.getChar() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::SHORT_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::SHORT_TYPE );
+ dataOut.writeShort( value.getShort() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::INTEGER_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::INTEGER_TYPE );
+ dataOut.writeInt( value.getInt() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::LONG_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::LONG_TYPE );
+ dataOut.writeLong( value.getLong() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::FLOAT_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::FLOAT_TYPE );
+ dataOut.writeFloat( value.getFloat() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::DOUBLE_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::DOUBLE_TYPE );
+ dataOut.writeDouble( value.getDouble() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::BYTE_ARRAY_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::BYTE_ARRAY_TYPE );
+
+ std::vector<unsigned char> data = value.getByteArray();
+
+ dataOut.writeInt( (int)data.size() );
+ dataOut.write( data );
+
+ } else if( value.getValueType() == PrimitiveValueNode::STRING_TYPE ) {
+
+ std::string data = value.getString();
+
+ // is the string big??
+ if( data.size() > 8191 ) {
+ dataOut.writeByte( PrimitiveValueNode::BIG_STRING_TYPE );
+ } else {
+ dataOut.writeByte( PrimitiveValueNode::STRING_TYPE );
+ }
+
+ OpenwireStringSupport::writeString( dataOut, &data );
+
+ } else if( value.getValueType() == PrimitiveValueNode::LIST_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::LIST_TYPE );
+ marshalPrimitiveList( dataOut, value.getList() );
+
+ } else if( value.getValueType() == PrimitiveValueNode::MAP_TYPE ) {
+
+ dataOut.writeByte( PrimitiveValueNode::MAP_TYPE );
+ marshalPrimitiveMap( dataOut, value.getMap() );
+
+ } else {
+ throw IOException(
+ __FILE__,
+ __LINE__,
+ "Object is not a primitive: ");
+ }
+ }
+ AMQ_CATCH_RETHROW( io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+ AMQ_CATCHALL_THROW( io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::unmarshalPrimitiveMap(
+ decaf::io::DataInputStream& dataIn, PrimitiveMap& map )
+ throw ( decaf::io::IOException ) {
+
+ try{
+
+ int size = dataIn.readInt();
+
+ if( size > 0 ) {
+ for( int i=0; i < size; i++ ) {
+ std::string key = OpenwireStringSupport::readString( dataIn );
+ map.setValue( key, unmarshalPrimitive( dataIn ) );
+ }
+ }
+ }
+ AMQ_CATCH_RETHROW( io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+ AMQ_CATCHALL_THROW( io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void PrimitiveMapMarshaller::unmarshalPrimitiveList(
+ decaf::io::DataInputStream& dataIn,
+ decaf::util::List<PrimitiveValueNode>& list )
+ throw ( decaf::io::IOException ) {
+
+ try{
+
+ int size = dataIn.readInt();
+ while( size-- > 0 ) {
+ list.add( unmarshalPrimitive( dataIn ) );
+ }
+ }
+ AMQ_CATCH_RETHROW( io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+ AMQ_CATCHALL_THROW( io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+PrimitiveValueNode PrimitiveMapMarshaller::unmarshalPrimitive(
+ io::DataInputStream& dataIn ) throw ( decaf::io::IOException ) {
+
+ try {
+
+ unsigned char type = dataIn.readByte();
+
+ PrimitiveValueNode value;
+
+ switch( type ) {
+
+ case PrimitiveValueNode::NULL_TYPE:
+ value.clear();
+ break;
+ case PrimitiveValueNode::BYTE_TYPE:
+ value.setByte( dataIn.readByte() );
+ break;
+ case PrimitiveValueNode::BOOLEAN_TYPE:
+ value.setBool( dataIn.readBoolean() );
+ break;
+ case PrimitiveValueNode::CHAR_TYPE:
+ value.setChar( dataIn.readChar() );
+ break;
+ case PrimitiveValueNode::SHORT_TYPE:
+ value.setShort( dataIn.readShort() );
+ break;
+ case PrimitiveValueNode::INTEGER_TYPE:
+ value.setInt( dataIn.readInt() );
+ break;
+ case PrimitiveValueNode::LONG_TYPE:
+ value.setLong( dataIn.readLong() );
+ break;
+ case PrimitiveValueNode::FLOAT_TYPE:
+ value.setFloat( dataIn.readFloat() );
+ break;
+ case PrimitiveValueNode::DOUBLE_TYPE:
+ 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 );
+ value.setByteArray( data );
+ break;
+ }
+ case PrimitiveValueNode::STRING_TYPE:
+ case PrimitiveValueNode::BIG_STRING_TYPE:
+ value.setString( OpenwireStringSupport::readString( dataIn ) );
+ break;
+ case PrimitiveValueNode::LIST_TYPE:
+ {
+ PrimitiveList list;
+ PrimitiveMapMarshaller::unmarshalPrimitiveList( dataIn, list );
+ value.setList( list );
+ break;
+ }
+ case PrimitiveValueNode::MAP_TYPE:
+ {
+ PrimitiveMap map;
+ PrimitiveMapMarshaller::unmarshalPrimitiveMap( dataIn, map );
+ value.setMap( map );
+ break;
+ }
+ default:
+ throw IOException(
+ __FILE__,
+ __LINE__,
+ "PrimitiveMapMarshaller::unmarshalPrimitive - "
+ "Unsupported data type: ");
+ }
+
+ return value;
+ }
+ AMQ_CATCH_RETHROW( io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( Exception, io::IOException )
+ AMQ_CATCHALL_THROW( io::IOException )
+}
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,150 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVEMAPMARSHALLER_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVEMAPMARSHALLER_H_
+
+#include <cms/CMSException.h>
+#include <activemq/util/Config.h>
+#include <activemq/util/PrimitiveValueNode.h>
+#include <activemq/util/PrimitiveMap.h>
+#include <activemq/util/PrimitiveList.h>
+#include <decaf/io/DataOutputStream.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/IOException.h>
+#include <string>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace marshal{
+
+ /**
+ * This class wraps the functionality needed to marshal a primitive
+ * map to the Openwire Format's expectation of what the map looks like
+ * on the wire.
+ */
+ class AMQCPP_API PrimitiveMapMarshaller {
+ public:
+
+ PrimitiveMapMarshaller() {}
+ virtual ~PrimitiveMapMarshaller() {}
+
+ /**
+ * Static Marshal of a primitive map object
+ * @param Map to Marshal
+ * @param Reference to a byte array to house the data
+ * @throws CMSException
+ */
+ static void marshal( const util::PrimitiveMap* map,
+ std::vector<unsigned char>& dest )
+ throw ( cms::CMSException );
+
+ /**
+ * Static Map Unmarshaler, takes an array of bytes and returns a
+ * new instance of a PrimitiveMap object. Caller owns the pointer.
+ * @param reference to a byte array to read data from.
+ * @return newly create PrimitiveMap with unmarshaled data.
+ */
+ static util::PrimitiveMap* unmarshal( const std::vector<unsigned char>& src )
+ throw ( cms::CMSException );
+
+ /**
+ * Static Map Unmarshaler, takes an array of bytes and returns a
+ * new instance of a PrimitiveMap object. Caller owns the pointer.
+ * @param Map to Unmarshal into
+ * @param reference to a byte array to read data from.
+ */
+ static void unmarshal( util::PrimitiveMap* map,
+ const std::vector<unsigned char>& src )
+ throw ( cms::CMSException );
+
+ protected:
+
+ /**
+ * Marshal a Map of Primitives to the given OutputStream, can result
+ * in recursive calls to this method if the map contains maps of maps.
+ * @param dataOut - the DataOutputStream to write to
+ * @param map - the ValueNode to write.
+ * @throws IOException
+ */
+ static void marshalPrimitiveMap(
+ decaf::io::DataOutputStream& dataOut,
+ const decaf::util::Map<std::string, util::PrimitiveValueNode>& map )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Marshal a List of Primitives to the given OutputStream, can result
+ * in recursive calls to this method if the list contains lists of lists.
+ * @param dataOut - the DataOutputStream to write to
+ * @param list - the ValueNode to write.
+ * @throws IOException
+ */
+ static void marshalPrimitiveList(
+ decaf::io::DataOutputStream& dataOut,
+ const decaf::util::List<util::PrimitiveValueNode>& list )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Used to Marshal the Primitive types out on the Wire.
+ * @param dataOut - the DataOutputStream to write to
+ * @param value - the ValueNode to write.
+ * @throws IOException
+ */
+ static void marshalPrimitive( decaf::io::DataOutputStream& dataOut,
+ const util::PrimitiveValueNode& value )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Unmarshals a Map of Primitives from the given InputStream, can result
+ * in recursive calls to this method if the map contains maps of maps.
+ * @param dataIn - DataInputStream to read from.
+ * @param map - the map to fill with data.
+ * @throws IOException
+ */
+ static void unmarshalPrimitiveMap(
+ decaf::io::DataInputStream& dataIn, util::PrimitiveMap& map )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Unmarshals a List of Primitives from the given InputStream, can result
+ * in recursive calls to this method if the list contains lists of lists.
+ * @param dataIn - DataInputStream to read from.
+ * @param list - the ValueNode to write.
+ * @throws IOException
+ */
+ static void unmarshalPrimitiveList(
+ decaf::io::DataInputStream& dataIn,
+ decaf::util::List<util::PrimitiveValueNode>& list )
+ throw ( decaf::io::IOException );
+
+ /**
+ * Unmarshals a Primitive Type from the stream, and returns it as a
+ * value Node.
+ * @param dataIn - DataInputStream to read from.
+ * @return a PrimitiveValueNode containing the data.
+ * @throws IOException
+ */
+ static util::PrimitiveValueNode unmarshalPrimitive(
+ decaf::io::DataInputStream& dataIn )
+ throw ( decaf::io::IOException );
+
+ };
+
+}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVEMAPMARSHALLER_H_*/
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.h>
+
+#include <activemq/commands/ActiveMQBlobMessage.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+//
+// NOTE!: This file is autogenerated - do not modify!
+// if you need to make a change, please see the Java Classes in the
+// activemq-core module
+//
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::commands;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::marshal;
+using namespace activemq::wireformat::openwire::utils;
+using namespace activemq::wireformat::openwire::marshal::v1;
+using namespace decaf;
+using namespace decaf::io;
+
+///////////////////////////////////////////////////////////////////////////////
+DataStructure* ActiveMQBlobMessageMarshaller::createObject() const {
+ return new ActiveMQBlobMessage();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQBlobMessageMarshaller::getDataStructureType() const {
+ return ActiveMQBlobMessage::ID_ACTIVEMQBLOBMESSAGE;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBlobMessageMarshaller::tightUnmarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQMessageMarshaller::tightUnmarshal( wireFormat, dataStructure, dataIn, bs );
+
+ ActiveMQBlobMessage* info =
+ dynamic_cast<ActiveMQBlobMessage*>( dataStructure );
+ info->setRemoteBlobUrl( tightUnmarshalString( dataIn, bs ) );
+ info->setMimeType( tightUnmarshalString( dataIn, bs ) );
+ info->setDeletedByBroker( bs->readBoolean() );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+int ActiveMQBlobMessageMarshaller::tightMarshal1( OpenWireFormat* wireFormat, DataStructure* dataStructure, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQBlobMessage* info =
+ dynamic_cast<ActiveMQBlobMessage*>( dataStructure );
+
+ int rc = ActiveMQMessageMarshaller::tightMarshal1( wireFormat, dataStructure, bs );
+ rc += tightMarshalString1( info->getRemoteBlobUrl(), bs );
+ rc += tightMarshalString1( info->getMimeType(), bs );
+ bs->writeBoolean( info->isDeletedByBroker() );
+
+ return rc + 0;
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBlobMessageMarshaller::tightMarshal2( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQMessageMarshaller::tightMarshal2( wireFormat, dataStructure, dataOut, bs );
+
+ ActiveMQBlobMessage* info =
+ dynamic_cast<ActiveMQBlobMessage*>( dataStructure );
+ tightMarshalString2( info->getRemoteBlobUrl(), dataOut, bs );
+ tightMarshalString2( info->getMimeType(), dataOut, bs );
+ bs->readBoolean();
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBlobMessageMarshaller::looseUnmarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQMessageMarshaller::looseUnmarshal( wireFormat, dataStructure, dataIn );
+ ActiveMQBlobMessage* info =
+ dynamic_cast<ActiveMQBlobMessage*>( dataStructure );
+ info->setRemoteBlobUrl( looseUnmarshalString( dataIn ) );
+ info->setMimeType( looseUnmarshalString( dataIn ) );
+ info->setDeletedByBroker( dataIn->readBoolean() );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBlobMessageMarshaller::looseMarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQBlobMessage* info =
+ dynamic_cast<ActiveMQBlobMessage*>( dataStructure );
+ ActiveMQMessageMarshaller::looseMarshal( wireFormat, dataStructure, dataOut );
+
+ looseMarshalString( info->getRemoteBlobUrl(), dataOut );
+ looseMarshalString( info->getMimeType(), dataOut );
+ dataOut->writeBoolean( info->isDeletedByBroker() );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V1_ACTIVEMQBLOBMESSAGEMARSHALLER_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V1_ACTIVEMQBLOBMESSAGEMARSHALLER_H_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <activemq/wireformat/openwire/marshal/v1/ActiveMQMessageMarshaller.h>
+
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <decaf/io/IOException.h>
+#include <activemq/util/Config.h>
+#include <activemq/commands/DataStructure.h>
+#include <activemq/wireformat/openwire/OpenWireFormat.h>
+#include <activemq/wireformat/openwire/utils/BooleanStream.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace marshal{
+namespace v1{
+
+ /**
+ * Marshalling code for Open Wire Format for ActiveMQBlobMessageMarshaller
+ *
+ * NOTE!: This file is autogenerated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the activemq-openwire-generator module
+ */
+ class AMQCPP_API ActiveMQBlobMessageMarshaller : public ActiveMQMessageMarshaller {
+ public:
+
+ ActiveMQBlobMessageMarshaller() {}
+ virtual ~ActiveMQBlobMessageMarshaller() {}
+
+ /**
+ * Creates a new instance of this marshalable type.
+ * @return new DataStructure object pointer caller owns it.
+ */
+ virtual commands::DataStructure* createObject() const;
+
+ /**
+ * Get the Data Structure Type that identifies this Marshaller
+ * @return byte holding the data structure type value
+ */
+ virtual unsigned char getDataStructureType() const;
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be un-marshaled
+ * @param dataIn - BinaryReader that provides that data
+ * @param bs - BooleanStream
+ */
+ virtual void tightUnmarshal( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ * @param wireFormat - describis the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param bs - BooleanStream
+ * @returns int
+ */
+ virtual int tightMarshal1( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+ /**
+ * Write a object instance to data output stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param dataOut - BinaryReader that provides that data sink
+ * @param bs - BooleanStream
+ */
+ virtual void tightMarshal2( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param dataIn - BinaryReader that provides that data source
+ */
+ virtual void looseUnmarshal( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataInputStream* dataIn ) throw( decaf::io::IOException );
+
+ /**
+ * Write a object instance to data output stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param dataOut - BinaryWriter that provides that data sink
+ */
+ virtual void looseMarshal( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataOutputStream* dataOut ) throw( decaf::io::IOException );
+
+ };
+
+}}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V1_ACTIVEMQBLOBMESSAGEMARSHALLER_H_*/
+
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBlobMessageMarshaller.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.h>
+
+#include <activemq/commands/ActiveMQBytesMessage.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+//
+// NOTE!: This file is autogenerated - do not modify!
+// if you need to make a change, please see the Java Classes in the
+// activemq-core module
+//
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::commands;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::marshal;
+using namespace activemq::wireformat::openwire::utils;
+using namespace activemq::wireformat::openwire::marshal::v1;
+using namespace decaf;
+using namespace decaf::io;
+
+///////////////////////////////////////////////////////////////////////////////
+DataStructure* ActiveMQBytesMessageMarshaller::createObject() const {
+ return new ActiveMQBytesMessage();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQBytesMessageMarshaller::getDataStructureType() const {
+ return ActiveMQBytesMessage::ID_ACTIVEMQBYTESMESSAGE;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessageMarshaller::tightUnmarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ MessageMarshaller::tightUnmarshal( wireFormat, dataStructure, dataIn, bs );
+
+ ActiveMQBytesMessage* info =
+ dynamic_cast<ActiveMQBytesMessage*>( dataStructure );
+ info->beforeUnmarshal( wireFormat );
+
+
+ info->afterUnmarshal( wireFormat );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+int ActiveMQBytesMessageMarshaller::tightMarshal1( OpenWireFormat* wireFormat, DataStructure* dataStructure, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQBytesMessage* info =
+ dynamic_cast<ActiveMQBytesMessage*>( dataStructure );
+
+ info->beforeMarshal( wireFormat );
+ int rc = MessageMarshaller::tightMarshal1( wireFormat, dataStructure, bs );
+
+ return rc + 0;
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessageMarshaller::tightMarshal2( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ MessageMarshaller::tightMarshal2( wireFormat, dataStructure, dataOut, bs );
+
+ ActiveMQBytesMessage* info =
+ dynamic_cast<ActiveMQBytesMessage*>( dataStructure );
+ info->afterMarshal( wireFormat );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessageMarshaller::looseUnmarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn ) throw( decaf::io::IOException ) {
+
+ try {
+
+ MessageMarshaller::looseUnmarshal( wireFormat, dataStructure, dataIn );
+ ActiveMQBytesMessage* info =
+ dynamic_cast<ActiveMQBytesMessage*>( dataStructure );
+ info->beforeUnmarshal( wireFormat );
+ info->afterUnmarshal( wireFormat );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQBytesMessageMarshaller::looseMarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQBytesMessage* info =
+ dynamic_cast<ActiveMQBytesMessage*>( dataStructure );
+ info->beforeMarshal( wireFormat );
+ MessageMarshaller::looseMarshal( wireFormat, dataStructure, dataOut );
+
+ info->afterMarshal( wireFormat );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.h?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.h (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.h Sun Jan 11 12:22:34 2009
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V1_ACTIVEMQBYTESMESSAGEMARSHALLER_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V1_ACTIVEMQBYTESMESSAGEMARSHALLER_H_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <activemq/wireformat/openwire/marshal/v1/MessageMarshaller.h>
+
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <decaf/io/IOException.h>
+#include <activemq/util/Config.h>
+#include <activemq/commands/DataStructure.h>
+#include <activemq/wireformat/openwire/OpenWireFormat.h>
+#include <activemq/wireformat/openwire/utils/BooleanStream.h>
+
+namespace activemq{
+namespace wireformat{
+namespace openwire{
+namespace marshal{
+namespace v1{
+
+ /**
+ * Marshalling code for Open Wire Format for ActiveMQBytesMessageMarshaller
+ *
+ * NOTE!: This file is autogenerated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the activemq-openwire-generator module
+ */
+ class AMQCPP_API ActiveMQBytesMessageMarshaller : public MessageMarshaller {
+ public:
+
+ ActiveMQBytesMessageMarshaller() {}
+ virtual ~ActiveMQBytesMessageMarshaller() {}
+
+ /**
+ * Creates a new instance of this marshalable type.
+ * @return new DataStructure object pointer caller owns it.
+ */
+ virtual commands::DataStructure* createObject() const;
+
+ /**
+ * Get the Data Structure Type that identifies this Marshaller
+ * @return byte holding the data structure type value
+ */
+ virtual unsigned char getDataStructureType() const;
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be un-marshaled
+ * @param dataIn - BinaryReader that provides that data
+ * @param bs - BooleanStream
+ */
+ virtual void tightUnmarshal( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataInputStream* dataIn,
+ utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ * @param wireFormat - describis the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param bs - BooleanStream
+ * @returns int
+ */
+ virtual int tightMarshal1( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+ /**
+ * Write a object instance to data output stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param dataOut - BinaryReader that provides that data sink
+ * @param bs - BooleanStream
+ */
+ virtual void tightMarshal2( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataOutputStream* dataOut,
+ utils::BooleanStream* bs ) throw( decaf::io::IOException );
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param dataIn - BinaryReader that provides that data source
+ */
+ virtual void looseUnmarshal( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataInputStream* dataIn ) throw( decaf::io::IOException );
+
+ /**
+ * Write a object instance to data output stream
+ * @param wireFormat - describs the wire format of the broker
+ * @param o - Object to be marshaled
+ * @param dataOut - BinaryWriter that provides that data sink
+ */
+ virtual void looseMarshal( OpenWireFormat* wireFormat,
+ commands::DataStructure* dataStructure,
+ decaf::io::DataOutputStream* dataOut ) throw( decaf::io::IOException );
+
+ };
+
+}}}}}
+
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V1_ACTIVEMQBYTESMESSAGEMARSHALLER_H_*/
+
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQBytesMessageMarshaller.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQDestinationMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQDestinationMarshaller.cpp?rev=733509&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQDestinationMarshaller.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQDestinationMarshaller.cpp Sun Jan 11 12:22:34 2009
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <activemq/wireformat/openwire/marshal/v1/ActiveMQDestinationMarshaller.h>
+
+#include <activemq/commands/ActiveMQDestination.h>
+#include <activemq/exceptions/ActiveMQException.h>
+
+//
+// NOTE!: This file is autogenerated - do not modify!
+// if you need to make a change, please see the Java Classes in the
+// activemq-core module
+//
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace activemq::commands;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::marshal;
+using namespace activemq::wireformat::openwire::utils;
+using namespace activemq::wireformat::openwire::marshal::v1;
+using namespace decaf;
+using namespace decaf::io;
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQDestinationMarshaller::tightUnmarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ BaseDataStreamMarshaller::tightUnmarshal( wireFormat, dataStructure, dataIn, bs );
+
+ ActiveMQDestination* info =
+ dynamic_cast<ActiveMQDestination*>( dataStructure );
+ info->setPhysicalName( tightUnmarshalString( dataIn, bs ) );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+int ActiveMQDestinationMarshaller::tightMarshal1( OpenWireFormat* wireFormat, DataStructure* dataStructure, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQDestination* info =
+ dynamic_cast<ActiveMQDestination*>( dataStructure );
+
+ int rc = BaseDataStreamMarshaller::tightMarshal1( wireFormat, dataStructure, bs );
+ rc += tightMarshalString1( info->getPhysicalName(), bs );
+
+ return rc + 0;
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQDestinationMarshaller::tightMarshal2( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut, BooleanStream* bs ) throw( decaf::io::IOException ) {
+
+ try {
+
+ BaseDataStreamMarshaller::tightMarshal2( wireFormat, dataStructure, dataOut, bs );
+
+ ActiveMQDestination* info =
+ dynamic_cast<ActiveMQDestination*>( dataStructure );
+ tightMarshalString2( info->getPhysicalName(), dataOut, bs );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQDestinationMarshaller::looseUnmarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataInputStream* dataIn ) throw( decaf::io::IOException ) {
+
+ try {
+
+ BaseDataStreamMarshaller::looseUnmarshal( wireFormat, dataStructure, dataIn );
+ ActiveMQDestination* info =
+ dynamic_cast<ActiveMQDestination*>( dataStructure );
+ info->setPhysicalName( looseUnmarshalString( dataIn ) );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
+///////////////////////////////////////////////////////////////////////////////
+void ActiveMQDestinationMarshaller::looseMarshal( OpenWireFormat* wireFormat, DataStructure* dataStructure, DataOutputStream* dataOut ) throw( decaf::io::IOException ) {
+
+ try {
+
+ ActiveMQDestination* info =
+ dynamic_cast<ActiveMQDestination*>( dataStructure );
+ BaseDataStreamMarshaller::looseMarshal( wireFormat, dataStructure, dataOut );
+
+ looseMarshalString( info->getPhysicalName(), dataOut );
+ }
+ AMQ_CATCH_RETHROW( decaf::io::IOException )
+ AMQ_CATCH_EXCEPTION_CONVERT( exceptions::ActiveMQException, decaf::io::IOException )
+ AMQ_CATCHALL_THROW( decaf::io::IOException )
+}
+
Propchange: activemq/activemq-cpp/trunk/src/main/activemq/wireformat/openwire/marshal/v1/ActiveMQDestinationMarshaller.cpp
------------------------------------------------------------------------------
svn:eol-style = native