activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r738770 - in /activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms: BlazeJmsMessage.java message/ message/BlazeJmsMessage.java
Date Thu, 29 Jan 2009 06:47:59 GMT
Author: rajdavies
Date: Thu Jan 29 06:47:59 2009
New Revision: 738770

URL: http://svn.apache.org/viewvc?rev=738770&view=rev
Log:
Move BlazeJmsMessage to sub-package

Added:
    activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/
    activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java
      - copied, changed from r738496, activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsMessage.java
Removed:
    activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsMessage.java

Copied: activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java
(from r738496, activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsMessage.java)
URL: http://svn.apache.org/viewvc/activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java?p2=activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java&p1=activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsMessage.java&r1=738496&r2=738770&rev=738770&view=diff
==============================================================================
--- activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/BlazeJmsMessage.java
(original)
+++ activemq/activemq-blaze/trunk/src/main/java/org/apache/activeblaze/jms/message/BlazeJmsMessage.java
Thu Jan 29 06:47:59 2009
@@ -14,23 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.activeblaze.jms;
+package org.apache.activeblaze.jms.message;
 
 import java.util.Enumeration;
+import javax.jms.DeliveryMode;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Message;
+import javax.jms.MessageFormatException;
 import org.apache.activeblaze.BlazeException;
 import org.apache.activeblaze.BlazeMessage;
+import org.apache.activeblaze.BlazeMessageFormatException;
 import org.apache.activeblaze.BlazeRuntimeException;
 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 acknowledgeCallback;
+    protected transient Callback<BlazeJmsMessage>acknowledgeCallback;
     
     
     public BlazeJmsMessage clone() {
@@ -51,23 +55,25 @@
     /**
      * @return the acknowledge <Code>Callback</Code>
      */
-    public Callback getAcknowledgeCallback() {
+    public Callback<BlazeJmsMessage> getAcknowledgeCallback() {
         return this.acknowledgeCallback;
     }
 
     /**
      * @param acknowledgeCallback
      */
-    public void setAcknowledgeCallback(Callback acknowledgeCallback) {
+    public void setAcknowledgeCallback(Callback<BlazeJmsMessage> acknowledgeCallback)
{
         this.acknowledgeCallback = acknowledgeCallback;
     }
 
     /**
-     * @throws JMSException
      * @see javax.jms.Message#acknowledge()
      */
-    public void acknowledge() throws JMSException {
-        // TODO Auto-generated method stub
+    public void acknowledge()  {
+        Callback<BlazeJmsMessage> callback = this.acknowledgeCallback;
+        if (callback!=null) {
+            callback.execute(this);
+        }
         
     }
 
@@ -76,8 +82,10 @@
      * @see javax.jms.Message#clearBody()
      */
     public void clearBody() throws JMSException {
-        // TODO Auto-generated method stub
-        
+        BlazeData data = getContent();
+        if (data != null) {
+            data.clearPayload();
+        }
     }
 
     /**
@@ -85,97 +93,109 @@
      * @see javax.jms.Message#clearProperties()
      */
     public void clearProperties() throws JMSException {
-        // TODO Auto-generated method stub
+        BlazeData data = getContent();
+        if (data != null) {
+            data.clearMapData();
+        }
         
     }
 
     /**
      * @param name
-     * @return
+     * @return boolean value
      * @throws JMSException
      * @see javax.jms.Message#getBooleanProperty(java.lang.String)
      */
     public boolean getBooleanProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return false;
+       try {
+        return getBoolean(name);
+    } catch (BlazeMessageFormatException e) {
+        throw new MessageFormatException(e.getMessage());
+    }
     }
 
     /**
      * @param name
-     * @return
+     * @return byte value
      * @throws JMSException
      * @see javax.jms.Message#getByteProperty(java.lang.String)
      */
     public byte getByteProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        try {
+            return getByte(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
      * @param name
-     * @return
+     * @return double value
      * @throws JMSException
      * @see javax.jms.Message#getDoubleProperty(java.lang.String)
      */
     public double getDoubleProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        try {
+            return getDouble(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
      * @param name
-     * @return
+     * @return float value
      * @throws JMSException
      * @see javax.jms.Message#getFloatProperty(java.lang.String)
      */
     public float getFloatProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        try {
+            return getFloat(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
      * @param name
-     * @return
+     * @return int value
      * @throws JMSException
      * @see javax.jms.Message#getIntProperty(java.lang.String)
      */
     public int getIntProperty(String name) throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+        try {
+            return getInt(name);
+        } catch (BlazeMessageFormatException e) {
+            throw new MessageFormatException(e.getMessage());
+        }
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return String value
      * @see javax.jms.Message#getJMSCorrelationID()
      */
-    public String getJMSCorrelationID() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+    public String getJMSCorrelationID() {
+        return getCorrelationId();
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return correlationId as bytes
      * @see javax.jms.Message#getJMSCorrelationIDAsBytes()
      */
-    public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
-        // TODO Auto-generated method stub
-        return null;
+    public byte[] getJMSCorrelationIDAsBytes() {
+        return getCorrelationId() != null ? getCorrelationId().getBytes() : null;
     }
 
     /**
-     * @return
-     * @throws JMSException
+     * @return the deliveryMode
      * @see javax.jms.Message#getJMSDeliveryMode()
      */
-    public int getJMSDeliveryMode() throws JMSException {
-        // TODO Auto-generated method stub
-        return 0;
+    public int getJMSDeliveryMode() {
+       return isPersistent() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
     }
 
     /**
-     * @return
+     * @return the JMSDestination
      * @throws JMSException
      * @see javax.jms.Message#getJMSDestination()
      */



Mime
View raw message