[hornetq-commits] JBoss hornetq SVN: r10733 - in branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq: core/client/impl and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed May 25 15:32:17 EDT 2011


Author: jicken
Date: 2011-05-25 15:32:16 -0400 (Wed, 25 May 2011)
New Revision: 10733

Modified:
   branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/api/core/client/ClientSession.java
   branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
   branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/persistence/tools/ManageDataTool.java
   branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
   branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/QueueQueryResult.java
   branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
Log:
revert of wireformat modifications
client requestor used for getting id of queue

Modified: branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/api/core/client/ClientSession.java
===================================================================
--- branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/api/core/client/ClientSession.java	2011-05-25 17:46:07 UTC (rev 10732)
+++ branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/api/core/client/ClientSession.java	2011-05-25 19:32:16 UTC (rev 10733)
@@ -57,11 +57,6 @@
    public interface QueueQuery
    {
       /**
-       * @return the ID of the queue.
-       */
-      long getId();
-
-      /**
        * Returns <code>true</code> if the queue exists, <code>false</code> else.
        */
       boolean isExists();

Modified: branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
--- branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java	2011-05-25 17:46:07 UTC (rev 10732)
+++ branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java	2011-05-25 19:32:16 UTC (rev 10733)
@@ -363,9 +363,7 @@
 
       SessionQueueQueryResponseMessage response = (SessionQueueQueryResponseMessage)channel.sendBlocking(request);
 
-      return new QueueQueryImpl(response.getId(),
-                                 response.getName(),
-                                 response.isDurable(),
+      return new QueueQueryImpl(response.isDurable(),
                                 response.getConsumerCount(),
                                 response.getMessageCount(),
                                 response.getFilterString(),
@@ -1857,11 +1855,9 @@
 
    private static class QueueQueryImpl implements QueueQuery
    {
-      private final long id;
 
-      private final SimpleString name;
-
       private final boolean exists;
+
       private final boolean durable;
 
       private final long messageCount;
@@ -1872,17 +1868,14 @@
 
       private final SimpleString address;
 
-      public QueueQueryImpl(final long id,
-                            final SimpleString name,
-                            final boolean durable,
+      public QueueQueryImpl(final boolean durable,
                             final int consumerCount,
                             final long messageCount,
                             final SimpleString filterString,
                             final SimpleString address,
                             final boolean exists)
       {
-         this.id = id;
-         this.name = name;
+
          this.durable = durable;
          this.consumerCount = consumerCount;
          this.messageCount = messageCount;
@@ -1891,10 +1884,6 @@
          this.exists = exists;
       }
 
-      public long getId() {
-         return id;
-      }
-
       public SimpleString getAddress()
       {
          return address;
@@ -1925,8 +1914,5 @@
          return exists;
       }
 
-      public SimpleString getName() {
-         return name;
-      }
    }
 }

Modified: branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/persistence/tools/ManageDataTool.java
===================================================================
--- branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/persistence/tools/ManageDataTool.java	2011-05-25 17:46:07 UTC (rev 10732)
+++ branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/persistence/tools/ManageDataTool.java	2011-05-25 19:32:16 UTC (rev 10733)
@@ -29,6 +29,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.jms.TextMessage;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
@@ -40,10 +41,13 @@
 import org.hornetq.api.core.SimpleString;
 import org.hornetq.api.core.client.ClientMessage;
 import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientRequestor;
 import org.hornetq.api.core.client.ClientSession;
 import org.hornetq.api.core.client.ClientSessionFactory;
 import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.api.core.management.ManagementHelper;
+import org.hornetq.api.core.management.ResourceNames;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.config.impl.FileConfiguration;
@@ -493,7 +497,7 @@
       final Map<Long, Long> queueMapping = new HashMap<Long, Long>();
 
       ClientSessionFactory sf = null;
-      
+
       try
       {
          sf = serverLocator.createSessionFactory();
@@ -516,8 +520,10 @@
                      queueQuery = coreSession.queueQuery(SimpleString.toSimpleString(queue.getName()));
                   }
 
+                  // todo: get new queue id
                   if (!queueMapping.containsKey(queue.getId())) {
-                     queueMapping.put(queue.getId(), queueQuery.getId());
+                     long newQueueId = getNewQueueId(queue);
+                     queueMapping.put(queue.getId(), newQueueId);
                   }
                }
 
@@ -527,6 +533,15 @@
                producer.close();
             }
 
+            private long getNewQueueId(QueueType queue) throws Exception {
+               ClientRequestor requestor = new ClientRequestor(coreSession, ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS);
+               ClientMessage m = coreSession.createMessage(false);
+               ManagementHelper.putAttribute(m, ResourceNames.CORE_QUEUE + queue.getName(), "ID");
+
+               final TextMessage reply = (TextMessage) requestor.request(m);
+               return Long.parseLong(reply.getText());
+            }
+
             private ClientMessage generateClientMessage(MessageType message) throws IOException
             {
                ClientMessage clientMessage = coreSession.createMessage(message.getType(),

Modified: branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java	2011-05-25 17:46:07 UTC (rev 10732)
+++ branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java	2011-05-25 19:32:16 UTC (rev 10733)
@@ -27,8 +27,6 @@
  */
 public class SessionQueueQueryResponseMessage extends PacketImpl
 {
-   private long id;
-
    private SimpleString name;
    
    private boolean exists;
@@ -47,7 +45,7 @@
 
    public SessionQueueQueryResponseMessage(final QueueQueryResult result)
    {
-      this(result.getId(), result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(),
+      this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(),
            result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists());
    }
 
@@ -56,21 +54,6 @@
       this(null, null, false, false, null, 0, 0, false);
    }
 
-   private SessionQueueQueryResponseMessage(final long id,
-                                            final SimpleString name,
-                                            final SimpleString address,
-                                            final boolean durable,
-                                            final boolean temporary,
-                                            final SimpleString filterString,
-                                            final int consumerCount,
-                                            final long messageCount,
-                                            final boolean exists)
-   {
-      this(name,address, durable, temporary, filterString, consumerCount, messageCount, exists);
-      this.id = id;
-
-   }
-
    private SessionQueueQueryResponseMessage(final SimpleString name,
                                             final SimpleString address,
                                             final boolean durable,
@@ -99,10 +82,6 @@
       this.exists = exists;
    }
 
-   public long getId() {
-      return id;
-   }
-
    @Override
    public boolean isResponse()
    {
@@ -160,7 +139,6 @@
       buffer.writeNullableSimpleString(filterString);
       buffer.writeNullableSimpleString(address);
       buffer.writeNullableSimpleString(name);
-      buffer.writeLong(id);
    }
 
    @Override
@@ -174,7 +152,6 @@
       filterString = buffer.readNullableSimpleString();
       address = buffer.readNullableSimpleString();
       name = buffer.readNullableSimpleString();
-      id = buffer.readLong();
    }
 
    @Override

Modified: branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/QueueQueryResult.java
===================================================================
--- branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/QueueQueryResult.java	2011-05-25 17:46:07 UTC (rev 10732)
+++ branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/QueueQueryResult.java	2011-05-25 19:32:16 UTC (rev 10733)
@@ -24,8 +24,6 @@
  */
 public class QueueQueryResult
 {
-   private long id;
-
    private SimpleString name;
    
    private boolean exists;
@@ -52,37 +50,12 @@
    {
       this(name, address, durable, temporary, filterString, consumerCount, messageCount, true);
    }
-   public QueueQueryResult(final long id,
-                           final SimpleString name,
-                                           final SimpleString address,
-                                           final boolean durable,
-                                           final boolean temporary,
-                                           final SimpleString filterString,
-                                           final int consumerCount,
-                                           final long messageCount)
-   {
-      this(id, name, address, durable, temporary, filterString, consumerCount, messageCount, true);
-   }
 
    public QueueQueryResult()
    {
       this(null, null, false, false, null, 0, 0, false);
    }
 
-   private QueueQueryResult(final long id,
-                            final SimpleString name,
-                                            final SimpleString address,
-                                            final boolean durable,
-                                            final boolean temporary,
-                                            final SimpleString filterString,
-                                            final int consumerCount,
-                                            final long messageCount,
-                                            final boolean exists)
-   {
-      this(name, address, durable, temporary, filterString, consumerCount, messageCount, exists);
-      this.id = id;
-   }
-
    private QueueQueryResult(final SimpleString name,
                                             final SimpleString address,
                                             final boolean durable,
@@ -109,10 +82,6 @@
       this.exists = exists;
    }
 
-   public long getId() {
-      return id;
-   }
-
    public boolean isExists()
    {
       return exists;

Modified: branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java	2011-05-25 17:46:07 UTC (rev 10732)
+++ branches/Branch_2_2_EAP_export_tool/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java	2011-05-25 19:32:16 UTC (rev 10733)
@@ -494,8 +494,7 @@
 
          SimpleString filterString = filter == null ? null : filter.getFilterString();
 
-         response = new QueueQueryResult(queue.getID(),
-                                         name,
+         response = new QueueQueryResult(name,
                                          binding.getAddress(),
                                          queue.isDurable(),
                                          queue.isTemporary(),



More information about the hornetq-commits mailing list