[hornetq-commits] JBoss hornetq SVN: r8696 - in trunk/src/main/org/hornetq/core: client/impl and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 16 08:55:09 EST 2009


Author: jmesnil
Date: 2009-12-16 08:55:08 -0500 (Wed, 16 Dec 2009)
New Revision: 8696

Added:
   trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferInternal.java
Removed:
   trunk/src/main/org/hornetq/core/client/LargeMessageBuffer.java
Modified:
   trunk/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java
   trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
   trunk/src/main/org/hornetq/core/message/Message.java
   trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
   trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
Log:
HORNETQ-185 + HORNETQ-186: API review + javadoc

* removed LargeMessageBuffer from client API
* remove Message.getTypedProperties() method

Deleted: trunk/src/main/org/hornetq/core/client/LargeMessageBuffer.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/LargeMessageBuffer.java	2009-12-16 13:53:24 UTC (rev 8695)
+++ trunk/src/main/org/hornetq/core/client/LargeMessageBuffer.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -1,66 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.hornetq.core.client;
-
-import java.io.OutputStream;
-
-import org.hornetq.core.buffers.HornetQBuffer;
-import org.hornetq.core.exception.HornetQException;
-
-/**
- * A LargeMessageBuffer represents the buffer of a large message.
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- *
- *
- */
-public interface LargeMessageBuffer extends HornetQBuffer
-{
-   /**
-    * Returns the size of this buffer.
-
-    */
-   long getSize();
-
-   /**
-    * Discards packets unused by this buffer.
-    */
-   void discardUnusedPackets();
-
-   /**
-    * Closes this buffer.
-    */
-   void close();
-
-   /**
-    * Cancels this buffer.
-    */
-   void cancel();
-
-   /**
-    * Sets the OutputStream of this buffer to the specified output.
-    */
-   void setOutputStream(final OutputStream output) throws HornetQException;
-
-   /**
-    * Saves this buffer to the specified output.
-    */
-   void saveBuffer(final OutputStream output) throws HornetQException;
-
-   /**
-    * Waits for the completion for the specified waiting time (in milliseconds).
-    */
-   boolean waitCompletion(long timeWait) throws HornetQException;
-
-}

Modified: trunk/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java	2009-12-16 13:53:24 UTC (rev 8695)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientMessageImpl.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -20,7 +20,6 @@
 
 import org.hornetq.core.buffers.HornetQBuffer;
 import org.hornetq.core.buffers.HornetQBuffers;
-import org.hornetq.core.client.LargeMessageBuffer;
 import org.hornetq.core.exception.HornetQException;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.BodyEncoder;
