activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r739885 [3/5] - in /activemq/activemq-blaze/trunk/src: main/java/org/apache/activeblaze/ main/java/org/apache/activeblaze/group/ main/java/org/apache/activeblaze/impl/transport/ main/java/org/apache/activeblaze/jms/ main/java/org/apache/act...
Date Sun, 01 Feb 2009 23:35:56 GMT
Added: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSession.java
URL: http://svn.apache.org/viewvc/activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSession.java?rev=739885&view=auto
==============================================================================
--- activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSession.java (added)
+++ activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSession.java Sun Feb  1 23:35:54 2009
@@ -0,0 +1,154 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activeblaze.jms;
+
+import javax.jms.Destination;
+import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.TemporaryQueue;
+
+/**
+ * Implementation of a TopicSession
+ * 
+ */
+public class BlazeJmsTopicSession extends BlazeJmsSession {
+    /**
+     * Constructor
+     * @param connection
+     * @param acknowledgementMode
+     */
+    protected BlazeJmsTopicSession(BlazeJmsConnection connection, int acknowledgementMode) {
+        super(connection, acknowledgementMode);
+    }
+
+    /**
+     * @param queue
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createBrowser(javax.jms.Queue)
+     */
+    public QueueBrowser createBrowser(Queue queue) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+
+    /**
+     * @param queue
+     * @param messageSelector
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createBrowser(javax.jms.Queue, java.lang.String)
+     */
+    public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+
+    /**
+     * @param destination
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createConsumer(javax.jms.Destination)
+     */
+    public MessageConsumer createConsumer(Destination destination) throws JMSException {
+        if (destination instanceof Queue) {
+            throw new IllegalStateException("Operation not supported by a TopicSession");
+        }
+        return super.createConsumer(destination);
+    }
+
+    /**
+     * @param destination
+     * @param messageSelector
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createConsumer(javax.jms.Destination, java.lang.String)
+     */
+    public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
+        if (destination instanceof Queue) {
+            throw new IllegalStateException("Operation not supported by a TopicSession");
+        }
+        return super.createConsumer(destination, messageSelector);
+    }
+
+    /**
+     * @param destination
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createProducer(javax.jms.Destination)
+     */
+    public MessageProducer createProducer(Destination destination) throws JMSException {
+        if (destination instanceof Queue) {
+            throw new IllegalStateException("Operation not supported by a TopicSession");
+        }
+        return super.createProducer(destination);
+    }
+
+    /**
+     * @param queueName
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createQueue(java.lang.String)
+     */
+    public Queue createQueue(String queueName) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+
+    /**
+     * @return
+     * @throws JMSException
+     * @see javax.jms.Session#createTemporaryQueue()
+     */
+    public TemporaryQueue createTemporaryQueue() throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+
+    /**
+     * @param queue
+     * @return
+     * @throws JMSException
+     * @see javax.jms.QueueSession#createReceiver(javax.jms.Queue)
+     */
+    public QueueReceiver createReceiver(Queue queue) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+
+    /**
+     * @param queue
+     * @param messageSelector
+     * @return
+     * @throws JMSException
+     * @see javax.jms.QueueSession#createReceiver(javax.jms.Queue, java.lang.String)
+     */
+    public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+
+    /**
+     * @param queue
+     * @return
+     * @throws JMSException
+     * @see javax.jms.QueueSession#createSender(javax.jms.Queue)
+     */
+    public QueueSender createSender(Queue queue) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a TopicSession");
+    }
+}

Propchange: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSubscriber.java
URL: http://svn.apache.org/viewvc/activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSubscriber.java?rev=739885&view=auto
==============================================================================
--- activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSubscriber.java (added)
+++ activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSubscriber.java Sun Feb  1 23:35:54 2009
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activeblaze.jms;
+
+import javax.jms.IllegalStateException;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+
+/**
+ * Implementation of a TopicSubscriber
+ * 
+ */
+public class BlazeJmsTopicSubscriber extends BlazeJmsMessageConsumer implements TopicSubscriber {
+    private final boolean durable;
+    private final boolean noLocal;
+    private String name;
+
+    /**
+     * Constructor
+     * 
+     * @param s
+     * @param destination
+     */
+    protected BlazeJmsTopicSubscriber(BlazeJmsSession s, BlazeJmsDestination destination, 
+            String name, boolean durable,boolean noLocal) {
+        super(s, destination);
+        this.name = name;
+        this.durable = durable;
+        this.noLocal = noLocal;
+    }
+
+    /**
+     * @return noLocak flag
+     * @throws IllegalStateException
+     * @see javax.jms.TopicSubscriber#getNoLocal()
+     */
+    public boolean getNoLocal() throws IllegalStateException {
+        checkClosed();
+        return this.noLocal;
+    }
+
+    /**
+     * @return the Topic
+     * @throws IllegalStateException
+     * @see javax.jms.TopicSubscriber#getTopic()
+     */
+    public Topic getTopic() throws IllegalStateException {
+        checkClosed();
+        return (Topic) this.destination;
+    }
+
+    /**
+     * @return the durable
+     * @throws IllegalStateException
+     */
+    public boolean isDurable() throws IllegalStateException {
+        checkClosed();
+        return this.durable;
+    }
+
+    /**
+     * @return the name
+     * @throws IllegalStateException
+     */
+    public String getName() throws IllegalStateException {
+        checkClosed();
+        return this.name;
+    }
+
+    /**
+     * @param name
+     *            the name to set
+     * @throws IllegalStateException
+     */
+    public void setName(String name) throws IllegalStateException {
+        checkClosed();
+        this.name = name;
+    }
+}

