You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2015/08/14 21:07:59 UTC

[26/50] [abbrv] qpid-proton git commit: checking in interim changes.

checking in interim changes.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cbac8aa8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cbac8aa8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cbac8aa8

Branch: refs/heads/rajith-codec
Commit: cbac8aa8deb51246a3c9be0358fcfd3f746cd512
Parents: e4204f0
Author: Rajith Attapattu <ra...@apache.org>
Authored: Fri May 8 08:08:28 2015 -0400
Committer: Rajith Attapattu <ra...@apache.org>
Committed: Thu Jul 9 09:12:38 2015 -0400

----------------------------------------------------------------------
 .../apache/qpid/proton/message2/Message.java    | 47 ++++++++++----------
 .../qpid/proton/message2/MessageImpl2.java      | 34 +++++++++++---
 2 files changed, 51 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cbac8aa8/proton-j/src/main/java/org/apache/qpid/proton/message2/Message.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/Message.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/Message.java
index 556dc7a..97d90ac 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/message2/Message.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/Message.java
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.proton.message2;
 
-
 import org.apache.qpid.proton.amqp.messaging.Section;
 import org.apache.qpid.proton.message.MessageError;
 import org.apache.qpid.proton.message.MessageFormat;
@@ -37,24 +36,21 @@ public interface Message
 
     public static final class Factory
     {
-        public static Message create() {
+        public static Message create()
+        {
             return new MessageImpl2();
         }
 
-        public static Message create(Header header,
-                                     DeliveryAnnotations deliveryAnnotations,
-                                     MessageAnnotations messageAnnotations,
-                                     Properties properties,
-                                     ApplicationProperties applicationProperties,
-                                     Section body,
-                                     Footer footer) {
-            return new MessageImpl2(header, deliveryAnnotations,
-                                   messageAnnotations, properties,
-                                   applicationProperties, body, footer);
+        public static Message create(Header header, DeliveryAnnotations deliveryAnnotations,
+                MessageAnnotations messageAnnotations, Properties properties,
+                ApplicationProperties applicationProperties, Section body, Footer footer)
+        {
+            //return new MessageImpl2(header, deliveryAnnotations, messageAnnotations, properties, applicationProperties,
+            //        body, footer);
+            return new MessageImpl2();
         }
     }
 
-
     short DEFAULT_PRIORITY = 4;
 
     boolean isDurable();
@@ -83,7 +79,6 @@ public interface Message
 
     String getReplyToGroupId();
 
-
     long getCreationTime();
 
     String getAddress();
@@ -142,6 +137,8 @@ public interface Message
 
     Object getBody();
 
+    Section getBodyAsSection(int i);
+
     Footer getFooter();
 
     void setHeader(Header header);
@@ -156,20 +153,22 @@ public interface Message
 
     void setBody(Object body);
 
+    void addBodySection(Section section);
+
     void setFooter(Footer footer);
 
     /**
-     * TODO describe what happens if the data does not represent a complete message.
-     * Currently this appears to leave the message in an unknown state.
+     * TODO describe what happens if the data does not represent a complete
+     * message. Currently this appears to leave the message in an unknown state.
      */
     int decode(byte[] data, int offset, int length);
 
     /**
-     * Encodes up to {@code length} bytes of the message into the provided byte array,
-     * starting at position {@code offset}.
+     * Encodes up to {@code length} bytes of the message into the provided byte
+     * array, starting at position {@code offset}.
      *
-     * TODO describe what happens if length is smaller than the encoded form, Currently
-     * Proton-J throws an exception. What does Proton-C do?
+     * TODO describe what happens if length is smaller than the encoded form,
+     * Currently Proton-J throws an exception. What does Proton-C do?
      *
      * @return the number of bytes written to the byte array
      */
@@ -178,14 +177,16 @@ public interface Message
     /**
      * Loads message body from the {@code data}.
      *
-     * TODO describe how the object is interpreted according to the MessageFormat.
+     * TODO describe how the object is interpreted according to the
+     * MessageFormat.
      *
      * @see #setMessageFormat(MessageFormat)
      */
     void load(Object data);
 
     /**
-     * Return the message body in a format determined by {@link #getMessageFormat()}.
+     * Return the message body in a format determined by
+     * {@link #getMessageFormat()}.
      *
      * TODO describe the formatting process
      *
@@ -203,4 +204,4 @@ public interface Message
     void clear();
 
     MessageError getError();
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cbac8aa8/proton-j/src/main/java/org/apache/qpid/proton/message2/MessageImpl2.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/message2/MessageImpl2.java b/proton-j/src/main/java/org/apache/qpid/proton/message2/MessageImpl2.java
index 1450cfd..634d0e3 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/message2/MessageImpl2.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/message2/MessageImpl2.java
@@ -29,6 +29,10 @@ import org.apache.qpid.proton.amqp.Symbol;
 import org.apache.qpid.proton.amqp.UnsignedByte;
 import org.apache.qpid.proton.amqp.UnsignedInteger;
 import org.apache.qpid.proton.amqp.messaging.*;
+import org.apache.qpid.proton.codec.CompositeWritableBuffer;
+import org.apache.qpid.proton.codec.DroppingWritableBuffer;
+import org.apache.qpid.proton.codec.EncoderImpl;
+import org.apache.qpid.proton.codec.WritableBuffer;
 import org.apache.qpid.proton.codec2.*;
 import org.apache.qpid.proton.message.*;
 
@@ -585,7 +589,9 @@ public class MessageImpl2 implements Message
         decoder.decode(pb);
         System.out.println(pb.build());
 
-        if(buffer.hasRemaining())
+        return decoder.getSize();
+        
+        /*if(buffer.hasRemaining())
         {
             section = (Section) decoder
         }
@@ -678,7 +684,7 @@ public class MessageImpl2 implements Message
 
         }
 
-        decoder.setByteBuffer(null);
+        decoder.setByteBuffer(null); */
     }
 
     @Override
@@ -688,7 +694,7 @@ public class MessageImpl2 implements Message
         return encode(new WritableBuffer.ByteBufferWrapper(buffer));
     }
 
