diff --git a/openwire-cpp/.classpath b/openwire-cpp/.classpath
new file mode 100644
index 0000000000..233be1d2c4
--- /dev/null
+++ b/openwire-cpp/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/openwire-cpp/.project b/openwire-cpp/.project
new file mode 100644
index 0000000000..0676cbc96e
--- /dev/null
+++ b/openwire-cpp/.project
@@ -0,0 +1,17 @@
+
+
+ openwire-cpp
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/openwire-cpp/src/IBytesMessage.hpp b/openwire-cpp/src/IBytesMessage.hpp
new file mode 100644
index 0000000000..3c30961d5a
--- /dev/null
+++ b/openwire-cpp/src/IBytesMessage.hpp
@@ -0,0 +1,73 @@
+/*
+ * 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 IBytesMessage_hpp_
+#define IBytesMessage_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include
+#include "IMessage.hpp"
+#include "MessageEOFException.hpp"
+#include "MessageNotReadableException.hpp"
+#include "MessageNotWritableException.hpp"
+#include "util/ifr/p"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace client
+ {
+ using namespace std;
+ using namespace ifr;
+
+/*
+ *
+ */
+struct IBytesMessage //: IMessage
+{
+ virtual int getBodyLength() = 0;
+ virtual void reset() = 0 ;
+ virtual char readByte() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual int readBytes(char* buffer, int length) throw (MessageNotReadableException) = 0 ;
+ virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual int readInt() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual short readShort() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual p readUTF() throw (MessageNotReadableException, MessageEOFException) = 0 ;
+ virtual void writeBoolean(bool value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeByte(char value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeBytes(char* value, int length) throw (MessageNotWritableException) = 0 ;
+ virtual void writeDouble(double value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeFloat(float value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeInt(int value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeLong(long long value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeShort(short value) throw (MessageNotWritableException) = 0 ;
+ virtual void writeUTF(p value) throw (MessageNotWritableException) = 0 ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*IBytesMessage_hpp_*/
\ No newline at end of file
diff --git a/openwire-cpp/src/IllegalArgumentException.hpp b/openwire-cpp/src/IllegalArgumentException.hpp
new file mode 100644
index 0000000000..e4b5530fa2
--- /dev/null
+++ b/openwire-cpp/src/IllegalArgumentException.hpp
@@ -0,0 +1,49 @@
+/*
+ * 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 IllegalArgumentException_hpp_
+#define IllegalArgumentException_hpp_
+
+#include "TraceException.hpp"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace client
+ {
+ using namespace std ;
+
+/*
+ * Signals that a method has been passed an illegal or inappropriate argument.
+ */
+class IllegalArgumentException : public TraceException
+{
+public:
+ IllegalArgumentException() : TraceException()
+ { /* no-op */ } ;
+ IllegalArgumentException(const char *const& msg) : TraceException(msg)
+ { /* no-op */ } ;
+ IllegalArgumentException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+ { /* no-op */ } ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*IllegalArgumentException_hpp_*/
\ No newline at end of file
diff --git a/openwire-cpp/src/MessageEOFException.hpp b/openwire-cpp/src/MessageEOFException.hpp
new file mode 100644
index 0000000000..8ea3945a24
--- /dev/null
+++ b/openwire-cpp/src/MessageEOFException.hpp
@@ -0,0 +1,50 @@
+/*
+ * 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 MessageEOFException_hpp_
+#define MessageEOFException_hpp_
+
+#include "TraceException.hpp"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace client
+ {
+ using namespace std ;
+
+/*
+ * Signals that an unexpected end of stream has been reached when reading
+ * a message.
+ */
+class MessageEOFException : public TraceException
+{
+public:
+ MessageEOFException() : TraceException()
+ { /* no-op */ } ;
+ MessageEOFException(const char *const& msg) : TraceException(msg)
+ { /* no-op */ } ;
+ MessageEOFException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+ { /* no-op */ } ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*MessageEOFException_hpp_*/
\ No newline at end of file
diff --git a/openwire-cpp/src/MessageFormatException.hpp b/openwire-cpp/src/MessageFormatException.hpp
new file mode 100644
index 0000000000..7c2cd862d5
--- /dev/null
+++ b/openwire-cpp/src/MessageFormatException.hpp
@@ -0,0 +1,50 @@
+/*
+ * 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 MessageFormatException_hpp_
+#define MessageFormatException_hpp_
+
+#include "TraceException.hpp"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace client
+ {
+ using namespace std ;
+
+/*
+ * Signals that a client attempts to use a data type not supported by a
+ * message or attempts to read data in a message as the wrong type.
+ */
+class MessageFormatException : public TraceException
+{
+public:
+ MessageFormatException() : TraceException()
+ { /* no-op */ } ;
+ MessageFormatException(const char *const& msg) : TraceException(msg)
+ { /* no-op */ } ;
+ MessageFormatException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+ { /* no-op */ } ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*MessageFormatException_hpp_*/
\ No newline at end of file
diff --git a/openwire-cpp/src/MessageNotReadableException.hpp b/openwire-cpp/src/MessageNotReadableException.hpp
new file mode 100644
index 0000000000..11f14c9254
--- /dev/null
+++ b/openwire-cpp/src/MessageNotReadableException.hpp
@@ -0,0 +1,49 @@
+/*
+ * 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 MessageNotReadableException_hpp_
+#define MessageNotReadableException_hpp_
+
+#include "TraceException.hpp"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace client
+ {
+ using namespace std ;
+
+/*
+ * Signals that a message is in read-only mode.
+ */
+class MessageNotReadableException : public TraceException
+{
+public:
+ MessageNotReadableException() : TraceException()
+ { /* no-op */ } ;
+ MessageNotReadableException(const char *const& msg) : TraceException(msg)
+ { /* no-op */ } ;
+ MessageNotReadableException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+ { /* no-op */ } ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*MessageNotReadableException_hpp_*/
\ No newline at end of file
diff --git a/openwire-cpp/src/MessageNotWritableException.hpp b/openwire-cpp/src/MessageNotWritableException.hpp
new file mode 100644
index 0000000000..66944092cf
--- /dev/null
+++ b/openwire-cpp/src/MessageNotWritableException.hpp
@@ -0,0 +1,49 @@
+/*
+ * 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 MessageNotWritableException_hpp_
+#define MessageNotWritableException_hpp_
+
+#include "TraceException.hpp"
+
+namespace apache
+{
+ namespace activemq
+ {
+ namespace client
+ {
+ using namespace std ;
+
+/*
+ * Signals that a message is in read-only mode.
+ */
+class MessageNotWritableException : public TraceException
+{
+public:
+ MessageNotWritableException() : TraceException()
+ { /* no-op */ } ;
+ MessageNotWritableException(const char *const& msg) : TraceException(msg)
+ { /* no-op */ } ;
+ MessageNotWritableException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
+ { /* no-op */ } ;
+} ;
+
+/* namespace */
+ }
+ }
+}
+
+#endif /*MessageNotWritableException_hpp_*/
\ No newline at end of file
diff --git a/openwire-cpp/src/command/ActiveMQBytesMessage.cpp b/openwire-cpp/src/command/ActiveMQBytesMessage.cpp
new file mode 100644
index 0000000000..04c1510719
--- /dev/null
+++ b/openwire-cpp/src/command/ActiveMQBytesMessage.cpp
@@ -0,0 +1,402 @@
+/*
+ * 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 "command/ActiveMQBytesMessage.hpp"
+
+using namespace apache::activemq::client::command;
+
+/*
+ *
+ */
+ActiveMQBytesMessage::ActiveMQBytesMessage()
+{
+ this->body = new char[INITIAL_SIZE] ;
+ this->bodySize = INITIAL_SIZE ;
+ this->bodyLength = 0 ;
+ this->offset = 0 ;
+ this->readMode = false ;
+}
+
+/*
+ *
+ */
+ActiveMQBytesMessage::~ActiveMQBytesMessage()
+{
+}
+
+/*
+ *
+ */
+int ActiveMQBytesMessage::getCommandType()
+{
+ return ActiveMQBytesMessage::TYPE ;
+}
+
+/*
+ *
+ */
+int ActiveMQBytesMessage::getBodyLength()
+{
+ return bodyLength ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::reset()
+{
+ readMode = true ;
+ offset = 0 ;
+}
+
+/*
+ *
+ */
+char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ // Check for EOF offset
+ if( offset > bodySize )
+ throw MessageEOFException() ;
+
+ // Read a single byte
+ return body[offset++] ;
+}
+
+/*
+ *
+ */
+int ActiveMQBytesMessage::readBytes(char* buffer, int length) throw (MessageNotReadableException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ // Check for EOF offset
+ if( offset > bodySize )
+ return -1 ;
+
+ // Copy bytes to supplied buffer
+ for( int i = 0 ; i < length ; i++, offset++ )
+ {
+ // Check for body EOF
+ if( offset > bodySize )
+ return i ;
+
+ buffer[i] = body[offset] ;
+ }
+ return length ;
+}
+
+/*
+ *
+ */
+bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ bool value ;
+ int result ;
+
+ // Read a boolean
+ result = readBytes((char*)&value, sizeof(bool)) ;
+
+ // Check for EOF offset
+ if( result == -1 || result < sizeof(bool) )
+ throw MessageEOFException() ;
+
+ return value ;
+}
+
+/*
+ *
+ */
+double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ double value ;
+ int result ;
+
+ // Read a double
+ result = readBytes((char*)&value, sizeof(double)) ;
+
+ // Check for EOF offset
+ if( result == -1 || result < sizeof(double) )
+ throw MessageEOFException() ;
+
+ // Convert from big endian to little endian if necessary
+ return ntohd(value) ;
+}
+
+/*
+ *
+ */
+float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ float value ;
+ int result ;
+
+ // Read a float
+ result = readBytes((char*)&value, sizeof(float)) ;
+
+ // Check for EOF offset
+ if( result == -1 || result < sizeof(float) )
+ throw MessageEOFException() ;
+
+ // Convert from big endian to little endian if necessary
+ return ntohf(value) ;
+}
+
+/*
+ *
+ */
+short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ short value ;
+ int result ;
+
+ // Read a short
+ result = readBytes((char*)&value, sizeof(short)) ;
+
+ // Check for EOF offset
+ if( result == -1 || result < sizeof(short) )
+ throw MessageEOFException() ;
+
+ // Convert from big endian to little endian if necessary
+ return ntohs(value) ;
+}
+
+/*
+ *
+ */
+int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ int value ;
+ int result ;
+
+ // Read an integer
+ result = readBytes((char*)&value, sizeof(int)) ;
+
+ // Check for EOF offset
+ if( result == -1 || result < sizeof(int) )
+ throw MessageEOFException() ;
+
+ // Convert from big endian to little endian if necessary
+ return ntohi(value) ;
+}
+
+/*
+ *
+ */
+long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
+{
+ // Assert read mode
+ if( !readMode )
+ throw MessageNotReadableException() ;
+
+ long long value ;
+ int result ;
+
+ // Read a long long
+ result = readBytes((char*)&value, sizeof(long long)) ;
+
+ // Check for EOF offset
+ if( result == -1 || result < sizeof(long long) )
+ throw MessageEOFException() ;
+
+ // Convert from big endian to little endian if necessary
+ return ntohl(value) ;
+}
+
+/*
+ *
+ */
+p ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
+{
+ // TODO
+ return NULL ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Check for EOF offset
+ if( offset > bodySize )
+ expandBody() ;
+
+ // Write a single byte
+ body[offset++] = value ;
+
+ // Update content length
+ bodyLength = offset ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeBytes(char* value, int length) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Copy bytes from supplied buffer
+ for( int i = 0 ; i < length ; i++, offset++ )
+ {
+ // Check for EOF offset
+ if( offset > bodySize )
+ expandBody() ;
+
+ body[offset] = value[i] ;
+ }
+ // Update content length
+ bodyLength = offset ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write boolean
+ writeBytes((char*)&value, sizeof(bool)) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeDouble(double v) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write double, convert from little endian to big endian if necessary
+ double value = htond(v) ;
+ writeBytes((char*)&value, sizeof(double)) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeFloat(float v) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write float, convert from little endian to big endian if necessary
+ float value = htonf(v) ;
+ writeBytes((char*)&value, sizeof(float)) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeInt(int v) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write integer, convert from little endian to big endian if necessary
+ int value = htoni(v) ;
+ writeBytes((char*)&value, sizeof(int)) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeLong(long long v) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write long, convert from little endian to big endian if necessary
+ long long value = htonl(v) ;
+ writeBytes((char*)&value, sizeof(long long)) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeShort(short v) throw (MessageNotWritableException)
+{
+ // Assert write mode
+ if( readMode )
+ throw MessageNotWritableException() ;
+
+ // Write short, convert from little endian to big endian if necessary
+ short value = htons(v) ;
+ writeBytes((char*)&value, sizeof(short)) ;
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::writeUTF(p value) throw (MessageNotWritableException)
+{
+ // TODO
+}
+
+/*
+ *
+ */
+void ActiveMQBytesMessage::expandBody()
+{
+ char* newBody ;
+ int newSize = bodySize + ActiveMQBytesMessage::EXPAND_SIZE ;
+
+ // Create new body and copy current contents
+ newBody = new char[ newSize ] ;
+ memcpy(newBody, body, bodySize) ;
+
+ // Clean up and use new content body
+ delete [] body ;
+ body = newBody ;
+ bodySize = newSize ;
+}
diff --git a/openwire-cpp/src/command/ActiveMQBytesMessage.hpp b/openwire-cpp/src/command/ActiveMQBytesMessage.hpp
new file mode 100644
index 0000000000..40dacb17d2
--- /dev/null
+++ b/openwire-cpp/src/command/ActiveMQBytesMessage.hpp
@@ -0,0 +1,102 @@
+/*
+ * 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 ActiveMQBytesMessage_hpp_
+#define ActiveMQBytesMessage_hpp_
+
+// Turn off warning message for ignored exception specification
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+#include