Propchange: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsTopicSubscriber.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsBytesMessage.java
URL: http://svn.apache.org/viewvc/activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsBytesMessage.java?rev=739885&view=auto
==============================================================================
--- activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsBytesMessage.java (added)
+++ activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsBytesMessage.java Sun Feb  1 23:35:54 2009
@@ -0,0 +1,786 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activeblaze.jms.message;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotReadableException;
+import javax.jms.MessageNotWriteableException;
+import org.apache.activeblaze.BlazeException;
+import org.apache.activeblaze.BlazeRuntimeException;
+import org.apache.activeblaze.jms.BlazeJmsExceptionSupport;
+import org.apache.activeblaze.wire.BlazeData;
+import org.apache.activemq.protobuf.Buffer;
+import org.apache.activemq.protobuf.BufferInputStream;
+import org.apache.activemq.protobuf.BufferOutputStream;
+
+/**
+ * A <CODE>BytesMessage</CODE> object is used to send a message containing a stream of uninterpreted bytes. It
+ * inherits from the <CODE>Message</CODE> interface and adds a bytes message body. The receiver of the message
+ * supplies the interpretation of the bytes.
+ * <P>
+ * The <CODE>BytesMessage</CODE> methods are based largely on those found in <CODE>java.io.DataInputStream</CODE>
+ * and <CODE>java.io.DataOutputStream</CODE>.
+ * <P>
+ * This message type is for client encoding of existing message formats. If possible, one of the other self-defining
+ * message types should be used instead.
+ * <P>
+ * Although the JMS API allows the use of message properties with byte messages, they are typically not used, since the
+ * inclusion of properties may affect the format.
+ * <P>
+ * The primitive types can be written explicitly using methods for each type. They may also be written generically as
+ * objects. For instance, a call to <CODE>BytesMessage.writeInt(6)</CODE> is equivalent to
+ * <CODE> BytesMessage.writeObject(new Integer(6))</CODE>. Both forms are provided, because the explicit form is
+ * convenient for static programming, and the object form is needed when types are not known at compile time.
+ * <P>
+ * When the message is first created, and when <CODE>clearBody</CODE> is called, the body of the message is in
+ * write-only mode. After the first call to <CODE>reset</CODE> has been made, the message body is in read-only mode.
+ * After a message has been sent, the client that sent it can retain and modify it without affecting the message that
+ * has been sent. The same message object can be sent multiple times. When a message has been received, the provider has
+ * called <CODE>reset</CODE> so that the message body is in read-only mode for the client.
+ * <P>
+ * If <CODE>clearBody</CODE> is called on a message in read-only mode, the message body is cleared and the message is
+ * in write-only mode.
+ * <P>
+ * If a client attempts to read a message in write-only mode, a <CODE>MessageNotReadableException</CODE> is thrown.
+ * <P>
+ * If a client attempts to write a message in read-only mode, a <CODE>MessageNotWriteableException</CODE> is thrown.
+ * 
+ * @see javax.jms.Session#createBytesMessage()
+ * @see javax.jms.MapMessage
+ * @see javax.jms.Message
+ * @see javax.jms.ObjectMessage
+ * @see javax.jms.StreamMessage
+ * @see javax.jms.TextMessage
+ */
+public class BlazeJmsBytesMessage extends BlazeJmsMessage implements BytesMessage {
+    protected transient DataOutputStream dataOut;
+    protected transient BufferOutputStream bytesOut;
+    protected transient DataInputStream dataIn;
+    protected transient int length;
+
+    public BlazeJmsBytesMessage clone() {
+        BlazeJmsBytesMessage copy = new BlazeJmsBytesMessage();
+        try {
+            copy(copy);
+        } catch (BlazeException e) {
+            throw new BlazeRuntimeException(e);
+        }
+        return copy;
+    }
+
+    /**
+     * @param copy
+     * @throws BlazeException
+     */
+    protected void copy(BlazeJmsBytesMessage copy) throws BlazeException {
+        storeContent();
+        super.copy(copy);
+        copy.dataOut = null;
+        copy.bytesOut = null;
+        copy.dataIn = null;
+    }
+
+    public void storeContent() {
+        super.storeContent();
+        try {
+            if (this.dataOut != null) {
+                this.dataOut.close();
+                Buffer bs = this.bytesOut.toBuffer();
+                getContent().setPayload(bs);
+                this.bytesOut = null;
+                this.dataOut = null;
+            }
+        } catch (IOException ioe) {
+            throw new RuntimeException(ioe.getMessage(), ioe);
+        }
+    }
+
+    protected void loadContent() {
+        super.loadContent();
+        if (this.dataIn == null) {
+            Buffer data = null;
+            if (getContent() == null || getContent().getPayload() == null) {
+                data = getContent().getPayload();
+                if (data == null) {
+                    data = new Buffer(new byte[0]);
+                }
+            }
+            if (data == null) {
+                data = getContent().getPayload();
+            }
+            this.length = data.getLength();
+            BufferInputStream is = new BufferInputStream(data);
+            this.dataIn = new DataInputStream(is);
+        }
+    }
+
+    /**
+     * Clears out the message body. Clearing a message's body does not clear its header values or property entries.
+     * <P>
+     * If this message body was read-only, calling this method leaves the message body in the same state as an empty
+     * body in a newly created message.
+     * 
+     * @throws JMSException
+     *             if the JMS provider fails to clear the message body due to some internal error.
+     */
+    public void clearBody() throws JMSException {
+        super.clearBody();
+        this.dataOut = null;
+        this.dataIn = null;
+        this.bytesOut = null;
+    }
+
+    /**
+     * Gets the number of bytes of the message body when the message is in read-only mode. The value returned can be
+     * used to allocate a byte array. The value returned is the entire length of the message body, regardless of where
+     * the pointer for reading the message is currently located.
+     * 
+     * @return number of bytes in the message
+     * @since 1.1
+     */
+    public long getBodyLength() {
+        initializeReading();
+        return this.length;
+    }
+
+    /**
+     * Reads a <code>boolean</code> from the bytes message stream.
+     * 
+     * @return the <code>boolean</code> value read
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public boolean readBoolean() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readBoolean();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a signed 8-bit value from the bytes message stream.
+     * 
+     * @return the next byte from the bytes message stream as a signed 8-bit <code>byte</code>
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public byte readByte() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readByte();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads an unsigned 8-bit number from the bytes message stream.
+     * 
+     * @return the next byte from the bytes message stream, interpreted as an unsigned 8-bit number
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public int readUnsignedByte() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readUnsignedByte();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a signed 16-bit number from the bytes message stream.
+     * 
+     * @return the next two bytes from the bytes message stream, interpreted as a signed 16-bit number
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public short readShort() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readShort();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads an unsigned 16-bit number from the bytes message stream.
+     * 
+     * @return the next two bytes from the bytes message stream, interpreted as an unsigned 16-bit integer
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public int readUnsignedShort() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readUnsignedShort();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a Unicode character value from the bytes message stream.
+     * 
+     * @return the next two bytes from the bytes message stream as a Unicode character
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public char readChar() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readChar();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a signed 32-bit integer from the bytes message stream.
+     * 
+     * @return the next four bytes from the bytes message stream, interpreted as an <code>int</code>
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public int readInt() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readInt();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a signed 64-bit integer from the bytes message stream.
+     * 
+     * @return the next eight bytes from the bytes message stream, interpreted as a <code>long</code>
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public long readLong() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readLong();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a <code>float</code> from the bytes message stream.
+     * 
+     * @return the next four bytes from the bytes message stream, interpreted as a <code>float</code>
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public float readFloat() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readFloat();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a <code>double</code> from the bytes message stream.
+     * 
+     * @return the next eight bytes from the bytes message stream, interpreted as a <code>double</code>
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public double readDouble() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readDouble();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a string that has been encoded using a modified UTF-8 format from the bytes message stream.
+     * <P>
+     * For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open
+     * Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC
+     * 10646, Annex P.
+     * 
+     * @return a Unicode string from the bytes message stream
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageEOFException
+     *             if unexpected end of bytes stream has been reached.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public String readUTF() throws JMSException {
+        initializeReading();
+        try {
+            return this.dataIn.readUTF();
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Reads a byte array from the bytes message stream.
+     * <P>
+     * If the length of array <code>value</code> is less than the number of bytes remaining to be read from the
+     * stream, the array should be filled. A subsequent call reads the next increment, and so on.
+     * <P>
+     * If the number of bytes remaining in the stream is less than the length of array <code>value</code>, the bytes
+     * should be read into the array. The return value of the total number of bytes read will be less than the length of
+     * the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream
+     * returns -1.
+     * 
+     * @param value
+     *            the buffer into which the data is read
+     * @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the
+     *         stream has been reached
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public int readBytes(byte[] value) throws JMSException {
+        return readBytes(value, value.length);
+    }
+
+    /**
+     * Reads a portion of the bytes message stream.
+     * <P>
+     * If the length of array <code>value</code> is less than the number of bytes remaining to be read from the
+     * stream, the array should be filled. A subsequent call reads the next increment, and so on.
+     * <P>
+     * If the number of bytes remaining in the stream is less than the length of array <code>value</code>, the bytes
+     * should be read into the array. The return value of the total number of bytes read will be less than the length of
+     * the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream
+     * returns -1. <p/> If <code>length</code> is negative, or <code>length</code> is greater than the length of the
+     * array <code>value</code>, then an <code>IndexOutOfBoundsException</code> is thrown. No bytes will be read
+     * from the stream for this exception case.
+     * 
+     * @param value
+     *            the buffer into which the data is read
+     * @param length
+     *            the number of bytes to read; must be less than or equal to <code>value.length</code>
+     * @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the
+     *         stream has been reached
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageNotReadableException
+     *             if the message is in write-only mode.
+     */
+    public int readBytes(byte[] value, int length) throws JMSException {
+        initializeReading();
+        try {
+            int n = 0;
+            while (n < length) {
+                int count = this.dataIn.read(value, n, length - n);
+                if (count < 0) {
+                    break;
+                }
+                n += count;
+            }
+            if (n == 0 && length > 0) {
+                n = -1;
+            }
+            return n;
+        } catch (EOFException e) {
+            throw BlazeJmsExceptionSupport.createMessageEOFException(e);
+        } catch (IOException e) {
+            throw BlazeJmsExceptionSupport.createMessageFormatException(e);
+        }
+    }
+
+    /**
+     * Writes a <code>boolean</code> to the bytes message stream as a 1-byte value. The value <code>true</code> is
+     * written as the value <code>(byte)1</code>; the value <code>false</code> is written as the value
+     * <code>(byte)0</code>.
+     * 
+     * @param value
+     *            the <code>boolean</code> value to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeBoolean(boolean value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeBoolean(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a <code>byte</code> to the bytes message stream as a 1-byte value.
+     * 
+     * @param value
+     *            the <code>byte</code> value to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeByte(byte value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeByte(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a <code>short</code> to the bytes message stream as two bytes, high byte first.
+     * 
+     * @param value
+     *            the <code>short</code> to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeShort(short value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeShort(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a <code>char</code> to the bytes message stream as a 2-byte value, high byte first.
+     * 
+     * @param value
+     *            the <code>char</code> value to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeChar(char value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeChar(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes an <code>int</code> to the bytes message stream as four bytes, high byte first.
+     * 
+     * @param value
+     *            the <code>int</code> to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeInt(int value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeInt(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a <code>long</code> to the bytes message stream as eight bytes, high byte first.
+     * 
+     * @param value
+     *            the <code>long</code> to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeLong(long value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeLong(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Converts the <code>float</code> argument to an <code>int</code> using the <code>floatToIntBits</code>
+     * method in class <code>Float</code>, and then writes that <code>int</code> value to the bytes message stream
+     * as a 4-byte quantity, high byte first.
+     * 
+     * @param value
+     *            the <code>float</code> value to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeFloat(float value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeFloat(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Converts the <code>double</code> argument to a <code>long</code> using the <code>doubleToLongBits</code>
+     * method in class <code>Double</code>, and then writes that <code>long</code> value to the bytes message
+     * stream as an 8-byte quantity, high byte first.
+     * 
+     * @param value
+     *            the <code>double</code> value to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeDouble(double value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeDouble(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a string to the bytes message stream using UTF-8 encoding in a machine-independent manner.
+     * <P>
+     * For more information on the UTF-8 format, see "File System Safe UCS Transformation Format (FSS_UTF)", X/Open
+     * Preliminary Specification, X/Open Company Ltd., Document Number: P316. This information also appears in ISO/IEC
+     * 10646, Annex P.
+     * 
+     * @param value
+     *            the <code>String</code> value to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeUTF(String value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.writeUTF(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a byte array to the bytes message stream.
+     * 
+     * @param value
+     *            the byte array to be written
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeBytes(byte[] value) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.write(value);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes a portion of a byte array to the bytes message stream.
+     * 
+     * @param value
+     *            the byte array value to be written
+     * @param offset
+     *            the initial offset within the byte array
+     * @param length
+     *            the number of bytes to use
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void writeBytes(byte[] value, int offset, int length) throws JMSException {
+        initializeWriting();
+        try {
+            this.dataOut.write(value, offset, length);
+        } catch (IOException ioe) {
+            throw BlazeJmsExceptionSupport.create(ioe);
+        }
+    }
+
+    /**
+     * Writes an object to the bytes message stream.
+     * <P>
+     * This method works only for the objectified primitive object types (<code>Integer</code>,<code>Double</code>,
+     * <code>Long</code> &nbsp;...), <code>String</code> objects, and byte arrays.
+     * 
+     * @param value
+     *            the object in the Java programming language ("Java object") to be written; it must not be null
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws MessageFormatException
+     *             if the object is of an invalid type.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     * @throws java.lang.NullPointerException
+     *             if the parameter <code>value</code> is null.
+     */
+    public void writeObject(Object value) throws JMSException {
+        if (value == null) {
+            throw new NullPointerException();
+        }
+        initializeWriting();
+        if (value instanceof Boolean) {
+            writeBoolean(((Boolean) value).booleanValue());
+        } else if (value instanceof Character) {
+            writeChar(((Character) value).charValue());
+        } else if (value instanceof Byte) {
+            writeByte(((Byte) value).byteValue());
+        } else if (value instanceof Short) {
+            writeShort(((Short) value).shortValue());
+        } else if (value instanceof Integer) {
+            writeInt(((Integer) value).intValue());
+        } else if (value instanceof Long) {
+            writeLong(((Long) value).longValue());
+        } else if (value instanceof Float) {
+            writeFloat(((Float) value).floatValue());
+        } else if (value instanceof Double) {
+            writeDouble(((Double) value).doubleValue());
+        } else if (value instanceof String) {
+            writeUTF(value.toString());
+        } else if (value instanceof byte[]) {
+            writeBytes((byte[]) value);
+        } else {
+            throw new MessageFormatException("Cannot write non-primitive type:" + value.getClass());
+        }
+    }
+
+    /**
+     * Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
+     */
+    public void reset() {
+        storeContent();
+        this.bytesOut = null;
+        this.dataIn = null;
+        this.dataOut = null;
+    }
+
+    protected void initializeWriting() {
+        super.initializeWriting();
+        if (this.dataOut == null) {
+            this.bytesOut = new BufferOutputStream(32);
+            this.dataOut = new DataOutputStream(this.bytesOut);
+        }
+    }
+
+    protected void initializeReading() {
+        super.initializeReading();
+        if (this.dataIn == null) {
+            BlazeData bd = getContent();
+            Buffer data = null;
+            if (bd != null && bd.getPayload() != null) {
+                data = bd.getPayload();
+            } else {
+                data = new Buffer(new byte[0]);
+            }
+            BufferInputStream is = new BufferInputStream(data);
+            this.length = data.getLength();
+            this.dataIn = new DataInputStream(is);
+        }
+    }
+}

