qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1765986 - in /qpid/java/branches/transfer-queue: ./ bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ broker-core/src/main/java/org/apache/qpid/server/exchange/ broker-core/src/main/java/org/apache/qpid/server/message/ broker...
Date Fri, 21 Oct 2016 10:40:25 GMT
Author: rgodfrey
Date: Fri Oct 21 10:40:24 2016
New Revision: 1765986

URL: http://svn.apache.org/viewvc?rev=1765986&view=rev
Log:
merge up to r1764308 from trunk

Added:
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java   (props changed)
      - copied unchanged from r1765983, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java   (props changed)
      - copied unchanged from r1765983, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java
Modified:
    qpid/java/branches/transfer-queue/   (props changed)
    qpid/java/branches/transfer-queue/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultDestination.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/message/MessageDestination.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/OutboundTransferDestination.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/TransferQueueImpl.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AMQPConnection.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/SelectorThread.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/TransactionTimeoutTicker.java
    qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
    qpid/java/branches/transfer-queue/broker-core/src/test/java/org/apache/qpid/server/transport/TransactionTimeoutTickerTest.java
    qpid/java/branches/transfer-queue/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapter.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8Impl.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java
    qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
    qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementAddressSpace.java
    qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
    qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java
    qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java
    qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/transport/Connection.java
    qpid/java/branches/transfer-queue/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java

Propchange: qpid/java/branches/transfer-queue/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 21 10:40:24 2016
@@ -9,5 +9,5 @@
 /qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
 /qpid/branches/java-network-refactor/qpid/java:805429-821809
 /qpid/branches/qpid-2935/qpid/java:1061302-1072333
-/qpid/java/trunk:1763546-1763765
+/qpid/java/trunk:1763546-1764308
 /qpid/trunk/qpid:796646-796653

Modified: qpid/java/branches/transfer-queue/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java (original)
+++ qpid/java/branches/transfer-queue/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java Fri Oct 21 10:40:24 2016
@@ -1348,6 +1348,7 @@ public abstract class AbstractBDBMessage
 
         private void doPostCommitActions()
         {
+            // QPID-7447: prevent unnecessary allocation of empty iterator
             if (!_postCommitActions.isEmpty())
             {
                 for (Runnable action : _postCommitActions)

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java Fri Oct 21 10:40:24 2016
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.server.exchange;
 
+import java.security.AccessControlException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -59,12 +60,14 @@ import org.apache.qpid.server.model.Conf
 import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.server.model.ManagedAttributeField;
+import org.apache.qpid.server.model.NamedAddressSpace;
 import org.apache.qpid.server.model.Publisher;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.StateTransition;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.queue.BaseQueue;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.store.MessageEnqueueRecord;
 import org.apache.qpid.server.store.StorableMessageMetaData;
@@ -943,5 +946,16 @@ public abstract class AbstractExchange<T
         return binding;
     }
 
+    @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _virtualHost;
+    }
 
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+        authorise(token, Operation.ACTION("publish"), arguments);
+    }
 }

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultDestination.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultDestination.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultDestination.java Fri Oct 21 10:40:24 2016
@@ -18,25 +18,70 @@
  */
 package org.apache.qpid.server.exchange;
 
+import java.security.AccessControlException;
+import java.util.Map;
+
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.server.message.BaseMessageInstance;
 import org.apache.qpid.server.message.InstanceProperties;
 import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.ServerMessage;
+import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.Exchange;
+import org.apache.qpid.server.model.NamedAddressSpace;
+import org.apache.qpid.server.model.PermissionedObject;
 import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.security.AccessControl;
+import org.apache.qpid.server.security.Result;
+import org.apache.qpid.server.security.SecurityToken;
+import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.store.StorableMessageMetaData;
 import org.apache.qpid.server.txn.ServerTransaction;
 import org.apache.qpid.server.util.Action;
 
-public class DefaultDestination implements MessageDestination
+public class DefaultDestination implements MessageDestination, PermissionedObject
 {
 
+    private final AccessControl _accessControl;
     private VirtualHost<?> _virtualHost;
 
-    public DefaultDestination(VirtualHost<?> virtualHost)
+    public DefaultDestination(VirtualHost<?> virtualHost, final AccessControl accessControl)
     {
         _virtualHost =  virtualHost;
+        _accessControl = accessControl;
+    }
+
+    @Override
+    public Class<? extends ConfiguredObject> getCategoryClass()
+    {
+        return Exchange.class;
+    }
+
+    @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _virtualHost;
+    }
+
+
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+
+        if(_accessControl != null)
+        {
+            Result result = _accessControl.authorise(token, Operation.ACTION("publish"), this, arguments);
+            if (result == Result.DEFER)
+            {
+                result = _accessControl.getDefault();
+            }
+
+            if (result == Result.DENIED)
+            {
+                throw new AccessControlException("Access denied to publish to default exchange with arguments: " + arguments);
+            }
+        }
     }
 
     @Override

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/message/MessageDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/message/MessageDestination.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/message/MessageDestination.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/message/MessageDestination.java Fri Oct 21 10:40:24 2016
@@ -20,6 +20,11 @@
  */
 package org.apache.qpid.server.message;
 
+import java.security.AccessControlException;
+import java.util.Map;
+
+import org.apache.qpid.server.model.NamedAddressSpace;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.store.StorableMessageMetaData;
 import org.apache.qpid.server.txn.ServerTransaction;
 import org.apache.qpid.server.util.Action;