@@ -150,7 +149,7 @@
    {
       if (largeMessage)
       {
-         ((LargeMessageBufferImpl)getWholeBuffer()).saveBuffer(out);
+         ((LargeMessageBufferInternal)getWholeBuffer()).saveBuffer(out);
       }
       else
       {
@@ -175,7 +174,7 @@
    {
       if (largeMessage)
       {
-         ((LargeMessageBufferImpl)getWholeBuffer()).setOutputStream(out);
+         ((LargeMessageBufferInternal)getWholeBuffer()).setOutputStream(out);
       }
       else
       {
@@ -191,7 +190,7 @@
    {
       if (largeMessage)
       {
-         return ((LargeMessageBufferImpl)getWholeBuffer()).waitCompletion(timeMilliseconds);
+         return ((LargeMessageBufferInternal)getWholeBuffer()).waitCompletion(timeMilliseconds);
       }
       else
       {
@@ -206,7 +205,7 @@
    {
       if (largeMessage)
       {
-         ((LargeMessageBuffer)getWholeBuffer()).discardUnusedPackets();
+         ((LargeMessageBufferInternal)getWholeBuffer()).discardUnusedPackets();
       }
    }
 

Modified: trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java	2009-12-16 13:53:24 UTC (rev 8695)
+++ trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -27,7 +27,6 @@
 import java.util.concurrent.TimeUnit;
 
 import org.hornetq.core.buffers.HornetQBuffer;
-import org.hornetq.core.client.LargeMessageBuffer;
 import org.hornetq.core.exception.HornetQException;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.remoting.impl.wireformat.SessionReceiveContinuationMessage;
@@ -44,7 +43,7 @@
  *
  *
  */
-public class LargeMessageBufferImpl implements LargeMessageBuffer
+public class LargeMessageBufferImpl implements LargeMessageBufferInternal
 {
    // Constants -----------------------------------------------------
 

Added: trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferInternal.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferInternal.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferInternal.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.hornetq.core.client.impl;
+
+import java.io.OutputStream;
+
+import org.hornetq.core.buffers.HornetQBuffer;
+import org.hornetq.core.exception.HornetQException;
+
+/**
+ * A LargeMessageBufferInternal
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface LargeMessageBufferInternal extends HornetQBuffer
+{
+   /**
+    * Returns the size of this buffer.
+
+    */
+   long getSize();
+
+   /**
+    * Discards packets unused by this buffer.
+    */
+   void discardUnusedPackets();
+
+   /**
+    * Closes this buffer.
+    */
+   void close();
+
+   /**
+    * Cancels this buffer.
+    */
+   void cancel();
+
+   /**
+    * Sets the OutputStream of this buffer to the specified output.
+    */
+   void setOutputStream(final OutputStream output) throws HornetQException;
+
+   /**
+    * Saves this buffer to the specified output.
+    */
+   void saveBuffer(final OutputStream output) throws HornetQException;
+
+   /**
+    * Waits for the completion for the specified waiting time (in milliseconds).
+    */
+   boolean waitCompletion(long timeWait) throws HornetQException;
+
+}

Modified: trunk/src/main/org/hornetq/core/message/Message.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/Message.java	2009-12-16 13:53:24 UTC (rev 8695)
+++ trunk/src/main/org/hornetq/core/message/Message.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -13,13 +13,11 @@
 
 package org.hornetq.core.message;
 
-import java.io.InputStream;
 import java.util.Map;
 import java.util.Set;
 
 import org.hornetq.core.buffers.HornetQBuffer;
 import org.hornetq.utils.SimpleString;
-import org.hornetq.utils.TypedProperties;
 
 /**
  * A Message is a routable instance that has a payload.
@@ -312,8 +310,6 @@
     */
    void putObjectProperty(String key, Object value) throws PropertyConversionException;
 
-   void putTypedProperties(TypedProperties properties);
-
    /**
     * Removes the property corresponding to the specified key.
     * @param key property name

Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java	2009-12-16 13:53:24 UTC (rev 8695)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -21,7 +21,7 @@
 import org.hornetq.core.buffers.HornetQBuffer;
 import org.hornetq.core.buffers.HornetQBuffers;
 import org.hornetq.core.buffers.impl.ResetLimitWrappedHornetQBuffer;
-import org.hornetq.core.client.LargeMessageBuffer;
+import org.hornetq.core.client.impl.LargeMessageBufferInternal;
 import org.hornetq.core.exception.HornetQException;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.BodyEncoder;
@@ -228,7 +228,7 @@
    {
       if (bodyBuffer == null)
       {
-         if (buffer instanceof LargeMessageBuffer == false)
+         if (buffer instanceof LargeMessageBufferInternal == false)
          {
             bodyBuffer = new ResetLimitWrappedHornetQBuffer(PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT,
                                                             buffer,

Modified: trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java	2009-12-16 13:53:24 UTC (rev 8695)
+++ trunk/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java	2009-12-16 13:55:08 UTC (rev 8696)
@@ -722,34 +722,30 @@
                ServerMessage notificationMessage = new ServerMessageImpl(messageID, 512);
 
                // Notification messages are always durable so the user can choose whether to add a durable queue to
-               // consume
-               // them in
+               // consume them in
                notificationMessage.setDurable(true);
                notificationMessage.setAddress(managementNotificationAddress);
 
-               TypedProperties notifProps;
                if (notification.getProperties() != null)
                {
-                  notifProps = new TypedProperties(notification.getProperties());
+                  TypedProperties props = notification.getProperties();
+                  for (SimpleString name : notification.getProperties().getPropertyNames())
+                  {
+                     notificationMessage.putObjectProperty(name, props.getProperty(name));
+                  }
                }
-               else
-               {
-                  notifProps = new TypedProperties();
-               }
 
-               notifProps.putSimpleStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE,
+               notificationMessage.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE,
                                                   new SimpleString(notification.getType().toString()));
 
-               notifProps.putLongProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP, System.currentTimeMillis());
+               notificationMessage.putLongProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP, System.currentTimeMillis());
 
                if (notification.getUID() != null)
                {
-                  notifProps.putSimpleStringProperty(new SimpleString("foobar"),
+                  notificationMessage.putStringProperty(new SimpleString("foobar"),
                                                      new SimpleString(notification.getUID()));
                }
 
-               notificationMessage.putTypedProperties(notifProps);
-
                postOffice.route(notificationMessage);
             }
          }



More information about the hornetq-commits mailing list