Propchange: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsBytesMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsBytesMessage.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMapMessage.java
URL: http://svn.apache.org/viewvc/activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMapMessage.java?rev=739885&view=auto
==============================================================================
--- activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMapMessage.java (added)
+++ activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMapMessage.java Sun Feb  1 23:35:54 2009
@@ -0,0 +1,691 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activeblaze.jms.message;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.MessageFormatException;
+import javax.jms.MessageNotWriteableException;
+import org.apache.activeblaze.BlazeException;
+import org.apache.activeblaze.BlazeRuntimeException;
+import org.apache.activeblaze.wire.BlazeData;
+import org.apache.activeblaze.wire.MapData;
+import org.apache.activemq.protobuf.Buffer;
+import org.apache.activemq.protobuf.InvalidProtocolBufferException;
+
+/**
+ * A <CODE>MapMessage</CODE> object is used to send a set of name-value pairs. The names are <CODE>String</CODE>
+ * objects, and the values are primitive data types in the Java programming language. The names must have a value that
+ * is not null, and not an empty string. The entries can be accessed sequentially or randomly by name. The order of the
+ * entries is undefined. <CODE>MapMessage</CODE> inherits from the <CODE>Message</CODE> interface and adds a message
+ * body that contains a Map.
+ * <P>
+ * The primitive types can be read or written explicitly using methods for each type. They may also be read or written
+ * generically as objects. For instance, a call to <CODE>MapMessage.setInt("foo", 6)</CODE> is equivalent to
+ * <CODE> MapMessage.setObject("foo", new Integer(6))</CODE>. Both forms are provided, because the explicit form is
+ * convenient for static programming, and the object form is needed when types are not known at compile time.
+ * <P>
+ * When a client receives a <CODE>MapMessage</CODE>, it is in read-only mode. If a client attempts to write to the
+ * message at this point, a <CODE>MessageNotWriteableException</CODE> is thrown. If <CODE>clearBody</CODE> is
+ * called, the message can now be both read from and written to.
+ * <P>
+ * <CODE>MapMessage</CODE> objects support the following conversion table. The marked cases must be supported. The
+ * unmarked cases must throw a <CODE>JMSException</CODE>. The <CODE>String</CODE> -to-primitive conversions may
+ * throw a runtime exception if the primitive's <CODE>valueOf()</CODE> method does not accept it as a valid
+ * <CODE> String</CODE> representation of the primitive.
+ * <P>
+ * A value written as the row type can be read as the column type. <p/>
+ * 
+ * <PRE>
+ * | | boolean byte short char int long float double String byte[] |----------------------------------------------------------------------
+ * |boolean | X X |byte | X X X X X |short | X X X X |char | X X |int | X X X |long | X X |float | X X X |double | X X
+ * |String | X X X X X X X X |byte[] | X |----------------------------------------------------------------------
+ * &lt;p/&gt;
+ * </PRE>
+ * 
+ * <p/>
+ * <P>
+ * Attempting to read a null value as a primitive type must be treated as calling the primitive's corresponding
+ * <code>valueOf(String)</code> conversion method with a null value. Since <code>char</code> does not support a
+ * <code>String</code> conversion, attempting to read a null value as a <code>char</code> must throw a
+ * <code>NullPointerException</code>.
+ * 
+ * 
+ * @see javax.jms.Session#createMapMessage()
+ * @see javax.jms.BytesMessage
+ * @see javax.jms.Message
+ * @see javax.jms.ObjectMessage
+ * @see javax.jms.StreamMessage
+ * @see javax.jms.TextMessage
+ */
+public class BlazeJmsMapMessage extends BlazeJmsMessage implements MapMessage {
+    protected transient Map<String, Object> map = new HashMap<String, Object>();
+
+    public BlazeJmsMapMessage clone() {
+        BlazeJmsMapMessage copy = new BlazeJmsMapMessage();
+        try {
+            copy(copy);
+        } catch (BlazeException e) {
+            throw new BlazeRuntimeException(e);
+        }
+        return copy;
+    }
+
+    /**
+     * @param copy
+     * @throws BlazeException
+     */
+    protected void copy(BlazeJmsMapMessage copy) throws BlazeException {
+        storeContent();
+        super.copy(copy);
+    }
+
+    public void storeContent() {
+        super.storeContent();
+        if (getContent() != null && !this.map.isEmpty()) {
+            MapData mapData = new MapData();
+            for (Map.Entry<String, Object> entry : this.map.entrySet()) {
+                marshallMap(mapData, entry.getKey().toString(), entry.getValue());
+            }
+            Buffer payload = mapData.toFramedBuffer();
+            BlazeData data = getContent();
+            data.setPayload(payload);
+        }
+    }
+
+    /**
+     * Builds the message body from data
+     * 
+     * @throws IOException
+     */
+    protected void loadContent() {
+        if (getContent() != null && this.map.isEmpty()) {
+            try {
+                MapData mapData = MapData.parseFramed(getContent().getPayload());
+                this.map = unmarshall(mapData);
+            } catch (InvalidProtocolBufferException e) {
+                throw new BlazeRuntimeException(e);
+            }
+        }
+    }
+
+    /**
+     * Clears out the message body. Clearing a message's body does not clear its header values or property entries.
+     * <P>
+     * If this message body was read-only, calling this method leaves the message body in the same state as an empty
+     * body in a newly created message.
+     * 
+     * @throws JMSException
+     */
+    public void clearBody() throws JMSException {
+        super.clearBody();
+        this.map.clear();
+    }
+
+    /**
+     * Returns the <CODE>boolean</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>boolean</CODE>
+     * @return the <CODE>boolean</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public boolean getBoolean(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return false;
+        }
+        if (value instanceof Boolean) {
+            return ((Boolean) value).booleanValue();
+        }
+        if (value instanceof String) {
+            return Boolean.valueOf(value.toString()).booleanValue();
+        }
+        throw new MessageFormatException(" cannot read a boolean from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>byte</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>byte</CODE>
+     * @return the <CODE>byte</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public byte getByte(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return 0;
+        }
+        if (value instanceof Byte) {
+            return ((Byte) value).byteValue();
+        }
+        if (value instanceof String) {
+            return Byte.valueOf(value.toString()).byteValue();
+        }
+        throw new MessageFormatException(" cannot read a byte from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>short</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>short</CODE>
+     * @return the <CODE>short</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public short getShort(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return 0;
+        }
+        if (value instanceof Short) {
+            return ((Short) value).shortValue();
+        }
+        if (value instanceof Byte) {
+            return ((Byte) value).shortValue();
+        }
+        if (value instanceof String) {
+            return Short.valueOf(value.toString()).shortValue();
+        }
+        throw new MessageFormatException(" cannot read a short from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the Unicode character value with the specified name.
+     * 
+     * @param name
+     *            the name of the Unicode character
+     * @return the Unicode character value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public char getChar(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            throw new NullPointerException();
+        }
+        if (value instanceof Character) {
+            return ((Character) value).charValue();
+        }
+        throw new MessageFormatException(" cannot read a short from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>int</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>int</CODE>
+     * @return the <CODE>int</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public int getInt(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return 0;
+        }
+        if (value instanceof Integer) {
+            return ((Integer) value).intValue();
+        }
+        if (value instanceof Short) {
+            return ((Short) value).intValue();
+        }
+        if (value instanceof Byte) {
+            return ((Byte) value).intValue();
+        }
+        if (value instanceof String) {
+            return Integer.valueOf(value.toString()).intValue();
+        }
+        throw new MessageFormatException(" cannot read an int from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>long</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>long</CODE>
+     * @return the <CODE>long</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public long getLong(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return 0;
+        }
+        if (value instanceof Long) {
+            return ((Long) value).longValue();
+        }
+        if (value instanceof Integer) {
+            return ((Integer) value).longValue();
+        }
+        if (value instanceof Short) {
+            return ((Short) value).longValue();
+        }
+        if (value instanceof Byte) {
+            return ((Byte) value).longValue();
+        }
+        if (value instanceof String) {
+            return Long.valueOf(value.toString()).longValue();
+        }
+        throw new MessageFormatException(" cannot read a long from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>float</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>float</CODE>
+     * @return the <CODE>float</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public float getFloat(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return 0;
+        }
+        if (value instanceof Float) {
+            return ((Float) value).floatValue();
+        }
+        if (value instanceof String) {
+            return Float.valueOf(value.toString()).floatValue();
+        }
+        throw new MessageFormatException(" cannot read a float from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>double</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>double</CODE>
+     * @return the <CODE>double</CODE> value with the specified name
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public double getDouble(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return 0;
+        }
+        if (value instanceof Double) {
+            return ((Double) value).doubleValue();
+        }
+        if (value instanceof Float) {
+            return ((Float) value).floatValue();
+        }
+        if (value instanceof String) {
+            return Float.valueOf(value.toString()).floatValue();
+        }
+        throw new MessageFormatException(" cannot read a double from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the <CODE>String</CODE> value with the specified name.
+     * 
+     * @param name
+     *            the name of the <CODE>String</CODE>
+     * @return the <CODE>String</CODE> value with the specified name; if there is no item by this name, a null value
+     *         is returned
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public String getString(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value == null) {
+            return null;
+        }
+        if (value instanceof byte[]) {
+            throw new MessageFormatException("Use getBytes to read a byte array");
+        }
+        return value.toString();
+    }
+
+    /**
+     * Returns the byte array value with the specified name.
+     * 
+     * @param name
+     *            the name of the byte array
+     * @return a copy of the byte array value with the specified name; if there is no item by this name, a null value is
+     *         returned.
+     * @throws JMSException
+     *             if the JMS provider fails to read the message due to some internal error.
+     * @throws MessageFormatException
+     *             if this type conversion is invalid.
+     */
+    public byte[] getBytes(String name) throws JMSException {
+        initializeReading();
+        Object value = this.map.get(name);
+        if (value instanceof byte[]) {
+            return (byte[]) value;
+        }
+        throw new MessageFormatException(" cannot read a byte[] from " + value.getClass().getName());
+    }
+
+    /**
+     * Returns the value of the object with the specified name.
+     * <P>
+     * This method can be used to return, in objectified format, an object in the Java programming language ("Java
+     * object") that had been stored in the Map with the equivalent <CODE>setObject</CODE> method call, or its
+     * equivalent primitive <CODE>set <I>type </I></CODE> method.
+     * <P>
+     * Note that byte values are returned as <CODE>byte[]</CODE>, not <CODE>Byte[]</CODE>.
+     * 
+     * @param name
+     *            the name of the Java object
+     * @return a copy of the Java object value with the specified name, in objectified format (for example, if the
+     *         object was set as an <CODE>int</CODE>, an <CODE>Integer</CODE> is returned); if there is no item by
+     *         this name, a null value is returned
+     */
+    public Object getObject(String name) {
+        initializeReading();
+        return this.map.get(name);
+    }
+
+    /**
+     * Returns an <CODE>Enumeration</CODE> of all the names in the <CODE>MapMessage</CODE> object.
+     * 
+     * @return an enumeration of all the names in this <CODE>MapMessage</CODE>
+     */
+    public Enumeration<String> getMapNames() {
+        initializeReading();
+        return Collections.enumeration(this.map.keySet());
+    }
+
+    protected void setValue(String name, Object value) {
+        if (name == null) {
+            throw new IllegalArgumentException("The name of the property cannot be null.");
+        }
+        if (name.length() == 0) {
+            throw new IllegalArgumentException("The name of the property cannot be an emprty string.");
+        }
+        this.map.put(name, value);
+    }
+
+    /**
+     * Sets a <CODE>boolean</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>boolean</CODE>
+     * @param value
+     *            the <CODE>boolean</CODE> value to set in the Map
+     * 
+     * 
+     */
+    public void setBoolean(String name, boolean value) {
+        initializeWriting();
+        setValue(name, value ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * Sets a <CODE>byte</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>byte</CODE>
+     * @param value
+     *            the <CODE>byte</CODE> value to set in the Map
+     * 
+     */
+    public void setByte(String name, byte value) {
+        initializeWriting();
+        setValue(name, Byte.valueOf(value));
+    }
+
+    /**
+     * Sets a <CODE>short</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>short</CODE>
+     * @param value
+     *            the <CODE>short</CODE> value to set in the Map
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * 
+     */
+    public void setShort(String name, short value) {
+        initializeWriting();
+        setValue(name, Short.valueOf(value));
+    }
+
+    /**
+     * Sets a Unicode character value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the Unicode character
+     * @param value
+     *            the Unicode character value to set in the Map
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * 
+     */
+    public void setChar(String name, char value) {
+        initializeWriting();
+        setValue(name, Character.valueOf(value));
+    }
+
+    /**
+     * Sets an <CODE>int</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>int</CODE>
+     * @param value
+     *            the <CODE>int</CODE> value to set in the Map
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * 
+     */
+    public void setInt(String name, int value) {
+        initializeWriting();
+        setValue(name, Integer.valueOf(value));
+    }
+
+    /**
+     * Sets a <CODE>long</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>long</CODE>
+     * @param value
+     *            the <CODE>long</CODE> value to set in the Map
+     * 
+     */
+    public void setLong(String name, long value) {
+        initializeWriting();
+        setValue(name, Long.valueOf(value));
+    }
+
+    /**
+     * Sets a <CODE>float</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>float</CODE>
+     * @param value
+     *            the <CODE>float</CODE> value to set in the Map
+     * 
+     * if the message is in read-only mode.
+     */
+    public void setFloat(String name, float value) {
+        initializeWriting();
+        setValue(name, new Float(value));
+    }
+
+    /**
+     * Sets a <CODE>double</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>double</CODE>
+     * @param value
+     *            the <CODE>double</CODE> value to set in the Map
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void setDouble(String name, double value) throws JMSException {
+        initializeWriting();
+        setValue(name, new Double(value));
+    }
+
+    /**
+     * Sets a <CODE>String</CODE> value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the <CODE>String</CODE>
+     * @param value
+     *            the <CODE>String</CODE> value to set in the Map
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void setString(String name, String value) throws JMSException {
+        initializeWriting();
+        setValue(name, value);
+    }
+
+    /**
+     * Sets a byte array value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the byte array
+     * @param value
+     *            the byte array value to set in the Map; the array is copied so that the value for <CODE>name </CODE>
+     *            will not be altered by future modifications
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws NullPointerException
+     *             if the name is null, or if the name is an empty string.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void setBytes(String name, byte[] value) throws JMSException {
+        initializeWriting();
+        if (value != null) {
+            setValue(name, value);
+        } else {
+            map.remove(name);
+        }
+    }
+
+    /**
+     * Sets a portion of the byte array value with the specified name into the Map.
+     * 
+     * @param name
+     *            the name of the byte array
+     * @param value
+     *            the byte array value to set in the Map
+     * @param offset
+     *            the initial offset within the byte array
+     * @param length
+     *            the number of bytes to use
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void setBytes(String name, byte[] value, int offset, int length) throws JMSException {
+        initializeWriting();
+        byte[] data = new byte[length];
+        System.arraycopy(value, offset, data, 0, length);
+        setValue(name, data);
+    }
+
+    /**
+     * Sets an object value with the specified name into the Map.
+     * <P>
+     * This method works only for the objectified primitive object types (<code>Integer</code>,<code>Double</code>,
+     * <code>Long</code> &nbsp;...), <code>String</code> objects, and byte arrays.
+     * 
+     * @param name
+     *            the name of the Java object
+     * @param value
+     *            the Java object value to set in the Map
+     * @throws JMSException
+     *             if the JMS provider fails to write the message due to some internal error.
+     * @throws IllegalArgumentException
+     *             if the name is null or if the name is an empty string.
+     * @throws MessageFormatException
+     *             if the object is invalid.
+     * @throws MessageNotWriteableException
+     *             if the message is in read-only mode.
+     */
+    public void setObject(String name, Object value) throws JMSException {
+        initializeWriting();
+        if (value != null) {
+            // byte[] not allowed on properties
+            if (!(value instanceof byte[])) {
+                checkValidObject(value);
+            }
+            setValue(name, value);
+        } else {
+            setValue(name, null);
+        }
+    }
+
+    /**
+     * Indicates whether an item exists in this <CODE>MapMessage</CODE> object.
+     * 
+     * @param name
+     *            the name of the item to test
+     * @return true if the item exists
+     */
+    public boolean itemExists(String name) {
+        initializeReading();
+        return this.map.containsKey(name);
+    }
+}

Propchange: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMapMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMapMessage.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java
URL: http://svn.apache.org/viewvc/activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java?rev=739885&r1=739884&r2=739885&view=diff
==============================================================================
--- activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java (original)
+++ activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java Sun Feb  1 23:35:54 2009
@@ -26,17 +26,19 @@
 import org.apache.activeblaze.BlazeMessage;
 import org.apache.activeblaze.BlazeMessageFormatException;
 import org.apache.activeblaze.BlazeRuntimeException;
+import org.apache.activeblaze.jms.BlazeJmsDestination;
 import org.apache.activeblaze.util.Callback;
 import org.apache.activeblaze.wire.BlazeData;
 
 /**
  * Implementation of a Jms Message
- *
+ * 
  */
-public class BlazeJmsMessage extends BlazeMessage implements Message{
-    protected transient Callback<BlazeJmsMessage>acknowledgeCallback;
-    
-    
+public class BlazeJmsMessage extends BlazeMessage implements Message {
+    protected transient Callback<BlazeJmsMessage> acknowledgeCallback;
+    protected transient BlazeJmsDestination jmsDestination;
+    protected transient BlazeJmsDestination jmsReplyToDestination;
+
     public BlazeJmsMessage clone() {
         BlazeJmsMessage copy = new BlazeJmsMessage();
         try {
@@ -45,13 +47,15 @@
             throw new BlazeRuntimeException(e);
         }
         return copy;
-    } 
-    
+    }
+
     protected void copy(BlazeJmsMessage copy) throws BlazeException {
         super.copy(copy);
         copy.acknowledgeCallback = this.acknowledgeCallback;
+        copy.jmsDestination = this.jmsDestination;
+        copy.jmsReplyToDestination = this.jmsReplyToDestination;
     }
-    
+
     /**
      * @return the acknowledge <Code>Callback</Code>
      */
@@ -69,12 +73,11 @@
     /**
      * @see javax.jms.Message#acknowledge()
      */
-    public void acknowledge()  {
+    public void acknowledge() {
         Callback<BlazeJmsMessage> callback = this.acknowledgeCallback;
-        if (callback!=null) {
+        if (callback != null) {
             callback.execute(this);
         }
-        
     }
 
     /**
@@ -89,15 +92,13 @@
     }
 
     /**
-     * @throws JMSException
      * @see javax.jms.Message#clearProperties()
      */
-    public void clearProperties() throws JMSException {
+    public void clearProperties() {
         BlazeData data = getContent();
         if (data != null) {
             data.clearMapData();
         }
-        
     }
 
     /**
@@ -107,11 +108,11 @@
      * @see javax.jms.Message#getBooleanProperty(java.lang.String)
      */
     public boolean getBooleanProperty(String name) throws JMSException {
-       try {
-        return getBoolean(name);
-    } catch (BlazeMessageFormatException e) {
-        throw new MessageFormatException(e.getMessage());
-    }
+        try {
+            return getBooleanValue(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
@@ -122,7 +123,7 @@
      */
     public byte getByteProperty(String name) throws JMSException {
         try {
-            return getByte(name);
+            return getByteValue(name);
         } catch (BlazeMessageFormatException e) {
             throw new MessageFormatException(e.getMessage());
         }
@@ -136,7 +137,7 @@
      */
     public double getDoubleProperty(String name) throws JMSException {
         try {
-            return getDouble(name);
+            return getDoubleValue(name);
         } catch (BlazeMessageFormatException e) {
             throw new MessageFormatException(e.getMessage());
         }
@@ -150,7 +151,7 @@
      */
     public float getFloatProperty(String name) throws JMSException {
         try {
-            return getFloat(name);
+            return getFloatValue(name);
         } catch (BlazeMessageFormatException e) {
             throw new MessageFormatException(e.getMessage());
         }
@@ -164,7 +165,7 @@
      */
     public int getIntProperty(String name) throws JMSException {
         try {
-            return getInt(name);
+            return getIntValue(name);
         } catch (BlazeMessageFormatException e) {
             throw new MessageFormatException(e.getMessage());
         }
@@ -191,37 +192,34 @@
      * @see javax.jms.Message#getJMSDeliveryMode()
      */
     public int getJMSDeliveryMode() {
-       return isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
+        return isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
     }
 
     /**
      * @return the JMSDestination
-     * @throws JMSException
      * @see javax.jms.Message#getJMSDestination()
      */
-    public Destination getJMSDestination() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+    public Destination getJMSDestination() {
+        if (this.jmsDestination == null) {
+            this.jmsDestination = BlazeJmsDestination.createJmsDestination(getDestination());
+        }
+        return this.jmsDestination;
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return the expiration
      * @see javax.jms.Message#getJMSExpiration()
      */
-    public long getJMSExpiration() throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+    public long getJMSExpiration() {
+        return getExpiration();
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return the messageId
      * @see javax.jms.Message#getJMSMessageID()
      */
-    public String getJMSMessageID() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+    public String getJMSMessageID() {
+        return getMessageId();
     }
 
     /**
@@ -230,8 +228,7 @@
      * @see javax.jms.Message#getJMSPriority()
      */
     public int getJMSPriority() throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        return getPriority();
     }
 
     /**
@@ -240,8 +237,7 @@
      * @see javax.jms.Message#getJMSRedelivered()
      */
     public boolean getJMSRedelivered() throws JMSException {
-        // TODO Auto-generated method stub
-        return false;
+        return getRedeliveryCounter() > 0;
     }
 
     /**
@@ -250,18 +246,18 @@
      * @see javax.jms.Message#getJMSReplyTo()
      */
     public Destination getJMSReplyTo() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+        if (this.jmsReplyToDestination == null) {
+            this.jmsReplyToDestination = BlazeJmsDestination.createJmsDestination(getReplyTo());
+        }
+        return this.jmsReplyToDestination;
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return timestamp
      * @see javax.jms.Message#getJMSTimestamp()
      */
-    public long getJMSTimestamp() throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+    public long getJMSTimestamp() {
+        return getTimeStamp();
     }
 
     /**
@@ -270,8 +266,7 @@
      * @see javax.jms.Message#getJMSType()
      */
     public String getJMSType() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+        return getType();
     }
 
     /**
@@ -281,147 +276,136 @@
      * @see javax.jms.Message#getLongProperty(java.lang.String)
      */
     public long getLongProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        try {
+            return getLongValue(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
      * @param name
-     * @return
-     * @throws JMSException
+     * @return the associated object
+     * 
      * @see javax.jms.Message#getObjectProperty(java.lang.String)
      */
-    public Object getObjectProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+    public Object getObjectProperty(String name) {
+        return getObjectValue(name);
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return property names
      * @see javax.jms.Message#getPropertyNames()
      */
-    public Enumeration getPropertyNames() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+    public Enumeration<String> getPropertyNames() {
+        return getNames();
     }
 
     /**
      * @param name
-     * @return
+     * @return short property
      * @throws JMSException
      * @see javax.jms.Message#getShortProperty(java.lang.String)
      */
     public short getShortProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        try {
+            return getShortValue(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
      * @param name
-     * @return
+     * @return String property
      * @throws JMSException
      * @see javax.jms.Message#getStringProperty(java.lang.String)
      */
     public String getStringProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+        try {
+            return getStringValue(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
      * @param name
-     * @return
-     * @throws JMSException
+     * @return true if the property exists
      * @see javax.jms.Message#propertyExists(java.lang.String)
      */
-    public boolean propertyExists(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return false;
+    public boolean propertyExists(String name) {
+        return valueExists(name);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setBooleanProperty(java.lang.String, boolean)
      */
-    public void setBooleanProperty(String name, boolean value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setBooleanProperty(String name, boolean value) {
+        setBooleanValue(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setByteProperty(java.lang.String, byte)
      */
-    public void setByteProperty(String name, byte value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setByteProperty(String name, byte value) {
+        setByteValue(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setDoubleProperty(java.lang.String, double)
      */
-    public void setDoubleProperty(String name, double value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setDoubleProperty(String name, double value) {
+        setDoubleValue(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setFloatProperty(java.lang.String, float)
      */
-    public void setFloatProperty(String name, float value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setFloatProperty(String name, float value) {
+        setFloatValue(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setIntProperty(java.lang.String, int)
      */
-    public void setIntProperty(String name, int value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setIntProperty(String name, int value) {
+        setIntValue(name, value);
     }
 
     /**
      * @param correlationID
-     * @throws JMSException
      * @see javax.jms.Message#setJMSCorrelationID(java.lang.String)
      */
-    public void setJMSCorrelationID(String correlationID) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSCorrelationID(String correlationID) {
+        setCorrelationId(correlationID);
     }
 
     /**
      * @param correlationID
-     * @throws JMSException
      * @see javax.jms.Message#setJMSCorrelationIDAsBytes(byte[])
      */
-    public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSCorrelationIDAsBytes(byte[] correlationID) {
+        setCorrelationId(new String(correlationID));
     }
 
     /**
      * @param deliveryMode
-     * @throws JMSException
      * @see javax.jms.Message#setJMSDeliveryMode(int)
      */
-    public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSDeliveryMode(int deliveryMode) {
+        boolean value = deliveryMode == DeliveryMode.PERSISTENT;
+        setPersistent(value);
     }
 
     /**
@@ -429,49 +413,39 @@
      * @throws JMSException
      * @see javax.jms.Message#setJMSDestination(javax.jms.Destination)
      */
-    public void setJMSDestination(Destination destination) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSDestination(javax.jms.Destination destination) throws JMSException {
+        this.jmsDestination = BlazeJmsDestination.transform(destination);
     }
 
     /**
      * @param expiration
-     * @throws JMSException
      * @see javax.jms.Message#setJMSExpiration(long)
      */
-    public void setJMSExpiration(long expiration) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSExpiration(long expiration) {
+        setExpiration(expiration);
     }
 
     /**
      * @param id
-     * @throws JMSException
      * @see javax.jms.Message#setJMSMessageID(java.lang.String)
      */
-    public void setJMSMessageID(String id) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSMessageID(String id) {
+        setMessageId(id);
     }
 
     /**
      * @param priority
-     * @throws JMSException
      * @see javax.jms.Message#setJMSPriority(int)
      */
-    public void setJMSPriority(int priority) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSPriority(int priority) {
+        setPriority(priority);
     }
 
     /**
      * @param redelivered
-     * @throws JMSException
      * @see javax.jms.Message#setJMSRedelivered(boolean)
      */
-    public void setJMSRedelivered(boolean redelivered) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSRedelivered(boolean redelivered) {
     }
 
     /**
@@ -480,71 +454,70 @@
      * @see javax.jms.Message#setJMSReplyTo(javax.jms.Destination)
      */
     public void setJMSReplyTo(Destination replyTo) throws JMSException {
-        // TODO Auto-generated method stub
-        
+        this.jmsReplyToDestination = BlazeJmsDestination.transform(replyTo);
     }
 
     /**
      * @param timestamp
-     * @throws JMSException
      * @see javax.jms.Message#setJMSTimestamp(long)
      */
-    public void setJMSTimestamp(long timestamp) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSTimestamp(long timestamp) {
+        setTimeStamp(timestamp);
     }
 
     /**
      * @param type
-     * @throws JMSException
      * @see javax.jms.Message#setJMSType(java.lang.String)
      */
-    public void setJMSType(String type) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setJMSType(String type) {
+        setType(type);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setLongProperty(java.lang.String, long)
      */
-    public void setLongProperty(String name, long value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setLongProperty(String name, long value) {
+        setLongValue(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setObjectProperty(java.lang.String, java.lang.Object)
      */
-    public void setObjectProperty(String name, Object value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setObjectProperty(String name, Object value) {
+        put(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setShortProperty(java.lang.String, short)
      */
-    public void setShortProperty(String name, short value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setShortProperty(String name, short value) {
+        setShortValue(name, value);
     }
 
     /**
      * @param name
      * @param value
-     * @throws JMSException
      * @see javax.jms.Message#setStringProperty(java.lang.String, java.lang.String)
      */
-    public void setStringProperty(String name, String value) throws JMSException {
-        // TODO Auto-generated method stub
-        
+    public void setStringProperty(String name, String value) {
+        setStringValue(name, value);
+    }
+
+    public void storeContent() {
+        if (this.jmsDestination != null) {
+            super.setDestination(this.jmsDestination.getDestination());
+        }
+        if (this.jmsReplyToDestination != null) {
+            super.setReplyTo(this.jmsReplyToDestination.getDestination());
+        }
+        super.storeContent();
     }
+    
+    
 }



Mime
View raw message