@@ -27,7 +32,11 @@ import org.apache.qpid.server.util.Actio
 public interface MessageDestination extends MessageNode
 {
 
-    public String getName();
+    String getName();
+
+    NamedAddressSpace getAddressSpace();
+
+    void authorisePublish(SecurityToken token, Map<String, Object> arguments) throws AccessControlException;
 
     /**
      * Routes a message

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java Fri Oct 21 10:40:24 2016
@@ -169,13 +169,15 @@ public abstract class AbstractUnresolved
         }
         else if(attrValue instanceof String)
         {
+            String interpolatedValue = AbstractConfiguredObject.interpolate(_parents[0], (String) attrValue);
+
             try
             {
-                _unresolvedObjects.add(new IdDependency(clazz, attributeName, UUID.fromString((String) attrValue)));
+                _unresolvedObjects.add(new IdDependency(clazz, attributeName, UUID.fromString(interpolatedValue)));
             }
             catch(IllegalArgumentException e)
             {
-                _unresolvedObjects.add(new NameDependency(clazz, attributeName, (String) attrValue));
+                _unresolvedObjects.add(new NameDependency(clazz, attributeName, interpolatedValue));
             }
         }
         else if(!clazz.isInstance(attrValue))

Propchange: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Oct 21 10:40:24 2016
@@ -0,0 +1,12 @@
+/qpid/branches/0.5.x-dev/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:886720-886722
+/qpid/branches/0.5.x-dev/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:886720-886722,887145,892761,894875,916304,916325,930288,931179
+/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1628068-1632579
+/qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1643238-1666219
+/qpid/branches/java-broker-0-10/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:795950-829653
+/qpid/branches/java-broker-amqp-1-0-management/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1562456-1569102
+/qpid/branches/java-broker-bdb-ha2/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1576683-1583556
+/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1584338-1584926
+/qpid/branches/java-broker-vhost-refactor/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1493674-1494547
+/qpid/branches/java-network-refactor/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:805429-821809
+/qpid/branches/qpid-2935/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:1061302-1072333
+/qpid/trunk/qpid/broker-core/src/main/java/org/apache/qpid/server/model/PermissionedObject.java:796646-796653

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java Fri Oct 21 10:40:24 2016
@@ -104,13 +104,23 @@ public interface Queue<X extends Queue<X
                                                  + "\"image/tiff\":\".tiff\","
                                                  + "\"text/plain\":\".txt\"}";
 
+    @ManagedContextDefault( name = "queue.defaultExclusivityPolicy",
+            description = "the ExclusivityPolicy to apply to queues where none is explicitly set")
+    String DEFAULT_EXCLUSIVITY = "NONE";
+
     @ManagedAttribute
     Exchange getAlternateExchange();
 
-    @ManagedAttribute( defaultValue = "NONE" )
+    @ManagedAttribute( defaultValue = "${queue.defaultExclusivityPolicy}")
     ExclusivityPolicy getExclusive();
 
-    @ManagedAttribute( defaultValue = "false" )
+    @ManagedContextDefault( name = "queue.defaultEnsureNonDestructiveConsumers",
+            description = "the value to use for the ensureNondestructiveCnsumers attribute of a queue where "
+                          + "none is explicitly set")
+    String DEFAULT_ENSURE_NON_DESTRUCTIVE_CONSUMERS = "false";
+
+
+    @ManagedAttribute( defaultValue = "${queue.defaultEnsureNonDestructiveConsumers}" )
     boolean isEnsureNondestructiveConsumers();
 
     @DerivedAttribute( persist = true )
@@ -192,7 +202,14 @@ public interface Queue<X extends Queue<X
     @ManagedAttribute( defaultValue = "${queue.alertRepeatGap}")
     long getAlertRepeatGap();
 
-    @ManagedAttribute( defaultValue = "DEFAULT" )
+    @ManagedContextDefault( name = "queue.defaultMessageDurability",
+            description = "the value to use for the messageDurability attribute of a queue where "
+                          + "none is explicitly set")
+    String DEFAULT_MESSAGE_DURABILTY = "DEFAULT";
+
+
+
+    @ManagedAttribute( defaultValue = "${queue.defaultMessageDurability}" )
     MessageDurability getMessageDurability();
 
     @ManagedAttribute

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java Fri Oct 21 10:40:24 2016
@@ -216,20 +216,20 @@ public final class SessionAdapter extend
             final VirtualHost virtualhost = (VirtualHost) addressSpace;
             final List<Ticker> tickers = new ArrayList<>(4);
 
-            final Supplier<Date> transactionStartTimeSupplier = new Supplier<Date>()
+            final Supplier<Long> transactionStartTimeSupplier = new Supplier<Long>()
             {
                 @Override
-                public Date get()
+                public Long get()
                 {
-                    return SessionAdapter.this.getTransactionStartTime();
+                    return SessionAdapter.this._session.getTransactionStartTime();
                 }
             };
-            final Supplier<Date> transactionUpdateTimeSupplier = new Supplier<Date>()
+            final Supplier<Long> transactionUpdateTimeSupplier = new Supplier<Long>()
             {
                 @Override
-                public Date get()
+                public Long get()
                 {
-                    return SessionAdapter.this.getTransactionUpdateTime();
+                    return SessionAdapter.this._session.getTransactionUpdateTime();
                 }
             };
 

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java Fri Oct 21 10:40:24 2016
@@ -98,6 +98,7 @@ import org.apache.qpid.server.plugin.Mes
 import org.apache.qpid.server.plugin.QpidServiceLoader;
 import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.protocol.MessageConverterRegistry;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.store.MessageDurability;
@@ -3559,6 +3560,20 @@ public abstract class AbstractQueue<X ex
         }
     }
 
+    @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _virtualHost;
+    }
+
+
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+        authorise(token, Operation.ACTION("publish"), arguments);
+    }
+
     private class DeletedChildListener extends AbstractConfigurationChangeListener
     {
         @Override

Propchange: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Oct 21 10:40:24 2016
@@ -0,0 +1,12 @@
+/qpid/branches/0.5.x-dev/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:886720-886722
+/qpid/branches/0.5.x-dev/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:886720-886722,887145,892761,894875,916304,916325,930288,931179
+/qpid/branches/QPID-6125-ProtocolRefactoring/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1628068-1632579
+/qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1643238-1666219
+/qpid/branches/java-broker-0-10/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:795950-829653
+/qpid/branches/java-broker-amqp-1-0-management/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1562456-1569102
+/qpid/branches/java-broker-bdb-ha2/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1576683-1583556
+/qpid/branches/java-broker-config-store-changes/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1584338-1584926
+/qpid/branches/java-broker-vhost-refactor/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1493674-1494547
+/qpid/branches/java-network-refactor/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:805429-821809
+/qpid/branches/qpid-2935/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:1061302-1072333
+/qpid/trunk/qpid/broker-core/src/main/java/org/apache/qpid/server/security/SubjectFixedResultAccessControl.java:796646-796653

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java Fri Oct 21 10:40:24 2016
@@ -1193,6 +1193,7 @@ public abstract class AbstractJDBCMessag
 
         private void doPostCommitActions()
         {
+            // QPID-7447: prevent unnecessary allocation of empty iterator
             if (!_postCommitActions.isEmpty())
             {
                 for (Runnable action : _postCommitActions)

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/OutboundTransferDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/OutboundTransferDestination.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/OutboundTransferDestination.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/OutboundTransferDestination.java Fri Oct 21 10:40:24 2016
@@ -20,13 +20,18 @@
  */
 package org.apache.qpid.server.transfer;
 
+import java.security.AccessControlException;
+import java.util.Map;
+
 import org.apache.qpid.server.message.BaseMessageInstance;
 import org.apache.qpid.server.message.InstanceProperties;
 import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.MessageReference;
 import org.apache.qpid.server.message.ServerMessage;
+import org.apache.qpid.server.model.NamedAddressSpace;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.store.MessageEnqueueRecord;
 import org.apache.qpid.server.store.StorableMessageMetaData;
 import org.apache.qpid.server.txn.ServerTransaction;
@@ -51,6 +56,19 @@ public class OutboundTransferDestination
     }
 
     @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _virtualHost;
