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 2010/09/02 21:08:08 UTC

svn commit: r992059 - in /qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address: AddressHelper.java Node.java

Author: rajith
Date: Thu Sep  2 19:08:08 2010
New Revision: 992059

URL: http://svn.apache.org/viewvc?rev=992059&view=rev
Log:
QPID-2845
Added code to recognize an arguments map within the x-bindings section.
Removed validation of the arguments specified in the above map.

Modified:
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java?rev=992059&r1=992058&r2=992059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/AddressHelper.java Thu Sep  2 19:08:08 2010
@@ -122,69 +122,6 @@ public class AddressHelper
         return mode != null && mode.equals(BROWSE) ? true : false;
     }
 
-    public QpidQueueOptions getQpidQueueOptions(MapAccessor args)
-    {
-        QpidQueueOptions options = new QpidQueueOptions();
-        if (args.getInt(QpidQueueOptions.QPID_MAX_COUNT) != null)
-        {
-            options.setMaxCount(args.getInt(QpidQueueOptions.QPID_MAX_COUNT));
-        }
-
-        if (args.getInt(QpidQueueOptions.QPID_MAX_SIZE) != null)
-        {
-            options.setMaxSize(args.getInt(QpidQueueOptions.QPID_MAX_SIZE));
-        }
-
-        if (args.getString(QpidQueueOptions.QPID_POLICY_TYPE) != null)
-        {
-            options.setPolicyType(args
-                    .getString(QpidQueueOptions.QPID_POLICY_TYPE));
-        }
-
-        if (args.getInt(QpidQueueOptions.QPID_PERSIST_LAST_NODE) != null)
-        {
-            options.setPersistLastNode();
-        }
-
-        if (args.getString(QpidQueueOptions.QPID_LAST_VALUE_QUEUE) != null)
-        {
-            options.setOrderingPolicy(QpidQueueOptions.QPID_LAST_VALUE_QUEUE);
-        } else if (args
-                .getString(QpidQueueOptions.QPID_LAST_VALUE_QUEUE_NO_BROWSE) != null)
-        {
-            options
-                    .setOrderingPolicy(QpidQueueOptions.QPID_LAST_VALUE_QUEUE_NO_BROWSE);
-        }
-
-        if (args.getString(QpidQueueOptions.QPID_QUEUE_EVENT_GENERATION) != null)
-        {
-            options.setQueueEvents(args
-                    .getString(QpidQueueOptions.QPID_QUEUE_EVENT_GENERATION));
-        }
-
-        return options;
-    }
-
-    public QpidExchangeOptions getQpidExchangeOptions(MapAccessor args)
-    {
-        QpidExchangeOptions options = new QpidExchangeOptions();
-        if (args.getInt(QpidExchangeOptions.QPID_EXCLUSIVE_BINDING) != null)
-        {
-            options.setExclusiveBinding();
-        }
-
-        if (args.getInt(QpidExchangeOptions.QPID_INITIAL_VALUE_EXCHANGE) != null)
-        {
-            options.setInitialValueExchange();
-        }
-
-        if (args.getInt(QpidExchangeOptions.QPID_MSG_SEQUENCE) != null)
-        {
-            options.setMessageSequencing();
-        }
-        return options;
-    }
-
     @SuppressWarnings("unchecked")
     public List<Binding> getBindings(Map props)
     {
@@ -209,9 +146,10 @@ public class AddressHelper
 
     public Map getDeclareArgs(Map props)
     {
-        if (props != null)
+        if (props != null && props.get(X_DECLARE) != null)
         {
             return (Map) props.get(X_DECLARE);
+            
         } else
         {
             return Collections.EMPTY_MAP;
@@ -260,7 +198,6 @@ public class AddressHelper
         ExchangeNode node = new ExchangeNode();
         node.setExchangeType(argsMap.getString(TYPE) == null ? null : argsMap
                 .getString(TYPE));
-        node.setDeclareArgs(getQpidExchangeOptions(argsMap));
         fillInCommonNodeArgs(node, parent, argsMap);
         return node;
     }
@@ -273,7 +210,6 @@ public class AddressHelper
         node.setAlternateExchange(argsMap.getString(ALT_EXCHANGE));
         node.setExclusive(argsMap.getBoolean(EXCLUSIVE) == null ? false
                 : argsMap.getBoolean(EXCLUSIVE));
-        node.setDeclareArgs(getQpidQueueOptions(argsMap));
         fillInCommonNodeArgs(node, parent, argsMap);
 
         return node;
@@ -290,6 +226,10 @@ public class AddressHelper
                 : argsMap.getBoolean(AUTO_DELETE));
         node.setAlternateExchange(argsMap.getString(ALT_EXCHANGE));
         node.setBindings(getBindings(parent));
+        if (getDeclareArgs(parent).containsKey(ARGUMENTS))
+        {
+            node.setDeclareArgs((Map<String,Object>)getDeclareArgs(parent).get(ARGUMENTS));
+        }
     }
 
     /**

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java?rev=992059&r1=992058&r2=992059&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/messaging/address/Node.java Thu Sep  2 19:08:08 2010
@@ -38,6 +38,7 @@ public abstract class Node
     protected boolean _isAutoDelete;
     protected String _alternateExchange;
     protected List<Binding> _bindings = new ArrayList<Binding>();
+    protected Map<String,Object> _declareArgs = Collections.emptyMap();
     
     public int getType()
     {
@@ -88,7 +89,15 @@ public abstract class Node
         this._bindings.add(binding);
     }
     
-    public abstract Map<String,Object> getDeclareArgs();
+    public Map<String,Object> getDeclareArgs()
+    {
+        return _declareArgs;
+    }
+    
+    public void setDeclareArgs(Map<String,Object> options)
+    {
+        _declareArgs = options;
+    }   
     
     public static class QueueNode extends Node 
     {
@@ -108,17 +117,7 @@ public abstract class Node
        public void setExclusive(boolean exclusive)
        {
            _isExclusive = exclusive;
-       }
-      
-       public Map<String,Object> getDeclareArgs()
-       {
-           return _queueOptions;
-       }       
-
-       public void setDeclareArgs(QpidQueueOptions options)
-       {
-           _queueOptions = options;
-       }       
+       }  
     }
     
     public static class ExchangeNode extends Node 
@@ -140,23 +139,10 @@ public abstract class Node
        {
            _exchangeType = exchangeType;
        }
-       
-       public Map<String,Object> getDeclareArgs()
-       {
-           return _exchangeOptions;
-       }
-       
-       public void setDeclareArgs(QpidExchangeOptions options)
-       {
-           _exchangeOptions = options;
-       }       
+    
     }
     
     public static class UnknownNodeType extends Node 
     {
-        public Map<String,Object> getDeclareArgs()
-        {
-            return Collections.emptyMap();
-        } 
     }
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org