You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/05/15 15:39:33 UTC
svn commit: r406628 [8/10] - in /incubator/activemq/trunk/openwire-cpp: ./
src/gram/java/org/apache/activemq/openwire/tool/ src/gram/script/
src/main/cpp/activemq/ src/main/cpp/activemq/command/
src/main/cpp/activemq/protocol/ src/main/cpp/activemq/pro...
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/TransactionInfo.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/TransactionInfo.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/TransactionInfo.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/TransactionInfo.hpp Mon May 15 06:38:57 2006
@@ -1,92 +1,93 @@
-/*
-* Copyright 2006 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef ActiveMQ_TransactionInfo_hpp_
-#define ActiveMQ_TransactionInfo_hpp_
-
-// Turn off warning message for ignored exception specification
-#ifdef _MSC_VER
-#pragma warning( disable : 4290 )
-#endif
-
-#include <string>
-#include "activemq/command/BaseCommand.hpp"
-#include "activemq/command/ConnectionId.hpp"
-#include "activemq/command/TransactionId.hpp"
-#include "activemq/protocol/IMarshaller.hpp"
-#include "ppr/io/IOutputStream.hpp"
-#include "ppr/io/IInputStream.hpp"
-#include "ppr/io/IOException.hpp"
-#include "ppr/util/ifr/array"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
- namespace activemq
- {
- namespace command
- {
- using namespace ifr;
- using namespace std;
- using namespace apache::activemq;
- using namespace apache::activemq::protocol;
- using namespace apache::ppr::io;
-
-/*
- *
- * Marshalling code for Open Wire Format for TransactionInfo
- *
- *
- * NOTE!: This file is autogenerated - do not modify!
- * if you need to make a change, please see the Groovy scripts in the
- * activemq-core module
- *
- */
-class TransactionInfo : public BaseCommand
-{
-protected:
- p<ConnectionId> connectionId ;
- p<TransactionId> transactionId ;
- char type ;
-
-public:
- const static unsigned char TYPE = 7;
-
-public:
- TransactionInfo() ;
- virtual ~TransactionInfo() ;
-
- virtual unsigned char getDataStructureType() ;
-
- virtual p<ConnectionId> getConnectionId() ;
- virtual void setConnectionId(p<ConnectionId> connectionId) ;
-
- virtual p<TransactionId> getTransactionId() ;
- virtual void setTransactionId(p<TransactionId> transactionId) ;
-
- virtual char getType() ;
- virtual void setType(char type) ;
-
- virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
- virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
-} ;
-
-/* namespace */
- }
- }
-}
-
-#endif /*ActiveMQ_TransactionInfo_hpp_*/
+/*
+* Copyright 2006 The Apache Software Foundation or its licensors, as
+* applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#ifndef ActiveMQ_TransactionInfo_hpp_
+#define ActiveMQ_TransactionInfo_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <string>
+#include "activemq/command/BaseCommand.hpp"
+#include "activemq/command/ConnectionId.hpp"
+#include "activemq/command/TransactionId.hpp"
+
+#include "activemq/protocol/IMarshaller.hpp"
+#include "ppr/io/IOutputStream.hpp"
+#include "ppr/io/IInputStream.hpp"
+#include "ppr/io/IOException.hpp"
+#include "ppr/util/ifr/array"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace command
+ {
+ using namespace ifr;
+ using namespace std;
+ using namespace apache::activemq;
+ using namespace apache::activemq::protocol;
+ using namespace apache::ppr::io;
+
+/*
+ *
+ * Command and marshalling code for OpenWire format for TransactionInfo
+ *
+ *
+ * NOTE!: This file is autogenerated - do not modify!
+ * if you need to make a change, please see the Groovy scripts in the
+ * activemq-core module
+ *
+ */
+class TransactionInfo : public BaseCommand
+{
+protected:
+ p<ConnectionId> connectionId ;
+ p<TransactionId> transactionId ;
+ char type ;
+
+public:
+ const static unsigned char TYPE = 7;
+
+public:
+ TransactionInfo() ;
+ virtual ~TransactionInfo() ;
+
+ virtual unsigned char getDataStructureType() ;
+
+ virtual p<ConnectionId> getConnectionId() ;
+ virtual void setConnectionId(p<ConnectionId> connectionId) ;
+
+ virtual p<TransactionId> getTransactionId() ;
+ virtual void setTransactionId(p<TransactionId> transactionId) ;
+
+ virtual char getType() ;
+ virtual void setType(char type) ;
+
+ virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> ostream) throw (IOException) ;
+ virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> istream) throw (IOException) ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*ActiveMQ_TransactionInfo_hpp_*/
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/WireFormatInfo.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/WireFormatInfo.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/WireFormatInfo.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/WireFormatInfo.hpp Mon May 15 06:38:57 2006
@@ -24,7 +24,7 @@
#include <string>
#include <map>
-#include "activemq/command/AbstractCommand.hpp"
+#include "activemq/command/BaseCommand.hpp"
#include "activemq/protocol/IMarshaller.hpp"
#include "ppr/io/IOutputStream.hpp"
#include "ppr/io/IInputStream.hpp"
@@ -49,7 +49,7 @@
/*
* Marshalling code for Open Wire Format for WireFormatInfo
*/
-class WireFormatInfo : public AbstractCommand
+class WireFormatInfo : public BaseCommand
{
protected:
array<char> magic ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.cpp Mon May 15 06:38:57 2006
@@ -1,95 +1,97 @@
-/*
-* Copyright 2006 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#include "activemq/command/XATransactionId.hpp"
-
-using namespace apache::activemq::command;
-
-/*
- *
- * Marshalling code for Open Wire Format for XATransactionId
- *
- *
- * NOTE!: This file is autogenerated - do not modify!
- * if you need to make a change, please see the Groovy scripts in the
- * activemq-core module
- *
- */
-XATransactionId::XATransactionId()
-{
- this->formatId = 0 ;
- this->globalTransactionId = NULL ;
- this->branchQualifier = NULL ;
-}
-
-XATransactionId::~XATransactionId()
-{
-}
-
-unsigned char XATransactionId::getDataStructureType()
-{
- return XATransactionId::TYPE ;
-}
-
-
-int XATransactionId::getFormatId()
-{
- return formatId ;
-}
-
-void XATransactionId::setFormatId(int formatId)
-{
- this->formatId = formatId ;
-}
-
-
-array<char> XATransactionId::getGlobalTransactionId()
-{
- return globalTransactionId ;
-}
-
-void XATransactionId::setGlobalTransactionId(array<char> globalTransactionId)
-{
- this->globalTransactionId = globalTransactionId ;
-}
-
-
-array<char> XATransactionId::getBranchQualifier()
-{
- return branchQualifier ;
-}
-
-void XATransactionId::setBranchQualifier(array<char> branchQualifier)
-{
- this->branchQualifier = branchQualifier ;
-}
-
-int XATransactionId::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
-{
- int size = 0 ;
-
- size += marshaller->marshalInt(formatId, mode, writer) ;
- size += marshaller->marshalByteArray(globalTransactionId, mode, writer) ;
- size += marshaller->marshalByteArray(branchQualifier, mode, writer) ;
- return size ;
-}
-
-void XATransactionId::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
-{
- formatId = (marshaller->unmarshalInt(mode, reader)) ;
- globalTransactionId = (marshaller->unmarshalByteArray(mode, reader)) ;
- branchQualifier = (marshaller->unmarshalByteArray(mode, reader)) ;
-}
+/*
+* Copyright 2006 The Apache Software Foundation or its licensors, as
+* applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#include "activemq/command/XATransactionId.hpp"
+
+using namespace apache::activemq::command;
+
+/*
+ *
+ * Command and marshalling code for OpenWire format for XATransactionId
+ *
+ *
+ * NOTE!: This file is autogenerated - do not modify!
+ * if you need to make a change, please see the Groovy scripts in the
+ * activemq-core module
+ *
+ */
+XATransactionId::XATransactionId()
+{
+ this->formatId = 0 ;
+ this->globalTransactionId = NULL ;
+ this->branchQualifier = NULL ;
+}
+
+XATransactionId::~XATransactionId()
+{
+}
+
+unsigned char XATransactionId::getDataStructureType()
+{
+ return XATransactionId::TYPE ;
+}
+
+
+int XATransactionId::getFormatId()
+{
+ return formatId ;
+}
+
+void XATransactionId::setFormatId(int formatId)
+{
+ this->formatId = formatId ;
+}
+
+
+array<char> XATransactionId::getGlobalTransactionId()
+{
+ return globalTransactionId ;
+}
+
+void XATransactionId::setGlobalTransactionId(array<char> globalTransactionId)
+{
+ this->globalTransactionId = globalTransactionId ;
+}
+
+
+array<char> XATransactionId::getBranchQualifier()
+{
+ return branchQualifier ;
+}
+
+void XATransactionId::setBranchQualifier(array<char> branchQualifier)
+{
+ this->branchQualifier = branchQualifier ;
+}
+
+int XATransactionId::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> ostream) throw (IOException)
+{
+ int size = 0 ;
+
+ size += TransactionId::marshal(marshaller, mode, ostream) ;
+ size += marshaller->marshalInt(formatId, mode, ostream) ;
+ size += marshaller->marshalByteArray(globalTransactionId, mode, ostream) ;
+ size += marshaller->marshalByteArray(branchQualifier, mode, ostream) ;
+ return size ;
+}
+
+void XATransactionId::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> istream) throw (IOException)
+{
+ TransactionId::unmarshal(marshaller, mode, istream) ;
+ formatId = (marshaller->unmarshalInt(mode, istream)) ;
+ globalTransactionId = (marshaller->unmarshalByteArray(mode, istream)) ;
+ branchQualifier = (marshaller->unmarshalByteArray(mode, istream)) ;
+}
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/command/XATransactionId.hpp Mon May 15 06:38:57 2006
@@ -1,90 +1,91 @@
-/*
-* Copyright 2006 The Apache Software Foundation or its licensors, as
-* applicable.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-#ifndef ActiveMQ_XATransactionId_hpp_
-#define ActiveMQ_XATransactionId_hpp_
-
-// Turn off warning message for ignored exception specification
-#ifdef _MSC_VER
-#pragma warning( disable : 4290 )
-#endif
-
-#include <string>
-#include "activemq/command/TransactionId.hpp"
-#include "activemq/protocol/IMarshaller.hpp"
-#include "ppr/io/IOutputStream.hpp"
-#include "ppr/io/IInputStream.hpp"
-#include "ppr/io/IOException.hpp"
-#include "ppr/util/ifr/array"
-#include "ppr/util/ifr/p"
-
-namespace apache
-{
- namespace activemq
- {
- namespace command
- {
- using namespace ifr;
- using namespace std;
- using namespace apache::activemq;
- using namespace apache::activemq::protocol;
- using namespace apache::ppr::io;
-
-/*
- *
- * Marshalling code for Open Wire Format for XATransactionId
- *
- *
- * NOTE!: This file is autogenerated - do not modify!
- * if you need to make a change, please see the Groovy scripts in the
- * activemq-core module
- *
- */
-class XATransactionId : public TransactionId
-{
-protected:
- int formatId ;
- array<char> globalTransactionId ;
- array<char> branchQualifier ;
-
-public:
- const static unsigned char TYPE = 112;
-
-public:
- XATransactionId() ;
- virtual ~XATransactionId() ;
-
- virtual unsigned char getDataStructureType() ;
-
- virtual int getFormatId() ;
- virtual void setFormatId(int formatId) ;
-
- virtual array<char> getGlobalTransactionId() ;
- virtual void setGlobalTransactionId(array<char> globalTransactionId) ;
-
- virtual array<char> getBranchQualifier() ;
- virtual void setBranchQualifier(array<char> branchQualifier) ;
-
- virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
- virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
-} ;
-
-/* namespace */
- }
- }
-}
-
-#endif /*ActiveMQ_XATransactionId_hpp_*/
+/*
+* Copyright 2006 The Apache Software Foundation or its licensors, as
+* applicable.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#ifndef ActiveMQ_XATransactionId_hpp_
+#define ActiveMQ_XATransactionId_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include <string>
+#include "activemq/command/TransactionId.hpp"
+
+#include "activemq/protocol/IMarshaller.hpp"
+#include "ppr/io/IOutputStream.hpp"
+#include "ppr/io/IInputStream.hpp"
+#include "ppr/io/IOException.hpp"
+#include "ppr/util/ifr/array"
+#include "ppr/util/ifr/p"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace command
+ {
+ using namespace ifr;
+ using namespace std;
+ using namespace apache::activemq;
+ using namespace apache::activemq::protocol;
+ using namespace apache::ppr::io;
+
+/*
+ *
+ * Command and marshalling code for OpenWire format for XATransactionId
+ *
+ *
+ * NOTE!: This file is autogenerated - do not modify!
+ * if you need to make a change, please see the Groovy scripts in the
+ * activemq-core module
+ *
+ */
+class XATransactionId : public TransactionId
+{
+protected:
+ int formatId ;
+ array<char> globalTransactionId ;
+ array<char> branchQualifier ;
+
+public:
+ const static unsigned char TYPE = 112;
+
+public:
+ XATransactionId() ;
+ virtual ~XATransactionId() ;
+
+ virtual unsigned char getDataStructureType() ;
+
+ virtual int getFormatId() ;
+ virtual void setFormatId(int formatId) ;
+
+ virtual array<char> getGlobalTransactionId() ;
+ virtual void setGlobalTransactionId(array<char> globalTransactionId) ;
+
+ virtual array<char> getBranchQualifier() ;
+ virtual void setBranchQualifier(array<char> branchQualifier) ;
+
+ virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> ostream) throw (IOException) ;
+ virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> istream) throw (IOException) ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*ActiveMQ_XATransactionId_hpp_*/
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IMarshaller.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IMarshaller.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IMarshaller.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IMarshaller.hpp Mon May 15 06:38:57 2006
@@ -49,31 +49,31 @@
const static int MARSHAL_WRITE = 2 ;
const static int MARSHAL_READ = 3 ;
- virtual int marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
+ virtual int marshalBoolean(bool value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalByte(char value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalShort(short value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalInt(int value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalLong(long long value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalFloat(float value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalDouble(double value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalString(p<string> value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> ostream) throw(IOException) = 0 ;
- virtual bool unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual char unmarshalByte(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual short unmarshalShort(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual int unmarshalInt(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual long long unmarshalLong(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual float unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual double unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual p<string> unmarshalString(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual array<char> unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
- virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
+ virtual bool unmarshalBoolean(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual char unmarshalByte(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual short unmarshalShort(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual int unmarshalInt(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual long long unmarshalLong(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual float unmarshalFloat(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual double unmarshalDouble(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual p<string> unmarshalString(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual array<char> unmarshalByteArray(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
+ virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> istream) throw(IOException) = 0 ;
} ;
/* namespace */
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IProtocol.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IProtocol.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IProtocol.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/IProtocol.hpp Mon May 15 06:38:57 2006
@@ -41,8 +41,8 @@
struct IProtocol : Interface
{
virtual void handshake(p<ITransport> transport) = 0 ;
- virtual void marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException) = 0 ;
- virtual p<IDataStructure> unmarshal(p<IInputStream> reader) throw(IOException) = 0 ;
+ virtual void marshal(p<IDataStructure> object, p<IOutputStream> ostream) throw(IOException) = 0 ;
+ virtual p<IDataStructure> unmarshal(p<IInputStream> istream) throw(IOException) = 0 ;
} ;
/* namespace */
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.cpp Mon May 15 06:38:57 2006
@@ -33,6 +33,7 @@
OpenWireMarshaller::OpenWireMarshaller(p<WireFormatInfo> formatInfo)
{
this->formatInfo = formatInfo ;
+ this->encoder = CharsetEncoderRegistry::getEncoder() ;
}
// --- Operation methods --------------------------------------------
@@ -40,12 +41,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalBoolean(bool value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeBoolean(value) ;
+ dos->writeBoolean(value) ;
return (int)BOOLSIZE ;
}
@@ -59,12 +63,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalByte(char value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeByte(value) ;
+ dos->writeByte(value) ;
return (int)sizeof(char) ;
}
@@ -78,12 +85,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalShort(short value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeShort(value) ;
+ dos->writeShort(value) ;
return (int)sizeof(short) ;
}
@@ -97,12 +107,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalInt(int value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeInt(value) ;
+ dos->writeInt(value) ;
return (int)sizeof(int) ;
}
@@ -116,12 +129,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalLong(long long value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeLong(value) ;
+ dos->writeLong(value) ;
return (int)sizeof(long long) ;
}
@@ -135,12 +151,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalFloat(float value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeFloat(value) ;
+ dos->writeFloat(value) ;
return (int)sizeof(float) ;
}
@@ -154,12 +173,15 @@
/*
*
*/
-int OpenWireMarshaller::marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalDouble(double value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
- writer->writeDouble(value) ;
+ dos->writeDouble(value) ;
return (int)sizeof(double) ;
}
@@ -173,14 +195,17 @@
/*
*
*/
-int OpenWireMarshaller::marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalString(p<string> value, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
if( mode == IMarshaller::MARSHAL_WRITE )
{
- writer->writeBoolean( value != NULL ) ;
- writer->writeString(value) ;
+ dos->writeBoolean( value != NULL ) ;
+ dos->writeString(value) ;
}
int size = 0 ;
@@ -191,7 +216,7 @@
{
// String char counter and length
size += sizeof(short) ;
- size += (int)value->length() ;
+ size += ( encoder != NULL ) ? encoder->length(value) : (int)value->length() ;
}
return size ;
}
@@ -205,8 +230,11 @@
/*
*
*/
-int OpenWireMarshaller::marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
int size = 0 ;
@@ -215,11 +243,11 @@
if( mode == IMarshaller::MARSHAL_WRITE )
{
// Null marker
- writer->writeBoolean( object != NULL ) ;
+ dos->writeBoolean( object != NULL ) ;
// Data structure type
if( object != NULL )
- writer->writeByte( object->getDataStructureType() ) ;
+ dos->writeByte( object->getDataStructureType() ) ;
}
// Length of null marker
@@ -231,7 +259,7 @@
size += sizeof(char) ;
// Marshal the command body
- size += object->marshal(smartify(this), mode, writer) ;
+ size += object->marshal(smartify(this), mode, ostream) ;
}
return size ;
}
@@ -245,8 +273,11 @@
/*
*
*/
-int OpenWireMarshaller::marshalObjectArray(array<IDataStructure> objects, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalObjectArray(array<IDataStructure> objects, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
int size = 0 ;
@@ -255,11 +286,11 @@
if( mode == IMarshaller::MARSHAL_WRITE )
{
// Null object marker
- writer->writeBoolean( objects != NULL ) ;
+ dos->writeBoolean( objects != NULL ) ;
// Check for NULL array
if( objects != NULL )
- writer->writeShort( (short)objects.size() ) ;
+ dos->writeShort( (short)objects.size() ) ;
else
return BOOLSIZE ;
}
@@ -273,7 +304,7 @@
// Write/measure each object in array
for( int i = 0; i < (int)objects.size(); i++ )
- size += objects[i]->marshal(smartify(this), mode, writer) ;
+ size += objects[i]->marshal(smartify(this), mode, ostream) ;
return size ;
}
@@ -287,8 +318,11 @@
/*
*
*/
-int OpenWireMarshaller::marshalByteArray(array<char> values, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalByteArray(array<char> values, int mode, p<IOutputStream> ostream) throw(IOException)
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
int size = 0 ;
@@ -297,7 +331,7 @@
if( mode == IMarshaller::MARSHAL_WRITE )
{
// Null marker
- writer->writeBoolean( values != NULL ) ;
+ dos->writeBoolean( values != NULL ) ;
// Check for NULL array
if( values != NULL )
@@ -306,8 +340,8 @@
int length = (int)values.size() ;
// Length and content
- writer->writeInt( length ) ;
- writer->write( values.c_array(), 0, length) ;
+ dos->writeInt( length ) ;
+ dos->write( values.c_array(), 0, length) ;
}
}
// Check for NULL array
@@ -331,7 +365,7 @@
/*
*
*/
-int OpenWireMarshaller::marshalMap(p<PropertyMap> object, int mode, p<IOutputStream> writer) throw(IOException)
+int OpenWireMarshaller::marshalMap(p<PropertyMap> object, int mode, p<IOutputStream> ostream) throw(IOException)
{
if( !formatInfo->getTightEncodingEnabled() )
{
@@ -364,7 +398,7 @@
// Add size for key char count, lenght of key and value type
size += sizeof(short) ;
- size += (int)key.length() ;
+ size += ( encoder != NULL ) ? encoder->length( p<string>( new string(key)) ) : (int)key.length() ;
size += sizeof(unsigned char) ;
// Write the map value
@@ -396,7 +430,8 @@
size += sizeof(short) ;
break ;
default:
- size += (int)val.getString()->size() ;
+ // Calculate encoded/decoded string length
+ size += ( encoder != NULL ) ? encoder->length(val.getString()) : (int)val.getString()->size() ;
}
}
}
@@ -404,15 +439,18 @@
// Write size/content of map
else if( mode == IMarshaller::MARSHAL_WRITE )
{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+
// Write 'null' marker
if( object == NULL )
{
- writer->writeInt(-1) ;
+ dos->writeInt(-1) ;
return size ;
}
// Write map item count
- writer->writeInt( (int)object->size()) ;
+ dos->writeInt( (int)object->size()) ;
// Loop through map contents
for( tempIter = object->begin() ;
@@ -425,66 +463,64 @@
key = tempIter->first ;
val = tempIter->second ;
- // Add size for key char count, lenght of key and value type
+ // Add size for key char count and value type
size += sizeof(short) ;
- size += (int)key.length() ;
size += sizeof(unsigned char) ;
- // Write the map key
- writer->writeString( p<string>( new string(tempIter->first) ) ) ;
+ // Write the map key, add size for key length
+ size += dos->writeString( p<string>( new string(tempIter->first) ) ) ;
// Write the map value
switch( val.getType() )
{
case MapItemHolder::BOOLEAN:
- writer->writeByte( TYPE_BOOLEAN ) ;
- writer->writeBoolean( val.getBoolean() ) ;
+ dos->writeByte( TYPE_BOOLEAN ) ;
+ dos->writeBoolean( val.getBoolean() ) ;
size += BOOLSIZE ;
break ;
case MapItemHolder::BYTE:
- writer->writeByte( TYPE_BYTE ) ;
- writer->writeByte( val.getByte() ) ;
+ dos->writeByte( TYPE_BYTE ) ;
+ dos->writeByte( val.getByte() ) ;
size += sizeof(char) ;
break ;
case MapItemHolder::BYTEARRAY:
- writer->writeByte( TYPE_BYTEARRAY ) ;
+ dos->writeByte( TYPE_BYTEARRAY ) ;
buffer = val.getBytes() ;
- writer->writeInt( (int)buffer.size() ) ;
- writer->write(buffer.c_array(), 0, (int)buffer.size()) ;
+ dos->writeInt( (int)buffer.size() ) ;
+ dos->write(buffer.c_array(), 0, (int)buffer.size()) ;
size += (int)buffer.size() ;
break ;
case MapItemHolder::DOUBLE:
- writer->writeByte( TYPE_DOUBLE ) ;
- writer->writeDouble( val.getDouble() ) ;
+ dos->writeByte( TYPE_DOUBLE ) ;
+ dos->writeDouble( val.getDouble() ) ;
size += sizeof(double) ;
break ;
case MapItemHolder::FLOAT:
- writer->writeByte( TYPE_FLOAT ) ;
- writer->writeFloat( val.getFloat() ) ;
+ dos->writeByte( TYPE_FLOAT ) ;
+ dos->writeFloat( val.getFloat() ) ;
size += sizeof(float) ;
break ;
case MapItemHolder::INTEGER:
- writer->writeByte( TYPE_INTEGER ) ;
- writer->writeInt( val.getInt() ) ;
+ dos->writeByte( TYPE_INTEGER ) ;
+ dos->writeInt( val.getInt() ) ;
size += sizeof(int) ;
break ;
case MapItemHolder::LONG:
- writer->writeByte( TYPE_LONG ) ;
- writer->writeLong( val.getLong() ) ;
+ dos->writeByte( TYPE_LONG ) ;
+ dos->writeLong( val.getLong() ) ;
size += sizeof(long) ;
break ;
case MapItemHolder::SHORT:
- writer->writeByte( TYPE_SHORT ) ;
- writer->writeShort( val.getShort() ) ;
+ dos->writeByte( TYPE_SHORT ) ;
+ dos->writeShort( val.getShort() ) ;
size += sizeof(short) ;
break ;
case MapItemHolder::STRING:
- writer->writeByte( TYPE_STRING ) ;
- writer->writeString( val.getString() ) ;
- size += (int)val.getString()->size() ;
+ dos->writeByte( TYPE_STRING ) ;
+ size += dos->writeString( val.getString() ) ;
break ;
default:
- writer->writeByte( TYPE_NULL ) ;
+ dos->writeByte( TYPE_NULL ) ;
}
}
}
@@ -500,11 +536,14 @@
/*
*
*/
-bool OpenWireMarshaller::unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException)
+bool OpenWireMarshaller::unmarshalBoolean(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readBoolean() ;
+ return dis->readBoolean() ;
}
else
{
@@ -516,11 +555,14 @@
/*
*
*/
-char OpenWireMarshaller::unmarshalByte(int mode, p<IInputStream> reader) throw(IOException)
+char OpenWireMarshaller::unmarshalByte(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readByte() ;
+ return dis->readByte() ;
}
else
{
@@ -531,11 +573,14 @@
/*
*
*/
-short OpenWireMarshaller::unmarshalShort(int mode, p<IInputStream> reader) throw(IOException)
+short OpenWireMarshaller::unmarshalShort(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readShort() ;
+ return dis->readShort() ;
}
else
{
@@ -547,11 +592,14 @@
/*
*
*/
-int OpenWireMarshaller::unmarshalInt(int mode, p<IInputStream> reader) throw(IOException)
+int OpenWireMarshaller::unmarshalInt(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readInt() ;
+ return dis->readInt() ;
}
else
{
@@ -563,11 +611,14 @@
/*
*
*/
-long long OpenWireMarshaller::unmarshalLong(int mode, p<IInputStream> reader) throw(IOException)
+long long OpenWireMarshaller::unmarshalLong(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readLong() ;
+ return dis->readLong() ;
}
else
{
@@ -579,11 +630,14 @@
/*
*
*/
-float OpenWireMarshaller::unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException)
+float OpenWireMarshaller::unmarshalFloat(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readFloat() ;
+ return dis->readFloat() ;
}
else
{
@@ -595,11 +649,14 @@
/*
*
*/
-double OpenWireMarshaller::unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException)
+double OpenWireMarshaller::unmarshalDouble(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- return reader->readFloat() ;
+ return dis->readFloat() ;
}
else
{
@@ -611,12 +668,15 @@
/*
*
*/
-p<string> OpenWireMarshaller::unmarshalString(int mode, p<IInputStream> reader) throw(IOException)
+p<string> OpenWireMarshaller::unmarshalString(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
- if( reader->readBoolean() )
- return reader->readString() ;
+ if( dis->readBoolean() )
+ return dis->readString() ;
else
return NULL ;
}
@@ -630,24 +690,27 @@
/*
*
*/
-p<IDataStructure> OpenWireMarshaller::unmarshalObject(int mode, p<IInputStream> reader) throw(IOException)
+p<IDataStructure> OpenWireMarshaller::unmarshalObject(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
// Null marker
- if( !reader->readBoolean() )
+ if( !dis->readBoolean() )
return NULL ;
// Read data structure
- unsigned char dataType = reader->readByte() ;
+ unsigned char dataType = dis->readByte() ;
// Create command object
- p<IDataStructure> object = AbstractCommand::createObject(dataType) ;
+ p<IDataStructure> object = BaseDataStructure::createObject(dataType) ;
if( object == NULL )
throw IOException("Unmarshal failed; unknown data structure type %d, at %s line %d", dataType, __FILE__, __LINE__) ;
// Finally, unmarshal command body
- object->unmarshal(smartify(this), IMarshaller::MARSHAL_READ, reader) ;
+ object->unmarshal(smartify(this), IMarshaller::MARSHAL_READ, istream) ;
return object ;
}
else
@@ -660,15 +723,18 @@
/*
*
*/
-array<IDataStructure> OpenWireMarshaller::unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException)
+array<IDataStructure> OpenWireMarshaller::unmarshalObjectArray(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
// Null marker
- if( !reader->readBoolean() )
+ if( !dis->readBoolean() )
return NULL ;
- int length = reader->readShort() ;
+ int length = dis->readShort() ;
// Check for NULL array
if( length == 0 )
@@ -681,7 +747,7 @@
// Unmarshal each item in array
for( int i = 0 ; i < length ; i++ )
- objects[i] = unmarshalObject(mode, reader) ;
+ objects[i] = unmarshalObject(mode, istream) ;
return objects ;
}
@@ -695,15 +761,18 @@
/*
*
*/
-array<char> OpenWireMarshaller::unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException)
+array<char> OpenWireMarshaller::unmarshalByteArray(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
// Null marker
- if( !reader->readBoolean() )
+ if( !dis->readBoolean() )
return NULL ;
- int length = reader->readInt() ;
+ int length = dis->readInt() ;
// Check for NULL array
if( length == 0 )
@@ -713,7 +782,7 @@
array<char> value (length);
// Unmarshal all bytes in array
- reader->read(value.c_array(), 0, length) ;
+ dis->read(value.c_array(), 0, length) ;
return value ;
}
@@ -727,12 +796,15 @@
/*
*
*/
-p<PropertyMap> OpenWireMarshaller::unmarshalMap(int mode, p<IInputStream> reader) throw(IOException)
+p<PropertyMap> OpenWireMarshaller::unmarshalMap(int mode, p<IInputStream> istream) throw(IOException)
{
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+
if( !formatInfo->getTightEncodingEnabled() )
{
// Get size of map
- int size = reader->readInt() ;
+ int size = dis->readInt() ;
// Check for NULL map
if( size < 0 )
@@ -750,43 +822,43 @@
for( int i = 0 ; i < size ; i++ )
{
// Get next key
- key = reader->readString() ;
+ key = dis->readString() ;
// Get the primitive type
- type = reader->readByte() ;
+ type = dis->readByte() ;
// Depending on type read next value
switch( type )
{
case TYPE_BOOLEAN:
- val = MapItemHolder( reader->readBoolean() ) ;
+ val = MapItemHolder( dis->readBoolean() ) ;
break ;
case TYPE_BYTE:
- val = MapItemHolder( reader->readByte() ) ;
+ val = MapItemHolder( dis->readByte() ) ;
break ;
case TYPE_BYTEARRAY:
- length = reader->readInt() ;
+ length = dis->readInt() ;
buffer = array<char> (length) ;
- reader->read(buffer.c_array(), 0, length) ;
+ dis->read(buffer.c_array(), 0, length) ;
val = MapItemHolder( buffer ) ;
break ;
case TYPE_DOUBLE:
- val = MapItemHolder( reader->readDouble() ) ;
+ val = MapItemHolder( dis->readDouble() ) ;
break ;
case TYPE_FLOAT:
- val = MapItemHolder( reader->readFloat() ) ;
+ val = MapItemHolder( dis->readFloat() ) ;
break ;
case TYPE_INTEGER:
- val = MapItemHolder( reader->readInt() ) ;
+ val = MapItemHolder( dis->readInt() ) ;
break ;
case TYPE_LONG:
- val = MapItemHolder( reader->readLong() ) ;
+ val = MapItemHolder( dis->readLong() ) ;
break ;
case TYPE_SHORT:
- val = MapItemHolder( reader->readShort() ) ;
+ val = MapItemHolder( dis->readShort() ) ;
break ;
case TYPE_STRING:
- val = MapItemHolder( reader->readString() ) ;
+ val = MapItemHolder( dis->readString() ) ;
break ;
default:
val = MapItemHolder() ;
@@ -801,4 +873,30 @@
// Not yet implemented (loose unmarshalling)
}
return NULL;
+}
+
+/*
+ *
+ */
+p<DataOutputStream> OpenWireMarshaller::checkOutputStream(p<IOutputStream> ostream) throw (IOException)
+{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = p_dyncast<DataOutputStream> (ostream) ;
+ if( dos == NULL )
+ throw IOException("OpenWireMarshaller requires a DataOutputStream") ;
+
+ return dos ;
+}
+
+/*
+ *
+ */
+p<DataInputStream> OpenWireMarshaller::checkInputStream(p<IInputStream> istream) throw (IOException)
+{
+ // Assert that supplied output stream is a data output stream
+ p<DataInputStream> dis = p_dyncast<DataInputStream> (istream) ;
+ if( dis == NULL )
+ throw IOException("OpenWireMarshaller requires a DataInputStream") ;
+
+ return dis ;
}
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireMarshaller.hpp Mon May 15 06:38:57 2006
@@ -25,13 +25,15 @@
#include <string>
#include <map>
#include "activemq/IDataStructure.hpp"
-#include "activemq/command/AbstractCommand.hpp"
+#include "activemq/command/BaseDataStructure.hpp"
#include "activemq/command/WireFormatInfo.hpp"
#include "activemq/protocol/IMarshaller.hpp"
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
#include "ppr/io/DataOutputStream.hpp"
#include "ppr/io/DataInputStream.hpp"
#include "ppr/io/IOException.hpp"
+#include "ppr/io/encoding/CharsetEncoderRegistry.hpp"
+#include "ppr/io/encoding/ICharsetEncoder.hpp"
#include "ppr/util/MapItemHolder.hpp"
#include "ppr/util/ifr/array"
#include "ppr/util/ifr/p"
@@ -49,6 +51,7 @@
using namespace apache::activemq::command;
using namespace apache::activemq::protocol;
using namespace apache::ppr::io;
+ using namespace apache::ppr::io::encoding;
using namespace apache::ppr::util;
/*
@@ -57,7 +60,8 @@
class OpenWireMarshaller : public IMarshaller
{
private:
- p<WireFormatInfo> formatInfo ;
+ p<WireFormatInfo> formatInfo ;
+ p<ICharsetEncoder> encoder ;
public:
// Primitive types
@@ -76,31 +80,35 @@
public:
OpenWireMarshaller(p<WireFormatInfo> formatInfo) ;
- virtual int marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> writer) throw(IOException) ;
- virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> writer) throw(IOException) ;
-
- virtual bool unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual char unmarshalByte(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual short unmarshalShort(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual int unmarshalInt(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual long long unmarshalLong(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual float unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual double unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual p<string> unmarshalString(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual array<char> unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException) ;
- virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> reader) throw(IOException) ;
+ virtual int marshalBoolean(bool value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalByte(char value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalShort(short value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalInt(int value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalLong(long long value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalFloat(float value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalDouble(double value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalString(p<string> value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+ virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> ostream) throw(IOException) ;
+
+ virtual bool unmarshalBoolean(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual char unmarshalByte(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual short unmarshalShort(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual int unmarshalInt(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual long long unmarshalLong(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual float unmarshalFloat(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual double unmarshalDouble(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual p<string> unmarshalString(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual array<char> unmarshalByteArray(int mode, p<IInputStream> istream) throw(IOException) ;
+ virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> istream) throw(IOException) ;
+
+protected:
+ p<DataOutputStream> checkOutputStream(p<IOutputStream> ostream) throw (IOException) ;
+ p<DataInputStream> checkInputStream(p<IInputStream> istream) throw (IOException) ;
} ;
/* namespace */
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.cpp Mon May 15 06:38:57 2006
@@ -75,9 +75,11 @@
/*
*
*/
-void OpenWireProtocol::marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException)
+void OpenWireProtocol::marshal(p<IDataStructure> object, p<IOutputStream> ostream) throw(IOException)
{
- int size = 0 ;
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = checkOutputStream(ostream) ;
+ int size = 0 ;
// Was a non-NULL object supplied
if( object != NULL )
@@ -88,14 +90,14 @@
if( !wireFormatInfo->getSizePrefixDisabled() )
{
size = 1 ; // data structure type
- size += object->marshal(wireMarshaller, IMarshaller::MARSHAL_SIZE, writer) ;
+ size += object->marshal(wireMarshaller, IMarshaller::MARSHAL_SIZE, ostream) ;
// Write size header
- writer->writeInt(size) ;
+ dos->writeInt(size) ;
}
// Finally, write command type and body
- writer->writeByte(dataType) ;
- object->marshal(wireMarshaller, IMarshaller::MARSHAL_WRITE, writer) ;
+ dos->writeByte(dataType) ;
+ object->marshal(wireMarshaller, IMarshaller::MARSHAL_WRITE, ostream) ;
}
else // ...NULL object
{
@@ -106,37 +108,65 @@
size = 1 ; // data structure type
// Write size header
- writer->writeInt(size) ;
+ dos->writeInt(size) ;
}
// Write NULL command type and empty body
- writer->writeByte(NULL_TYPE) ;
+ dos->writeByte(NULL_TYPE) ;
}
}
/*
*
*/
-p<IDataStructure> OpenWireProtocol::unmarshal(p<IInputStream> reader) throw(IOException)
+p<IDataStructure> OpenWireProtocol::unmarshal(p<IInputStream> istream) throw(IOException)
{
- int size = 0 ;
+ // Assert that supplied input stream is a data input stream
+ p<DataInputStream> dis = checkInputStream(istream) ;
+ int size = 0 ;
// Read packet size if configured
if( !wireFormatInfo->getSizePrefixDisabled() )
- size = reader->readInt() ;
+ size = dis->readInt() ;
// First byte is the data structure type
- unsigned char dataType = reader->readByte() ;
+ unsigned char dataType = dis->readByte() ;
// Check for NULL type
if( dataType == NULL_TYPE )
return NULL ;
// Create command object
- p<IDataStructure> object = AbstractCommand::createObject(dataType) ;
+ p<IDataStructure> object = BaseDataStructure::createObject(dataType) ;
if( object == NULL )
throw IOException("Unmarshal failed; unknown data structure type %d, at %s line %d", dataType, __FILE__, __LINE__) ;
// Finally, unmarshal command body
- object->unmarshal(wireMarshaller, IMarshaller::MARSHAL_READ, reader) ;
+ object->unmarshal(wireMarshaller, IMarshaller::MARSHAL_READ, istream) ;
return object ;
+}
+
+/*
+ *
+ */
+p<DataOutputStream> OpenWireProtocol::checkOutputStream(p<IOutputStream> ostream) throw (IOException)
+{
+ // Assert that supplied output stream is a data output stream
+ p<DataOutputStream> dos = p_dyncast<DataOutputStream> (ostream) ;
+ if( dos == NULL )
+ throw IOException("OpenWireProtocol requires a DataOutputStream") ;
+
+ return dos ;
+}
+
+/*
+ *
+ */
+p<DataInputStream> OpenWireProtocol::checkInputStream(p<IInputStream> istream) throw (IOException)
+{
+ // Assert that supplied output stream is a data output stream
+ p<DataInputStream> dis = p_dyncast<DataInputStream> (istream) ;
+ if( dis == NULL )
+ throw IOException("OpenWireProtocol requires a DataInputStream") ;
+
+ return dis ;
}
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/protocol/openwire/OpenWireProtocol.hpp Mon May 15 06:38:57 2006
@@ -27,6 +27,8 @@
#include "activemq/protocol/IProtocol.hpp"
#include "ppr/io/IOutputStream.hpp"
#include "ppr/io/IInputStream.hpp"
+#include "ppr/io/DataInputStream.hpp"
+#include "ppr/io/DataOutputStream.hpp"
#include "ppr/io/IOException.hpp"
#include "ppr/util/ifr/array"
#include "ppr/util/ifr/p"
@@ -68,8 +70,12 @@
virtual bool getStackTraceEnabled() ;
virtual void handshake(p<ITransport> transport) ;
- virtual void marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException) ;
- virtual p<IDataStructure> unmarshal(p<IInputStream> reader) throw(IOException) ;
+ virtual void marshal(p<IDataStructure> object, p<IOutputStream> ostream) throw(IOException) ;
+ virtual p<IDataStructure> unmarshal(p<IInputStream> istream) throw(IOException) ;
+
+protected:
+ p<DataOutputStream> checkOutputStream(p<IOutputStream> ostream) throw (IOException) ;
+ p<DataInputStream> checkInputStream(p<IInputStream> istream) throw (IOException) ;
} ;
/* namespace */
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.cpp Mon May 15 06:38:57 2006
@@ -37,7 +37,7 @@
/*
*
*/
-void CorrelatorFilter::oneway(p<ICommand> command)
+void CorrelatorFilter::oneway(p<BaseCommand> command)
{
// Set command id and that no response is required
command->setCommandId( getNextCommandId() ) ;
@@ -49,7 +49,7 @@
/*
*
*/
-p<FutureResponse> CorrelatorFilter::asyncRequest(p<ICommand> command)
+p<FutureResponse> CorrelatorFilter::asyncRequest(p<BaseCommand> command)
{
// Set command id and that a response is required
command->setCommandId( getNextCommandId() ) ;
@@ -68,7 +68,7 @@
/*
*
*/
-p<Response> CorrelatorFilter::request(p<ICommand> command)
+p<Response> CorrelatorFilter::request(p<BaseCommand> command)
{
p<FutureResponse> future = asyncRequest(command) ;
p<Response> response = future->getResponse() ;
@@ -94,9 +94,10 @@
/*
*
*/
-void CorrelatorFilter::onCommand(p<ITransport> transport, p<ICommand> command)
+void CorrelatorFilter::onCommand(p<ITransport> transport, p<BaseCommand> command)
{
- if( command->getDataStructureType() == Response::TYPE )
+ if( command->getDataStructureType() == Response::TYPE ||
+ command->getDataStructureType() == ExceptionResponse::TYPE )
{
p<Response> response = p_cast<Response>(command) ;
p<FutureResponse> future = requestMap[response->getCorrelationId()] ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/CorrelatorFilter.hpp Mon May 15 06:38:57 2006
@@ -48,11 +48,11 @@
CorrelatorFilter(p<ITransport> next) ;
virtual ~CorrelatorFilter() {}
- virtual void oneway(p<ICommand> command) ;
- virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
- virtual p<Response> request(p<ICommand> command) ;
+ virtual void oneway(p<BaseCommand> command) ;
+ virtual p<FutureResponse> asyncRequest(p<BaseCommand> command) ;
+ virtual p<Response> request(p<BaseCommand> command) ;
- virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
+ virtual void onCommand(p<ITransport> transport, p<BaseCommand> command) ;
protected:
virtual int getNextCommandId() ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ICommandListener.hpp Mon May 15 06:38:57 2006
@@ -18,7 +18,7 @@
#define ActiveMQ_ICommandListener_hpp_
#include <exception>
-#include "activemq/ICommand.hpp"
+#include "activemq/command/BaseCommand.hpp"
#include "ppr/util/ifr/p"
namespace apache
@@ -29,7 +29,6 @@
{
using namespace ifr;
using namespace std;
- using namespace apache::activemq;
using namespace apache::activemq::command;
using namespace apache::cms;
struct ITransport;
@@ -39,7 +38,7 @@
*/
struct ICommandListener : Interface
{
- virtual void onCommand(p<ITransport> transport, p<ICommand> command) = 0 ;
+ virtual void onCommand(p<ITransport> transport, p<BaseCommand> command) = 0 ;
virtual void onError(p<ITransport> transport, exception& error) = 0 ;
} ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/ITransport.hpp Mon May 15 06:38:57 2006
@@ -18,7 +18,7 @@
#define ActiveMQ_ITransport_hpp_
#include "cms/IStartable.hpp"
-#include "activemq/ICommand.hpp"
+#include "activemq/command/BaseCommand.hpp"
#include "activemq/command/Response.hpp"
#include "activemq/transport/FutureResponse.hpp"
#include "activemq/transport/ICommandListener.hpp"
@@ -43,9 +43,9 @@
virtual void setCommandListener(p<ICommandListener> listener) = 0 ;
virtual p<ICommandListener> getCommandListener() = 0 ;
- virtual void oneway(p<ICommand> command) = 0 ;
- virtual p<FutureResponse> asyncRequest(p<ICommand> command) = 0 ;
- virtual p<Response> request(p<ICommand> command) = 0 ;
+ virtual void oneway(p<BaseCommand> command) = 0 ;
+ virtual p<FutureResponse> asyncRequest(p<BaseCommand> command) = 0 ;
+ virtual p<Response> request(p<BaseCommand> command) = 0 ;
} ;
/* namespace */
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.cpp Mon May 15 06:38:57 2006
@@ -36,7 +36,7 @@
/*
*
*/
-void LoggingFilter::oneway(p<ICommand> command)
+void LoggingFilter::oneway(p<BaseCommand> command)
{
int cmdid = command->getCommandId(),
corrid = -1 ;
@@ -48,13 +48,7 @@
// Dump log entry
printf("Sending command: cmd.id = %d, corr.id = %d, type = %s\n",
cmdid, corrid,
- AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
-
-/* cout << "Sending command: id = " <<
- command->getCommandId() <<
- ", type = " <<
- AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
- endl ;*/
+ BaseDataStructure::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
this->next->oneway(command) ;
}
@@ -65,7 +59,7 @@
/*
*
*/
-void LoggingFilter::onCommand(p<ITransport> transport, p<ICommand> command)
+void LoggingFilter::onCommand(p<ITransport> transport, p<BaseCommand> command)
{
if( command == NULL )
cout << "Received NULL command" << endl ;
@@ -81,13 +75,7 @@
// Dump log entry
printf("Received command: cmd.id = %d, corr.id = %d, type = %s\n",
cmdid, corrid,
- AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
-
-/* cout << "Recived command: id = " <<
- command->getCommandId() <<
- ", type = " <<
- AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
- endl ;*/
+ BaseDataStructure::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
}
// Forward incoming command to "real" listener
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/LoggingFilter.hpp Mon May 15 06:38:57 2006
@@ -43,9 +43,9 @@
LoggingFilter(p<ITransport> next) ;
virtual ~LoggingFilter() {}
- virtual void oneway(p<ICommand> command) ;
+ virtual void oneway(p<BaseCommand> command) ;
- virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
+ virtual void onCommand(p<ITransport> transport, p<BaseCommand> command) ;
virtual void onError(p<ITransport> transport, exception& error) ;
} ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.cpp Mon May 15 06:38:57 2006
@@ -44,7 +44,7 @@
/*
*
*/
-void MutexFilter::oneway(p<ICommand> command)
+void MutexFilter::oneway(p<BaseCommand> command)
{
// Wait for transmission lock and then transmit command
LOCKED_SCOPE (mutex) ;
@@ -54,7 +54,7 @@
/*
*
*/
-p<FutureResponse> MutexFilter::asyncRequest(p<ICommand> command)
+p<FutureResponse> MutexFilter::asyncRequest(p<BaseCommand> command)
{
// Wait for transmission lock and then transmit command
LOCKED_SCOPE (mutex) ;
@@ -64,7 +64,7 @@
/*
*
*/
-p<Response> MutexFilter::request(p<ICommand> command)
+p<Response> MutexFilter::request(p<BaseCommand> command)
{
// Wait for transmission lock and then transmit command
LOCKED_SCOPE (mutex) ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/MutexFilter.hpp Mon May 15 06:38:57 2006
@@ -43,9 +43,9 @@
MutexFilter(p<ITransport> next) ;
virtual ~MutexFilter() ;
- virtual void oneway(p<ICommand> command) ;
- virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
- virtual p<Response> request(p<ICommand> command) ;
+ virtual void oneway(p<BaseCommand> command) ;
+ virtual p<FutureResponse> asyncRequest(p<BaseCommand> command) ;
+ virtual p<Response> request(p<BaseCommand> command) ;
} ;
/* namespace */
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp Mon May 15 06:38:57 2006
@@ -53,10 +53,16 @@
socket = connect(location->host().c_str(), location->port()) ;
// Create wire protocol depending on specified query parameter
- if( uriString.find("protocol=openwire") != string::npos )
+ if( uriString.find("protocol=stomp") != string::npos )
+ throw IllegalArgumentException("The STOMP protocol is not yet implemented") ;
+ else
protocol = new OpenWireProtocol() ;
+
+ // Configure character encoding depending on specified query parameter
+ if( uriString.find("encoding=none") != string::npos )
+ CharsetEncoderRegistry::DEFAULT = NULL ;
else
- throw IllegalArgumentException("Unknown or unspecified wire protocol") ;
+ CharsetEncoderRegistry::DEFAULT = AsciiToUTF8Encoder::NAME ;
// Create transport depending on specified URI scheme
if( uriString.find("tcp://") != string::npos )
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.hpp Mon May 15 06:38:57 2006
@@ -32,6 +32,8 @@
#include "activemq/transport/CorrelatorFilter.hpp"
#include "activemq/transport/tcp/TcpTransport.hpp"
#include "ppr/IllegalArgumentException.hpp"
+#include "ppr/io/encoding/CharsetEncoderRegistry.hpp"
+#include "ppr/io/encoding/AsciiToUTF8Encoder.hpp"
#include "ppr/net/ISocket.hpp"
#include "ppr/net/Socket.hpp"
#include "ppr/net/SocketException.hpp"
@@ -50,6 +52,7 @@
using namespace apache::activemq::protocol;
using namespace apache::activemq::protocol::openwire;
using namespace apache::activemq::transport::tcp;
+ using namespace apache::ppr::io::encoding;
using namespace apache::ppr::net;
/*
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp Mon May 15 06:38:57 2006
@@ -70,7 +70,7 @@
/*
*
*/
-void TransportFilter::oneway(p<ICommand> command)
+void TransportFilter::oneway(p<BaseCommand> command)
{
this->next->oneway(command) ;
}
@@ -78,7 +78,7 @@
/*
*
*/
-p<FutureResponse> TransportFilter::asyncRequest(p<ICommand> command)
+p<FutureResponse> TransportFilter::asyncRequest(p<BaseCommand> command)
{
return this->next->asyncRequest(command) ;
}
@@ -86,7 +86,7 @@
/*
*
*/
-p<Response> TransportFilter::request(p<ICommand> command)
+p<Response> TransportFilter::request(p<BaseCommand> command)
{
return this->next->request(command) ;
}
@@ -96,7 +96,7 @@
/*
*
*/
-void TransportFilter::onCommand(p<ITransport> transport, p<ICommand> command)
+void TransportFilter::onCommand(p<ITransport> transport, p<BaseCommand> command)
{
// Forward incoming command to "real" listener
this->listener->onCommand(transport, command) ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.hpp Mon May 15 06:38:57 2006
@@ -18,6 +18,7 @@
#define ActiveMQ_TransportFilter_hpp_
#include <string>
+#include "activemq/command/BaseCommand.hpp"
#include "activemq/command/Response.hpp"
#include "activemq/transport/ITransport.hpp"
#include "ppr/InvalidOperationException.hpp"
@@ -50,11 +51,11 @@
virtual p<ICommandListener> getCommandListener() ;
virtual void start() ;
- virtual void oneway(p<ICommand> command) ;
- virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
- virtual p<Response> request(p<ICommand> command) ;
+ virtual void oneway(p<BaseCommand> command) ;
+ virtual p<FutureResponse> asyncRequest(p<BaseCommand> command) ;
+ virtual p<Response> request(p<BaseCommand> command) ;
- virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
+ virtual void onCommand(p<ITransport> transport, p<BaseCommand> command) ;
virtual void onError(p<ITransport> transport, exception& error) ;
} ;
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp?rev=406628&r1=406627&r2=406628&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp Mon May 15 06:38:57 2006
@@ -30,8 +30,8 @@
// Initialize members
this->socket = socket ;
this->protocol = wireProtocol ;
- this->reader = NULL ;
- this->writer = NULL ;
+ this->istream = NULL ;
+ this->ostream = NULL ;
this->listener = NULL ;
this->readThread = NULL ;
this->started = false ;
@@ -45,8 +45,8 @@
{
closed = true ;
readThread->join() ;
- reader->close() ;
- socket->close() ;
+ istream->close() ;
+ ostream->close() ;
}
@@ -85,8 +85,8 @@
started = true ;
// Create the I/O streams
- writer = new SocketOutputStream(socket) ;
- reader = new SocketInputStream(socket) ;
+ ostream = new DataOutputStream( new BufferedOutputStream( new SocketOutputStream(socket) ) ) ;
+ istream = new DataInputStream( new BufferedInputStream( new SocketInputStream(socket) ) ) ;
// Create and start the background read thread
readThread = new ReadThread(this) ;
@@ -100,16 +100,16 @@
/*
*
*/
-void TcpTransport::oneway(p<ICommand> command)
+void TcpTransport::oneway(p<BaseCommand> command)
{
- protocol->marshal(command, writer) ;
- writer->flush() ;
+ protocol->marshal(command, ostream) ;
+ ostream->flush() ;
}
/*
*
*/
-p<FutureResponse> TcpTransport::asyncRequest(p<ICommand> command)
+p<FutureResponse> TcpTransport::asyncRequest(p<BaseCommand> command)
{
throw InvalidOperationException("Use a CorrelatorFilter if you want to issue asynchrounous request calls.") ;
}
@@ -117,7 +117,7 @@
/*
*
*/
-p<Response> TcpTransport::request(p<ICommand> command)
+p<Response> TcpTransport::request(p<BaseCommand> command)
{
throw InvalidOperationException("Use a CorrelatorFilter if you want to issue request calls.") ;
}
@@ -133,12 +133,12 @@
// Continue loop until closed or aborted
while( !closed )
{
- p<ICommand> command = NULL ;
+ p<BaseCommand> command = NULL ;
try
{
// Read next command
- command = p_cast<ICommand> (protocol->unmarshal(reader)) ;
+ command = p_cast<BaseCommand> (protocol->unmarshal(istream)) ;
// Forward to command listener