-    @Override
+    //@Override
     public int encode2(byte[] data, int offset, int length)
     {
         ByteBuffer buffer = ByteBuffer.wrap(data, offset, length);
@@ -700,11 +706,11 @@ public class MessageImpl2 implements Message
         return composite.position() - start;
     }
 
-    @Override
+    //@Override
     public int encode(WritableBuffer buffer)
     {
         int length = buffer.remaining();
-        EncoderImpl encoder = tlsCodec.get().encoder;
+        EncoderImpl encoder = null; //tlsCodec.get().encoder;
         encoder.setByteBuffer(buffer);
 
         if(getHeader() != null)
@@ -769,7 +775,7 @@ public class MessageImpl2 implements Message
                 {
                     binData = null;
                 }
-                _body = new Data(binData);
+                //_body = new Data(binData);
                 break;
             case TEXT:
                 _body = new AmqpValue(data == null ? "" : data.toString());
@@ -789,7 +795,7 @@ public class MessageImpl2 implements Message
             case DATA:
                 if(_body instanceof Data)
                 {
-                    return ((Data)_body).getValue().getArray();
+                    return null; // ((Data)_body).getValue().getArray();
                 }
                 else return null;
             case AMQP:
@@ -850,4 +856,18 @@ public class MessageImpl2 implements Message
     {
         return MessageError.OK;
     }
+
+    @Override
+    public org.apache.qpid.proton.amqp.messaging.Section getBodyAsSection(int i)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void addBodySection(org.apache.qpid.proton.amqp.messaging.Section section)
+    {
+        // TODO Auto-generated method stub
+        
+    }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org