+    }
+
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+
+    }
+
+    @Override
     public <M extends ServerMessage<? extends StorableMessageMetaData>> int send(final M message,
                                                                                  final String routingAddress,
                                                                                  final InstanceProperties instanceProperties,

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/TransferQueueImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/TransferQueueImpl.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/TransferQueueImpl.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transfer/TransferQueueImpl.java Fri Oct 21 10:40:24 2016
@@ -21,7 +21,9 @@
 package org.apache.qpid.server.transfer;
 
 import java.nio.charset.StandardCharsets;
+import java.security.AccessControlException;
 import java.util.Collection;
+import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -31,9 +33,11 @@ import org.apache.qpid.server.message.Ba
 import org.apache.qpid.server.message.InstanceProperties;
 import org.apache.qpid.server.message.MessageReference;
 import org.apache.qpid.server.message.ServerMessage;
+import org.apache.qpid.server.model.NamedAddressSpace;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.queue.QueueEntry;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.store.MessageDurability;
 import org.apache.qpid.server.store.MessageEnqueueRecord;
 import org.apache.qpid.server.store.StorableMessageMetaData;
@@ -324,6 +328,19 @@ public class TransferQueueImpl implement
     }
 
     @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _virtualHost;
+    }
+
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+        // TODO
+    }
+
+    @Override
     public <M extends ServerMessage<? extends StorableMessageMetaData>> int send(final M message,
                                                                                  final String routingAddress,
                                                                                  final InstanceProperties instanceProperties,

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AMQPConnection.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AMQPConnection.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AMQPConnection.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AMQPConnection.java Fri Oct 21 10:40:24 2016
@@ -23,7 +23,7 @@ package org.apache.qpid.server.transport
 import java.net.SocketAddress;
 import java.security.AccessControlContext;
 import java.security.Principal;
-import java.util.List;
+import java.util.Collection;
 
 import javax.security.auth.Subject;
 
@@ -83,11 +83,11 @@ public interface AMQPConnection<C extend
     void stopConnection();
 
     /**
-     * Returns the a list of session models.  Required to return a copy.
+     * Returns the a view of session models.  Callers may not modify the returned view Required to return a copy.
      *
      * @return list of sessions
      */
-    List<? extends AMQSessionModel<?>> getSessionModels();
+    Collection<? extends AMQSessionModel<?>> getSessionModels();
 
     void resetStatistics();
 }

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/AggregateTicker.java Fri Oct 21 10:40:24 2016
@@ -32,6 +32,7 @@ public class AggregateTicker implements
     public int getTimeToNextTick(final long currentTime)
     {
         int nextTick = Integer.MAX_VALUE;
+        // QPID-7447: prevent unnecessary allocation of empty iterator
         if (!_tickers.isEmpty())
         {
             for (Ticker ticker : _tickers)
@@ -46,9 +47,13 @@ public class AggregateTicker implements
     public int tick(final long currentTime)
     {
         int nextTick = Integer.MAX_VALUE;
-        for(Ticker ticker : _tickers)
+        // QPID-7447: prevent unnecessary allocation of empty iterator
+        if (!_tickers.isEmpty())
         {
-            nextTick = Math.min(ticker.tick(currentTime), nextTick);
+            for(Ticker ticker : _tickers)
+            {
+                nextTick = Math.min(ticker.tick(currentTime), nextTick);
+            }
         }
         return nextTick;
     }
@@ -71,6 +76,7 @@ public class AggregateTicker implements
     @Override
     public void notifySchedulingDelay(final long schedulingDelay)
     {
+        // QPID-7447: prevent unnecessary allocation of empty iterator
         if (!_tickers.isEmpty())
         {
             for (Ticker ticker : _tickers)

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/SelectorThread.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/SelectorThread.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/SelectorThread.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/SelectorThread.java Fri Oct 21 10:40:24 2016
@@ -150,7 +150,8 @@ class SelectorThread extends Thread
                 }
             }
 
-            return toBeScheduled;
+            // QPID-7447: prevent unnecessary allocation of empty iterator
+            return toBeScheduled.isEmpty() ? Collections.<SchedulableConnection>emptyList() : toBeScheduled;
         }
 
         private List<SchedulableConnection> processSelectionKeys()
@@ -261,7 +262,8 @@ class SelectorThread extends Thread
                 }
             }
 
-            return unregisterableConnections;
+            // QPID-7447: prevent unnecessary allocation of empty iterator
+            return unregisterableConnections.isEmpty() ? Collections.<SchedulableConnection>emptyList() : unregisterableConnections;
         }
 
         private void performSelect()

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/TransactionTimeoutTicker.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/TransactionTimeoutTicker.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/TransactionTimeoutTicker.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/transport/TransactionTimeoutTicker.java Fri Oct 21 10:40:24 2016
@@ -21,7 +21,6 @@
 
 package org.apache.qpid.server.transport;
 
-import java.util.Date;
 import java.util.concurrent.atomic.AtomicLong;
 
 import com.google.common.base.Supplier;
@@ -33,7 +32,7 @@ public class TransactionTimeoutTicker im
 {
     private final long _timeoutValue;
     private final Action<Long> _notification;
-    private final Supplier<Date> _timeSupplier;
+    private final Supplier<Long> _timeSupplier;
     private final long _notificationRepeatPeriod;
 
     private AtomicLong _accumulatedSchedulingDelay = new AtomicLong();
@@ -44,12 +43,12 @@ public class TransactionTimeoutTicker im
 
     public TransactionTimeoutTicker(long timeoutValue,
                                     long notificationRepeatPeriod,
-                                    Supplier<Date> timeStampSupplier,
+                                    Supplier<Long> timeStampSupplier,
                                     Action<Long> notification)
     {
         _timeoutValue = timeoutValue;
         _notification = notification;
-        _lastTransactionTimeStamp = timeStampSupplier.get().getTime();
+        _lastTransactionTimeStamp = timeStampSupplier.get();
         _timeSupplier = timeStampSupplier;
         _notificationRepeatPeriod = notificationRepeatPeriod;
     }
@@ -57,7 +56,7 @@ public class TransactionTimeoutTicker im
     @Override
     public int getTimeToNextTick(final long currentTime)
     {
-        final long transactionTimeStamp = _timeSupplier.get().getTime();
+        final long transactionTimeStamp = _timeSupplier.get();
         int tick = calculateTimeToNextTick(currentTime, transactionTimeStamp);
         if (tick <= 0 && _nextNotificationTime > currentTime)
         {
@@ -69,7 +68,7 @@ public class TransactionTimeoutTicker im
     @Override
     public int tick(final long currentTime)
     {
-        final long transactionTimeStamp = _timeSupplier.get().getTime();
+        final long transactionTimeStamp = _timeSupplier.get();
         int tick = calculateTimeToNextTick(currentTime, transactionTimeStamp);
         if (tick <= 0)
         {

Modified: qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java Fri Oct 21 10:40:24 2016
@@ -286,7 +286,6 @@ public abstract class AbstractVirtualHos
 
         _eventLogger.message(VirtualHostMessages.CREATED(getName()));
 
-        _defaultDestination = new DefaultDestination(this);
 
         _messagesDelivered = new StatisticsCounter("messages-delivered-" + getName());
         _dataDelivered = new StatisticsCounter("bytes-delivered-" + getName());
@@ -305,6 +304,9 @@ public abstract class AbstractVirtualHos
             );
         }
 
+        _defaultDestination = new DefaultDestination(this, _accessControl);
+
+
         _housekeepingJobContext = getSystemTaskControllerContext("Housekeeping["+getName()+"]", _principal);
         _fileSystemSpaceCheckerJobContext = getSystemTaskControllerContext("FileSystemSpaceChecker["+getName()+"]", _principal);
 

Modified: qpid/java/branches/transfer-queue/broker-core/src/test/java/org/apache/qpid/server/transport/TransactionTimeoutTickerTest.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-core/src/test/java/org/apache/qpid/server/transport/TransactionTimeoutTickerTest.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-core/src/test/java/org/apache/qpid/server/transport/TransactionTimeoutTickerTest.java (original)
+++ qpid/java/branches/transfer-queue/broker-core/src/test/java/org/apache/qpid/server/transport/TransactionTimeoutTickerTest.java Fri Oct 21 10:40:24 2016
@@ -29,8 +29,6 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import java.util.Date;
-
 import com.google.common.base.Supplier;
 import org.mockito.InOrder;
 
@@ -41,7 +39,7 @@ public class TransactionTimeoutTickerTes
 {
 
     private TransactionTimeoutTicker _ticker;
-    private Supplier<Date> _dateSupplier = mock(Supplier.class);
+    private Supplier<Long> _dateSupplier = mock(Supplier.class);
     private Action<Long> _notificationAction = mock(Action.class);
     private long _timeoutValue = 100;
     private long _notificationRepeatPeriod = 5000;
@@ -50,7 +48,7 @@ public class TransactionTimeoutTickerTes
     {
         final long timeNow = System.currentTimeMillis();
 
-        when(_dateSupplier.get()).thenReturn(new Date(0));
+        when(_dateSupplier.get()).thenReturn(0L);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,
@@ -68,7 +66,7 @@ public class TransactionTimeoutTickerTes
         final long timeNow = System.currentTimeMillis();
         final long transactionTime = timeNow - 90;
 
-        when(_dateSupplier.get()).thenReturn(new Date(transactionTime));
+        when(_dateSupplier.get()).thenReturn(transactionTime);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,
@@ -87,7 +85,7 @@ public class TransactionTimeoutTickerTes
         final long timeNow = System.currentTimeMillis();
         final long transactionTime = timeNow - 90;
 
-        when(_dateSupplier.get()).thenReturn(new Date(transactionTime));
+        when(_dateSupplier.get()).thenReturn(transactionTime);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,
@@ -109,7 +107,7 @@ public class TransactionTimeoutTickerTes
         final long firstTransactionTime = timeNow - 10;
 
         // First transaction
-        when(_dateSupplier.get()).thenReturn(new Date(firstTransactionTime));
+        when(_dateSupplier.get()).thenReturn(firstTransactionTime);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,
@@ -124,7 +122,7 @@ public class TransactionTimeoutTickerTes
         timeNow += 100;
         final long secondTransactionTime = timeNow - 5;
 
-        when(_dateSupplier.get()).thenReturn(new Date(secondTransactionTime));
+        when(_dateSupplier.get()).thenReturn(secondTransactionTime);
 
         final int expectedTickForSecondTransaction = 95;
         assertTickTime("Unexpected ticker value for second transaction",
@@ -140,7 +138,7 @@ public class TransactionTimeoutTickerTes
         final long firstTransactionTime = timeNow - 10;
 
         // First transaction
-        when(_dateSupplier.get()).thenReturn(new Date(firstTransactionTime));
+        when(_dateSupplier.get()).thenReturn(firstTransactionTime);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,
@@ -156,7 +154,7 @@ public class TransactionTimeoutTickerTes
         timeNow += 100;
         final long secondTransactionTime = timeNow - 5;
 
-        when(_dateSupplier.get()).thenReturn(new Date(secondTransactionTime));
+        when(_dateSupplier.get()).thenReturn(secondTransactionTime);
 
         final int expectedTickForSecondTransaction = 95;
         assertTickTime("Unexpected ticker value for second transaction",
@@ -171,7 +169,7 @@ public class TransactionTimeoutTickerTes
         long timeNow = System.currentTimeMillis();
         final long transactionTime = timeNow - 110;
 
-        when(_dateSupplier.get()).thenReturn(new Date(transactionTime));
+        when(_dateSupplier.get()).thenReturn(transactionTime);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,
@@ -192,7 +190,7 @@ public class TransactionTimeoutTickerTes
         long timeNow = System.currentTimeMillis();
         final long transactionTime = timeNow - 110;
 
-        when(_dateSupplier.get()).thenReturn(new Date(transactionTime));
+        when(_dateSupplier.get()).thenReturn(transactionTime);
 
         _ticker = new TransactionTimeoutTicker(_timeoutValue, _notificationRepeatPeriod,
                                                _dateSupplier,

Modified: qpid/java/branches/transfer-queue/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapter.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapter.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapter.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/LegacyAccessControlAdapter.java Fri Oct 21 10:40:24 2016
@@ -35,6 +35,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.model.*;
 import org.apache.qpid.server.queue.QueueConsumer;
 import org.apache.qpid.server.security.Result;
@@ -341,12 +342,12 @@ class LegacyAccessControlAdapter
         Class<? extends ConfiguredObject> categoryClass = configuredObject.getCategoryClass();
         if(categoryClass == Exchange.class)
         {
-            Exchange exchange = (Exchange) configuredObject;
+            MessageDestination exchange = (MessageDestination) configuredObject;
             if("publish".equals(actionName))
             {
 
                 final ObjectProperties _props =
-                        new ObjectProperties(exchange.getParent(VirtualHost.class).getName(), exchange.getName(), (String)arguments.get("routingKey"), (Boolean)arguments.get("immediate"));
+                        new ObjectProperties(exchange.getAddressSpace().getName(), exchange.getName(), (String)arguments.get("routingKey"), (Boolean)arguments.get("immediate"));
                 return _accessControl.authorise(PUBLISH, EXCHANGE, _props);
             }
         }

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java Fri Oct 21 10:40:24 2016
@@ -24,9 +24,9 @@ import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -313,7 +313,7 @@ public class AMQPConnection_0_10 extends
         return _connection.getRemoteContainerName();
     }
 
-    public List<ServerSession> getSessionModels()
+    public Collection<? extends AMQSessionModel<?>> getSessionModels()
     {
         return _connection.getSessionModels();
     }

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java Fri Oct 21 10:40:24 2016
@@ -28,6 +28,8 @@ import java.security.AccessController;
 import java.security.Principal;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
@@ -335,16 +337,16 @@ public class ServerConnection extends Co
         super.removeSession(ssn);
     }
 
-    public List<ServerSession> getSessionModels()
+    public Collection<? extends ServerSession> getSessionModels()
     {
-        List<ServerSession> sessions = new ArrayList<>();
-        for (Session ssn : getChannels())
-        {
-            sessions.add((ServerSession) ssn);
-        }
-        return sessions;
+        return Collections.unmodifiableCollection(getChannels());
     }
 
+    @Override
+    protected Collection<ServerSession> getChannels()
+    {
+        return  (Collection<ServerSession>) super.getChannels();
+    }
 
     /**
      * @return authorizedSubject
@@ -502,11 +504,11 @@ public class ServerConnection extends Co
 
     private class ProcessPendingIterator implements Iterator<Runnable>
     {
-        private final List<? extends AMQSessionModel<?>> _sessionsWithPending;
+        private final Collection<? extends ServerSession> _sessionsWithPending;
         private Iterator<? extends AMQSessionModel<?>> _sessionIterator;
         private ProcessPendingIterator()
         {
-            _sessionsWithPending = getSessionModels();
+            _sessionsWithPending = new ArrayList<>(getSessionModels());
             _sessionIterator = _sessionsWithPending.iterator();
         }
 

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java Fri Oct 21 10:40:24 2016
@@ -1211,6 +1211,7 @@ public class ServerSession extends Sessi
             consumerListNeedsRefreshing = true;
         }
 
+        // QPID-7447: prevent unnecessary allocation of empty iterator
         Iterator<ConsumerTarget> iter = _consumersWithPendingWork.isEmpty() ? Collections.<ConsumerTarget>emptyIterator() : _consumersWithPendingWork.iterator();
 
         boolean consumerHasMoreWork = false;

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java Fri Oct 21 10:40:24 2016
@@ -41,36 +41,32 @@ import org.apache.qpid.bytebuffer.QpidBy
 import org.apache.qpid.common.AMQPFilterTypes;
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.logging.EventLogger;
-import org.apache.qpid.server.message.ConsumerOption;
-import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.Exchange;
-import org.apache.qpid.server.model.NamedAddressSpace;
-import org.apache.qpid.server.security.access.Operation;
-import org.apache.qpid.server.transport.ProtocolEngine;
-import org.apache.qpid.server.store.MessageHandle;
-import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
-import org.apache.qpid.server.virtualhost.VirtualHostUnavailableException;
 import org.apache.qpid.server.filter.AMQInvalidArgumentException;
 import org.apache.qpid.server.filter.ArrivalTimeFilter;
 import org.apache.qpid.server.filter.FilterManager;
 import org.apache.qpid.server.filter.FilterManagerFactory;
 import org.apache.qpid.server.filter.MessageFilter;
+import org.apache.qpid.server.logging.EventLogger;
 import org.apache.qpid.server.logging.messages.ChannelMessages;
 import org.apache.qpid.server.logging.messages.ExchangeMessages;
+import org.apache.qpid.server.message.ConsumerOption;
 import org.apache.qpid.server.message.InstanceProperties;
 import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.MessageReference;
 import org.apache.qpid.server.message.MessageSource;
+import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.model.ExclusivityPolicy;
 import org.apache.qpid.server.model.LifetimePolicy;
+import org.apache.qpid.server.model.NamedAddressSpace;
 import org.apache.qpid.server.model.NoFactoryForTypeException;
 import org.apache.qpid.server.model.Queue;
 import org.apache.qpid.server.model.UnknownConfiguredObjectException;
 import org.apache.qpid.server.queue.QueueArgumentsConverter;
+import org.apache.qpid.server.store.MessageHandle;
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.store.StoreException;
 import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.transport.ProtocolEngine;
 import org.apache.qpid.server.txn.AlreadyKnownDtxException;
 import org.apache.qpid.server.txn.DtxNotSelectedException;
 import org.apache.qpid.server.txn.IncorrectDtxStateException;
@@ -81,12 +77,14 @@ import org.apache.qpid.server.txn.Server
 import org.apache.qpid.server.txn.SuspendAndFailDtxException;
 import org.apache.qpid.server.txn.TimeoutDtxException;
 import org.apache.qpid.server.txn.UnknownDtxBranchException;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.ExchangeExistsException;
 import org.apache.qpid.server.virtualhost.ExchangeIsAlternateException;
 import org.apache.qpid.server.virtualhost.QueueExistsException;
 import org.apache.qpid.server.virtualhost.RequiredExchangeException;
 import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.VirtualHostUnavailableException;
 import org.apache.qpid.transport.*;
 
 public class ServerSessionDelegate extends SessionDelegate
@@ -445,15 +443,11 @@ public class ServerSessionDelegate exten
                 try
                 {
                     serverSession.getAMQPConnection().checkAuthorizedMessagePrincipal(getMessageUserId(xfr));
-                    if(destination instanceof ConfiguredObject)
-                    {
+                    destination.authorisePublish(serverSession.getToken(),
+                                                 PUBLISH_ACTION_MAP_CREATOR.createMap(messageMetaData.getRoutingKey(),
+                                                                                      messageMetaData.isImmediate()));
 
-                        ((ConfiguredObject)destination).authorise(serverSession.getToken(),
-                                                                  Operation.ACTION("publish"),
-                                                                  PUBLISH_ACTION_MAP_CREATOR.createMap(messageMetaData.getRoutingKey(),
-                                                                                                       messageMetaData.isImmediate()));
 
-                    };
                 }
                 catch (AccessControlException e)
                 {

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java Fri Oct 21 10:40:24 2016
@@ -101,7 +101,6 @@ import org.apache.qpid.server.protocol.C
 import org.apache.qpid.server.protocol.ConsumerListener;
 import org.apache.qpid.server.queue.QueueArgumentsConverter;
 import org.apache.qpid.server.security.SecurityToken;
-import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.store.MessageHandle;
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.store.StoredMessage;
@@ -431,18 +430,12 @@ public class AMQChannel
 
             try
             {
+                final MessageDestination destination = _currentMessage.getDestination();
+
                 ContentHeaderBody contentHeader = _currentMessage.getContentHeader();
                 _connection.checkAuthorizedMessagePrincipal(AMQShortString.toString(contentHeader.getProperties().getUserId()));
 
-                if(_currentMessage.getDestination() instanceof ConfiguredObject)
-                {
-
-                    ((ConfiguredObject)_currentMessage.getDestination()).authorise(_token,
-                                                                                   Operation.ACTION("publish"),
-                                                                                   AbstractAMQPConnection.PUBLISH_ACTION_MAP_CREATOR.createMap(routingKey, info.isImmediate()));
-
-                };
-
+                destination.authorisePublish(_token, AbstractAMQPConnection.PUBLISH_ACTION_MAP_CREATOR.createMap(routingKey, info.isImmediate()));
 
                 if (_confirmOnPublish)
                 {
@@ -457,7 +450,6 @@ public class AMQChannel
                 {
 
                     final MessagePublishInfo messagePublishInfo = _currentMessage.getMessagePublishInfo();
-                    final MessageDestination destination = _currentMessage.getDestination();
 
                     final MessageMetaData messageMetaData =
                             new MessageMetaData(messagePublishInfo,
@@ -3754,6 +3746,7 @@ public class AMQChannel
             consumerListNeedsRefreshing = true;
         }
 
+        // QPID-7447: prevent unnecessary allocation of empty iterator
         Iterator<ConsumerTarget_0_8> iter = _consumersWithPendingWork.isEmpty() ? Collections.<ConsumerTarget_0_8>emptyIterator() : _consumersWithPendingWork.iterator();
 
         boolean consumerHasMoreWork = false;

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8Impl.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8Impl.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8Impl.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8Impl.java Fri Oct 21 10:40:24 2016
@@ -31,6 +31,7 @@ import java.security.AccessController;
 import java.security.Principal;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -849,9 +850,9 @@ public class AMQPConnection_0_8Impl
     }
 
     @Override
-    public List<AMQChannel> getSessionModels()
+    public Collection<? extends AMQChannel> getSessionModels()
     {
-        return new ArrayList<>(_channelMap.values());
+        return Collections.unmodifiableCollection(_channelMap.values());
     }
 
     @Override
@@ -1414,11 +1415,11 @@ public class AMQPConnection_0_8Impl
 
     private class ProcessPendingIterator implements Iterator<Runnable>
     {
-        private final List<? extends AMQSessionModel<?>> _sessionsWithPending;
+        private final Collection<? extends AMQChannel> _sessionsWithPending;
         private Iterator<? extends AMQSessionModel<?>> _sessionIterator;
         private ProcessPendingIterator()
         {
-            _sessionsWithPending = getSessionModels();
+            _sessionsWithPending = new ArrayList<>(getSessionModels());
             _sessionIterator = _sessionsWithPending.iterator();
         }
 

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java Fri Oct 21 10:40:24 2016
@@ -1423,9 +1423,9 @@ public class AMQPConnection_1_0 extends
         return _remoteContainerId;
     }
 
-    public List<Session_1_0> getSessionModels()
+    public Collection<? extends Session_1_0> getSessionModels()
     {
-        return new ArrayList<>(_sessions);
+        return Collections.unmodifiableCollection(_sessions);
     }
 
     public void unblock()
@@ -1532,11 +1532,11 @@ public class AMQPConnection_1_0 extends
 
     private class ProcessPendingIterator implements Iterator<Runnable>
     {
-        private final List<? extends AMQSessionModel<?>> _sessionsWithPending;
+        private final Collection<? extends AMQSessionModel<?>> _sessionsWithPending;
         private Iterator<? extends AMQSessionModel<?>> _sessionIterator;
         private ProcessPendingIterator()
         {
-            _sessionsWithPending = getSessionModels();
+            _sessionsWithPending = new ArrayList<>(getSessionModels());
             _sessionIterator = _sessionsWithPending.iterator();
         }
 

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java Fri Oct 21 10:40:24 2016
@@ -26,16 +26,15 @@ import java.util.Collections;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.qpid.server.message.InstanceProperties;
+import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.protocol.v1_0.type.Outcome;
 import org.apache.qpid.server.protocol.v1_0.type.Symbol;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.Accepted;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.Rejected;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.TerminusDurability;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.TerminusExpiryPolicy;
-import org.apache.qpid.server.message.InstanceProperties;
-import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.security.SecurityToken;
-import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.txn.ServerTransaction;
 
 public class ExchangeDestination implements ReceivingDestination, SendingDestination
@@ -116,8 +115,7 @@ public class ExchangeDestination impleme
     @Override
     public void authorizePublish(final SecurityToken securityToken, final Message_1_0 message)
     {
-        _exchange.authorise(securityToken,
-                            Operation.ACTION("publish"),
+        _exchange.authorisePublish(securityToken,
                             Collections.<String,Object>singletonMap("routingKey", getRoutingAddress(message)));
 
 

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java Fri Oct 21 10:40:24 2016
@@ -23,7 +23,8 @@ package org.apache.qpid.server.protocol.
 import java.util.Arrays;
 import java.util.Collections;
 
-import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.message.InstanceProperties;
+import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.protocol.v1_0.type.Outcome;
 import org.apache.qpid.server.protocol.v1_0.type.Symbol;
@@ -31,10 +32,7 @@ import org.apache.qpid.server.protocol.v
 import org.apache.qpid.server.protocol.v1_0.type.messaging.Rejected;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.TerminusDurability;
 import org.apache.qpid.server.protocol.v1_0.type.messaging.TerminusExpiryPolicy;
-import org.apache.qpid.server.message.InstanceProperties;
-import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.security.SecurityToken;
-import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.txn.ServerTransaction;
 
 public class NodeReceivingDestination implements ReceivingDestination
@@ -112,15 +110,8 @@ public class NodeReceivingDestination im
     @Override
     public void authorizePublish(final SecurityToken securityToken, final Message_1_0 message)
     {
-        if(_destination instanceof ConfiguredObject)
-        {
-            ConfiguredObject<?> object = (ConfiguredObject)_destination;
-
-            object.authorise(securityToken,
-                             Operation.ACTION("publish"),
-                             Collections.<String, Object>singletonMap("routingKey", getRoutingAddress(message)));
-        }
-
+            _destination.authorisePublish(securityToken,
+                                          Collections.<String, Object>singletonMap("routingKey", getRoutingAddress(message)));
 
     }
 

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/QueueDestination.java Fri Oct 21 10:40:24 2016
@@ -22,12 +22,11 @@ package org.apache.qpid.server.protocol.
 
 import java.util.Collections;
 
-import org.apache.qpid.server.protocol.v1_0.type.Outcome;
-import org.apache.qpid.server.protocol.v1_0.type.messaging.Accepted;
 import org.apache.qpid.server.message.MessageReference;
 import org.apache.qpid.server.model.Queue;
+import org.apache.qpid.server.protocol.v1_0.type.Outcome;
+import org.apache.qpid.server.protocol.v1_0.type.messaging.Accepted;
 import org.apache.qpid.server.security.SecurityToken;
-import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.store.MessageEnqueueRecord;
 import org.apache.qpid.server.txn.ServerTransaction;
 
@@ -102,9 +101,8 @@ public class QueueDestination extends Me
     public void authorizePublish(final SecurityToken securityToken, final Message_1_0 message)
     {
 
-        _queue.authorise(securityToken,
-                         Operation.ACTION("publish"),
-                         Collections.<String,Object>singletonMap("routingKey", getRoutingAddress(message)));
+        _queue.authorisePublish(securityToken,
+                                Collections.<String,Object>singletonMap("routingKey", getRoutingAddress(message)));
 
 
     }

Modified: qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java Fri Oct 21 10:40:24 2016
@@ -1545,6 +1545,7 @@ public class Session_1_0 implements AMQS
             consumerListNeedsRefreshing = true;
         }
 
+        // QPID-7447: prevent unnecessary allocation of empty iterator
         Iterator<ConsumerTarget_1_0> iter = _consumersWithPendingWork.isEmpty() ? Collections.<ConsumerTarget_1_0>emptyIterator() : _consumersWithPendingWork.iterator();
         boolean consumerHasMoreWork = false;
         while(iter.hasNext())

Modified: qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementAddressSpace.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementAddressSpace.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementAddressSpace.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementAddressSpace.java Fri Oct 21 10:40:24 2016
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.server.management.amqp;
 
+import java.security.AccessControlException;
 import java.security.Principal;
 import java.util.Collection;
 import java.util.Collections;
@@ -40,6 +41,7 @@ import org.apache.qpid.server.model.port
 import org.apache.qpid.server.plugin.SystemAddressSpaceCreator;
 import org.apache.qpid.server.protocol.LinkModel;
 import org.apache.qpid.server.protocol.LinkRegistry;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.store.MemoryMessageStore;
 import org.apache.qpid.server.store.MessageStore;
@@ -212,6 +214,19 @@ public class ManagementAddressSpace impl
     private class DefaultDestination implements MessageDestination
     {
         @Override
+        public NamedAddressSpace getAddressSpace()
+        {
+            return ManagementAddressSpace.this;
+        }
+
+        @Override
+        public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+                throws AccessControlException
+        {
+
+        }
+
+        @Override
         public String getName()
         {
             return ExchangeDefaults.DEFAULT_EXCHANGE_NAME;

Modified: qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java Fri Oct 21 10:40:24 2016
@@ -64,6 +64,7 @@ import org.apache.qpid.server.model.Stat
 import org.apache.qpid.server.plugin.MessageConverter;
 import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.protocol.MessageConverterRegistry;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.store.MessageDurability;
 import org.apache.qpid.server.store.MessageEnqueueRecord;
 import org.apache.qpid.server.store.StorableMessageMetaData;
@@ -1020,6 +1021,20 @@ class ManagementNode implements MessageS
     }
 
     @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _addressSpace;
+    }
+
+
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+        // ? special permissions to publish to the management node
+    }
+
+    @Override
     public String getName()
     {
         return MANAGEMENT_NODE_NAME;

Modified: qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java (original)
+++ qpid/java/branches/transfer-queue/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNodeConsumer.java Fri Oct 21 10:40:24 2016
@@ -20,9 +20,11 @@
  */
 package org.apache.qpid.server.management.amqp;
 
+import java.security.AccessControlException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.qpid.server.consumer.ConsumerTarget;
 import org.apache.qpid.server.message.BaseMessageInstance;
@@ -31,7 +33,9 @@ import org.apache.qpid.server.message.Me
 import org.apache.qpid.server.message.MessageInstanceConsumer;
 import org.apache.qpid.server.message.ServerMessage;
 import org.apache.qpid.server.message.internal.InternalMessage;
+import org.apache.qpid.server.model.NamedAddressSpace;
 import org.apache.qpid.server.protocol.AMQSessionModel;
+import org.apache.qpid.server.security.SecurityToken;
 import org.apache.qpid.server.store.StorableMessageMetaData;
 import org.apache.qpid.server.txn.ServerTransaction;
 import org.apache.qpid.server.util.Action;
@@ -90,6 +94,19 @@ class ManagementNodeConsumer implements
     }
 
     @Override
+    public NamedAddressSpace getAddressSpace()
+    {
+        return _managementNode.getAddressSpace();
+    }
+
+    @Override
+    public void authorisePublish(final SecurityToken token, final Map<String, Object> arguments)
+            throws AccessControlException
+    {
+        _managementNode.authorisePublish(token, arguments);
+    }
+
+    @Override
     public String getName()
     {
         return _name;

Modified: qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java (original)
+++ qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java Fri Oct 21 10:40:24 2016
@@ -649,6 +649,7 @@ public class QpidByteBuffer
                                              QpidByteBuffer dest) throws SSLException
     {
         final ByteBuffer[] src;
+        // QPID-7447: prevent unnecessary allocations
         if (buffers.isEmpty())
         {
             src = EMPTY_BYTE_BUFFER_ARRAY;

Modified: qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/transport/Connection.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/transport/Connection.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/transport/Connection.java (original)
+++ qpid/java/branches/transfer-queue/common/src/main/java/org/apache/qpid/transport/Connection.java Fri Oct 21 10:40:24 2016
@@ -721,7 +721,7 @@ public class Connection extends Connecti
         return connectionLost.get();
     }
 
-    protected Collection<Session> getChannels()
+    protected Collection<? extends Session> getChannels()
     {
         return new ArrayList<>(channels.values());
     }

Modified: qpid/java/branches/transfer-queue/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/transfer-queue/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java?rev=1765986&r1=1765985&r2=1765986&view=diff
==============================================================================
--- qpid/java/branches/transfer-queue/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java (original)
+++ qpid/java/branches/transfer-queue/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java Fri Oct 21 10:40:24 2016
@@ -485,4 +485,77 @@ public class ExternalACLTest extends Abs
             // pass
         }
     }
+
+
+    public void setUpClientPublishToAnonymousSuccess() throws Exception
+    {
+        writeACLFile("ACL ALLOW-LOG client ACCESS VIRTUALHOST",
+                     "ACL ALLOW-LOG client CREATE QUEUE",
+                     "ACL ALLOW-LOG client BIND EXCHANGE" ,
+                     "ACL ALLOW-LOG client PUBLISH EXCHANGE name=\"\" routingKey=\"example.RequestQueue\"",
+                     "ACL DENY-LOG ALL ALL");
+    }
+
+    public void testClientPublishToAnonymousSuccess() throws Exception
+    {
+        Connection conn = getConnection("test", "client", "guest");
+
+        Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+        conn.start();
+
+        Queue queue = sess.createQueue("example.RequestQueue");
+
+        ((AMQSession<?,?>)sess).declareAndBind((AMQDestination)queue);
+
+        MessageProducer sender = sess.createProducer(sess.createQueue("ADDR: example.RequestQueue"));
+
+        sender.send(sess.createTextMessage("test"));
+
+        //Send the message using a transaction as this will allow us to retrieve any errors that occur on the broker.
+        sess.commit();
+
+        conn.close();
+    }
+
+
+
+    public void setUpClientPublishToAnonymousFailure() throws Exception
+    {
+        writeACLFile("ACL ALLOW-LOG client ACCESS VIRTUALHOST",
+                     "ACL ALLOW-LOG client CREATE QUEUE",
+                     "ACL ALLOW-LOG client BIND EXCHANGE",
+                     "ACL DENY-LOG ALL ALL");
+    }
+
+    public void testClientPublishToAnonymousFailure() throws Exception
+    {
+        try
+        {
+            Connection conn = getConnection("test", "client", "guest");
+
+            Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+            conn.start();
+
+            Queue queue = sess.createQueue("example.RequestQueue");
+
+            ((AMQSession<?, ?>) sess).declareAndBind((AMQDestination) queue);
+
+            MessageProducer sender = sess.createProducer(sess.createQueue("ADDR: example.RequestQueue"));
+
+            sender.send(sess.createTextMessage("test"));
+
+            //Send the message using a transaction as this will allow us to retrieve any errors that occur on the broker.
+            sess.commit();
+
+            fail("Sending to the anonymousExchange without permission should fail");
+        }
+        catch (JMSException e)
+        {
+            assertEquals("403",e.getErrorCode());
+        }
+    }
+
+
 }



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


Mime
View raw message