qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1573421 [1/2] - in /qpid/trunk/qpid/java: broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/java/org/apache/qpid/server/model/adapter/ broker-core/src/main/java/org/apache/qpid/server/plugin/ broker-core/src/main...
Date Mon, 03 Mar 2014 01:59:54 GMT
Author: rgodfrey
Date: Mon Mar  3 01:59:53 2014
New Revision: 1573421

URL: http://svn.apache.org/r1573421
Log:
QPID-5592 : [Java Broker] AuthenticationManagers should directly implement AuthenticationProvider

Added:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java
Removed:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractPrincipalDatabaseAuthManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactoryTest.java
Modified:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AccessControlProvider.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Group.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupMember.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupProvider.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/KeyStore.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Plugin.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PreferencesProvider.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Publisher.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/AuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/AuthenticationProviderRecovererTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactoryTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactoryTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManagerTest.java
    qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AccessControlProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AccessControlProvider.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AccessControlProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AccessControlProvider.java Mon Mar  3 01:59:53 2014
@@ -26,6 +26,7 @@ import java.util.UUID;
 
 import org.apache.qpid.server.security.AccessControl;
 
+@ManagedObject
 public interface AccessControlProvider<X extends AccessControlProvider<X>> extends ConfiguredObject<X>
 {
     public static final String DURABLE = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AuthenticationProvider.java Mon Mar  3 01:59:53 2014
@@ -26,6 +26,7 @@ import java.util.Collections;
 
 import org.apache.qpid.server.security.SubjectCreator;
 
+@ManagedObject
 public interface AuthenticationProvider<X extends AuthenticationProvider<X>> extends ConfiguredObject<X>
 {
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Binding.java Mon Mar  3 01:59:53 2014
@@ -25,6 +25,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+@ManagedObject
 public interface Binding<X extends Binding<X>> extends ConfiguredObject<X>
 {
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Broker.java Mon Mar  3 01:59:53 2014
@@ -32,6 +32,7 @@ import org.apache.qpid.server.security.S
 import org.apache.qpid.server.security.SubjectCreator;
 import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
 
+@ManagedObject
 public interface Broker<X extends Broker<X>> extends ConfiguredObject<X>
 {
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Consumer.java Mon Mar  3 01:59:53 2014
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
+@ManagedObject
 public interface Consumer<X extends Consumer<X>> extends ConfiguredObject<X>
 {
     public String DISTRIBUTION_MODE = "distributionMode";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Exchange.java Mon Mar  3 01:59:53 2014
@@ -26,7 +26,6 @@ import java.util.Collections;
 import java.util.Map;
 
 @ManagedObject
-
 public interface Exchange<X extends Exchange<X>> extends ConfiguredObject<X>
 {
     String DURABLE                              = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Group.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Group.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Group.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Group.java Mon Mar  3 01:59:53 2014
@@ -19,6 +19,7 @@
  */
 package org.apache.qpid.server.model;
 
+@ManagedObject
 public interface Group<X extends Group<X>> extends ConfiguredObject<X>
 {
     String DURABLE         = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupMember.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupMember.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupMember.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupMember.java Mon Mar  3 01:59:53 2014
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
+@ManagedObject
 public interface GroupMember<X extends GroupMember<X>> extends ConfiguredObject<X>
 {
     String DURABLE         = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupProvider.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/GroupProvider.java Mon Mar  3 01:59:53 2014
@@ -25,6 +25,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
 
+@ManagedObject
 public interface GroupProvider<X extends GroupProvider<X>> extends ConfiguredObject<X>
 {
     public static final String DESCRIPTION = "description";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/KeyStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/KeyStore.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/KeyStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/KeyStore.java Mon Mar  3 01:59:53 2014
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import javax.net.ssl.KeyManager;
 
+@ManagedObject
 public interface KeyStore<X extends KeyStore<X>> extends ConfiguredObject<X>
 {
     String DURABLE = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Plugin.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Plugin.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Plugin.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Plugin.java Mon Mar  3 01:59:53 2014
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
+@ManagedObject
 public interface Plugin<X extends Plugin<X>> extends ConfiguredObject<X>
 {
     //Hack, using it for the class name only for consistency with the other things.

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Port.java Mon Mar  3 01:59:53 2014
@@ -23,6 +23,7 @@ package org.apache.qpid.server.model;
 import java.security.AccessControlException;
 import java.util.Collection;
 
+@ManagedObject
 public interface Port<X extends Port<X>> extends ConfiguredObject<X>
 {
     String DURABLE                              = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PreferencesProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PreferencesProvider.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PreferencesProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/PreferencesProvider.java Mon Mar  3 01:59:53 2014
@@ -24,6 +24,7 @@ package org.apache.qpid.server.model;
 import java.util.Map;
 import java.util.Set;
 
+@ManagedObject
 public interface PreferencesProvider<X extends PreferencesProvider<X>> extends ConfiguredObject<X>
 {
     String DURABLE         = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Publisher.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Publisher.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Publisher.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Publisher.java Mon Mar  3 01:59:53 2014
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.server.model;
 
+@ManagedObject
 public interface Publisher<X extends Publisher<X>> extends ConfiguredObject<X>
 {
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Session.java Mon Mar  3 01:59:53 2014
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
+@ManagedObject
 public interface Session<X extends Session<X>> extends ConfiguredObject<X>
 {
     public static final String STATE = "state";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/TrustStore.java Mon Mar  3 01:59:53 2014
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import javax.net.ssl.TrustManager;
 
+@ManagedObject
 public interface TrustStore<X extends TrustStore<X>> extends ConfiguredObject<X>
 {
     String DURABLE = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/User.java Mon Mar  3 01:59:53 2014
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+@ManagedObject
 public interface User<X extends User<X>> extends ConfiguredObject<X>
 {
     String DURABLE         = "durable";

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java Mon Mar  3 01:59:53 2014
@@ -30,7 +30,6 @@ import java.util.Collection;
 import java.util.Map;
 
 @ManagedObject( managesChildren = true )
-
 public interface VirtualHost<X extends VirtualHost<X>> extends ConfiguredObject<X>
 {
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractConfiguredObject.java Mon Mar  3 01:59:53 2014
@@ -27,19 +27,13 @@ import java.security.AccessControlExcept
 import java.security.AccessController;
 import java.util.*;
 
-import org.apache.qpid.server.model.ConfigurationChangeListener;
-import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.IllegalStateTransitionException;
-import org.apache.qpid.server.model.ManagedAttribute;
-import org.apache.qpid.server.model.ManagedStatistic;
-import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.model.*;
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.configuration.updater.ChangeAttributesTask;
 import org.apache.qpid.server.configuration.updater.ChangeStateTask;
 import org.apache.qpid.server.configuration.updater.CreateChildTask;
 import org.apache.qpid.server.configuration.updater.SetAttributeTask;
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
-import org.apache.qpid.server.security.*;
 import org.apache.qpid.server.security.SecurityManager;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.util.MapValueConverter;
@@ -115,17 +109,28 @@ public abstract class AbstractConfigured
                                        TaskExecutor taskExecutor, boolean filterAttributes)
 
     {
-        this(defaults, combineIdWithAttributes(id, attributes), taskExecutor, filterAttributes);
+        this(Collections.<Class<? extends ConfiguredObject>, ConfiguredObject<?>>emptyMap(),
+             defaults, combineIdWithAttributes(id, attributes), taskExecutor, filterAttributes);
     }
 
     protected AbstractConfiguredObject(Map<String, Object> defaults,
                                        Map<String, Object> attributes,
                                        TaskExecutor taskExecutor)
     {
-        this(defaults, attributes, taskExecutor, true);
+        this(Collections.<Class<? extends ConfiguredObject>, ConfiguredObject<?>>emptyMap(),
+             defaults, attributes, taskExecutor, true);
     }
 
-    protected AbstractConfiguredObject(Map<String, Object> defaults,
+    protected AbstractConfiguredObject(final Map<Class<? extends ConfiguredObject>, ConfiguredObject<?>> parents,
+                                       Map<String, Object> defaults,
+                                       Map<String, Object> attributes,
+                                       TaskExecutor taskExecutor)
+    {
+        this(parents, defaults, attributes, taskExecutor, true);
+    }
+
+    protected AbstractConfiguredObject(final Map<Class<? extends ConfiguredObject>, ConfiguredObject<?>> parents,
+                                       Map<String, Object> defaults,
                                        Map<String, Object> attributes,
                                        TaskExecutor taskExecutor,
                                        boolean filterAttributes)
@@ -134,6 +139,10 @@ public abstract class AbstractConfigured
         _id = (UUID)attributes.get(ID);
         _attributeTypes = getAttributeTypes(getClass());
         _automatedFields = getAutomatedFields(getClass());
+        for(Map.Entry<Class<? extends ConfiguredObject>, ConfiguredObject<?>> entry : parents.entrySet())
+        {
+            addParent((Class<ConfiguredObject>) entry.getKey(), entry.getValue());
+        }
         if (attributes != null)
         {
             Collection<String> names = getAttributeNames();
@@ -199,7 +208,8 @@ public abstract class AbstractConfigured
     {
         try
         {
-            _automatedFields.get(name).set(this,_attributeTypes.get(name).convert(value));
+            final Attribute attribute = _attributeTypes.get(name);
+            _automatedFields.get(name).set(this, attribute.convert(value, this));
         }
         catch (IllegalAccessException e)
         {
@@ -739,22 +749,16 @@ public abstract class AbstractConfigured
             catch (IllegalAccessException e)
             {
                 Object o = configuredObject.getAttribute(_name);
-                return _converter.convert(o);
+                return _converter.convert(o, configuredObject);
             }
             catch (InvocationTargetException e)
             {
                 Object o = configuredObject.getAttribute(_name);
-                return _converter.convert(o);
+                return _converter.convert(o, configuredObject);
             }
 
         }
 
-        public T getValue(Map<String, Object> attributeMap)
-        {
-            Object o = attributeMap.get(_name);
-            return _converter.convert(o);
-        }
-
         public T get(final AbstractConfiguredObject<?> object)
         {
             try
@@ -802,47 +806,47 @@ public abstract class AbstractConfigured
             return _annotation;
         }
 
-        public T convert(final Object value)
+        public T convert(final Object value, C object)
         {
-            return _converter.convert(value);
+            return _converter.convert(value, object);
         }
     }
 
 
     private static interface Converter<T>
     {
-        T convert(Object o);
+        T convert(Object value, final ConfiguredObject object);
     }
 
     private static final Converter<String> STRING_CONVERTER = new Converter<String>()
     {
         @Override
-        public String convert(final Object o)
+        public String convert(final Object value, final ConfiguredObject object)
         {
-            return o == null ? null : o.toString();
+            return value == null ? null : value.toString();
         }
     };
 
     private static final Converter<UUID> UUID_CONVERTER = new Converter<UUID>()
     {
         @Override
-        public UUID convert(final Object o)
+        public UUID convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof UUID)
+            if(value instanceof UUID)
             {
-                return (UUID)o;
+                return (UUID) value;
             }
-            else if(o instanceof String)
+            else if(value instanceof String)
             {
-                return UUID.fromString((String)o);
+                return UUID.fromString((String) value);
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a UUID");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a UUID");
             }
         }
     };
@@ -851,27 +855,27 @@ public abstract class AbstractConfigured
     {
 
         @Override
-        public Long convert(final Object o)
+        public Long convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof Long)
+            if(value instanceof Long)
             {
-                return (Long)o;
+                return (Long) value;
             }
-            else if(o instanceof Number)
+            else if(value instanceof Number)
             {
-                return ((Number)o).longValue();
+                return ((Number) value).longValue();
             }
-            else if(o instanceof String)
+            else if(value instanceof String)
             {
-                return Long.valueOf((String)o);
+                return Long.valueOf((String) value);
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a Long");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a Long");
             }
         }
     };
@@ -880,27 +884,27 @@ public abstract class AbstractConfigured
     {
 
         @Override
-        public Integer convert(final Object o)
+        public Integer convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof Integer)
+            if(value instanceof Integer)
             {
-                return (Integer)o;
+                return (Integer) value;
             }
-            else if(o instanceof Number)
+            else if(value instanceof Number)
             {
-                return ((Number)o).intValue();
+                return ((Number) value).intValue();
             }
-            else if(o instanceof String)
+            else if(value instanceof String)
             {
-                return Integer.valueOf((String)o);
+                return Integer.valueOf((String) value);
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to an Integer");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to an Integer");
             }
         }
     };
@@ -909,23 +913,23 @@ public abstract class AbstractConfigured
     {
 
         @Override
-        public Boolean convert(final Object o)
+        public Boolean convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof Boolean)
+            if(value instanceof Boolean)
             {
-                return (Boolean)o;
+                return (Boolean) value;
             }
-            else if(o instanceof String)
+            else if(value instanceof String)
             {
-                return Boolean.valueOf((String)o);
+                return Boolean.valueOf((String) value);
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a Boolean");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a Boolean");
             }
         }
     };
@@ -933,19 +937,19 @@ public abstract class AbstractConfigured
     private static final Converter<List> LIST_CONVERTER = new Converter<List>()
     {
         @Override
-        public List convert(final Object o)
+        public List convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof List)
+            if(value instanceof List)
             {
-                return (List)o;
+                return (List) value;
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a List");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a List");
             }
         }
     };
@@ -953,19 +957,19 @@ public abstract class AbstractConfigured
     private static final Converter<Collection> COLLECTION_CONVERTER = new Converter<Collection>()
     {
         @Override
-        public Collection convert(final Object o)
+        public Collection convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof Collection)
+            if(value instanceof Collection)
             {
-                return (Collection)o;
+                return (Collection) value;
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a List");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a List");
             }
         }
     };
@@ -973,19 +977,19 @@ public abstract class AbstractConfigured
     private static final Converter<Map> MAP_CONVERTER = new Converter<Map>()
     {
         @Override
-        public Map convert(final Object o)
+        public Map convert(final Object value, final ConfiguredObject object)
         {
-            if(o instanceof Map)
+            if(value instanceof Map)
             {
-                return (Map)o;
+                return (Map) value;
             }
-            else if(o == null)
+            else if(value == null)
             {
                 return null;
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a Map");
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a Map");
             }
         }
     };
@@ -1000,23 +1004,23 @@ public abstract class AbstractConfigured
         }
 
         @Override
-        public X convert(final Object o)
+        public X convert(final Object value, final ConfiguredObject object)
         {
-            if(o == null)
+            if(value == null)
             {
                 return null;
             }
-            else if(_klazz.isInstance(o))
+            else if(_klazz.isInstance(value))
             {
-                return (X) o;
+                return (X) value;
             }
-            else if(o instanceof String)
+            else if(value instanceof String)
             {
-                return Enum.valueOf(_klazz,(String)o);
+                return Enum.valueOf(_klazz,(String) value);
             }
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a " + _klazz.getName());
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a " + _klazz.getName());
             }
         }
     }
@@ -1031,22 +1035,54 @@ public abstract class AbstractConfigured
         }
 
         @Override
-        public X convert(final Object o)
+        public X convert(final Object value, final ConfiguredObject object)
         {
-            if(o == null)
+            if(value == null)
             {
                 return null;
             }
-            else if(_klazz.isInstance(o))
+            else if(_klazz.isInstance(value))
             {
-                return (X) o;
+                return (X) value;
+            }
+            else if(value instanceof UUID)
+            {
+                Collection<X> reachable = getReachableObjects(object,_klazz);
+                for(X candidate : reachable)
+                {
+                    if(candidate.getId().equals(value))
+                    {
+                        return candidate;
+                    }
+                }
+                throw new IllegalArgumentException("Cannot find a " + _klazz.getName() + " with id " + value);
+            }
+            else if(value instanceof String)
+            {
+                Collection<X> reachable = getReachableObjects(object,_klazz);
+                for(X candidate : reachable)
+                {
+                    if(candidate.getName().equals(value))
+                    {
+                        return candidate;
+                    }
+                }
+                try
+                {
+                    UUID id = UUID.fromString((String)value);
+                    return convert(id, object);
+                }
+                catch (IllegalArgumentException e)
+                {
+                    throw new IllegalArgumentException("Cannot find a " + _klazz.getSimpleName() + " with name '" + value + "'");
+                }
             }
-            // TODO - traverse tree based on UUID
             else
             {
-                throw new IllegalArgumentException("Cannot convert type " + o.getClass() + " to a " + _klazz.getName());
+                throw new IllegalArgumentException("Cannot convert type " + value.getClass() + " to a " + _klazz.getName());
             }
         }
+
     }
 
     private static <X> Converter<X> getConverter(final Class<X> type)
@@ -1452,4 +1488,142 @@ public abstract class AbstractConfigured
         }
         return _allAutomatedFields.get(clazz);
     }
+
+    private static <X extends ConfiguredObject<X>> Collection<X> getReachableObjects(final ConfiguredObject<?> object,
+                                                                                     final Class<X> clazz)
+    {
+        Class<? extends ConfiguredObject> category = getCategory(object.getClass());
+        Class<? extends ConfiguredObject> ancestorClass = getAncestorClassWithGivenDescendant(category, clazz);
+        if(ancestorClass != null)
+        {
+            ConfiguredObject ancestor = getAncestor(ancestorClass, category, object);
+            if(ancestor != null)
+            {
+                return getAllDescendants(ancestor, ancestorClass, clazz);
+            }
+        }
+        return null;
+    }
+
+    private static <X extends ConfiguredObject<X>> Collection<X> getAllDescendants(final ConfiguredObject ancestor,
+                                                                                   final Class<? extends ConfiguredObject> ancestorClass,
+                                                                                   final Class<X> clazz)
+    {
+        Set<X> descendants = new HashSet<X>();
+        for(Class<? extends ConfiguredObject> childClass : Model.getInstance().getChildTypes(ancestorClass))
+        {
+            Collection<? extends ConfiguredObject> children = ancestor.getChildren(childClass);
+            if(childClass == clazz)
+            {
+
+                if(children != null)
+                {
+                    descendants.addAll((Collection<X>)children);
+                }
+            }
+            else
+            {
+                if(children != null)
+                {
+                    for(ConfiguredObject child : children)
+                    {
+                        descendants.addAll(getAllDescendants(child, childClass, clazz));
+                    }
+                }
+            }
+        }
+        return descendants;
+    }
+
+    private static ConfiguredObject getAncestor(final Class<? extends ConfiguredObject> ancestorClass,
+                                                final Class<? extends ConfiguredObject> category,
+                                                final ConfiguredObject<?> object)
+    {
+        if(ancestorClass.isInstance(object))
+        {
+            return object;
+        }
+        else
+        {
+            for(Class<? extends ConfiguredObject> parentClass : Model.getInstance().getParentTypes(category))
+            {
+                ConfiguredObject parent = object.getParent(parentClass);
+                ConfiguredObject ancestor = getAncestor(ancestorClass, parentClass, parent);
+                if(ancestor != null)
+                {
+                    return ancestor;
+                }
+            }
+        }
+        return null;
+    }
+
+    private static Class<? extends ConfiguredObject> getAncestorClassWithGivenDescendant(
+            final Class<? extends ConfiguredObject> category,
+            final Class<? extends ConfiguredObject> descendantClass)
+    {
+        Model model = Model.getInstance();
+        Collection<Class<? extends ConfiguredObject>> candidateClasses =
+                Collections.<Class<? extends ConfiguredObject>>singleton(category);
+        while(!candidateClasses.isEmpty())
+        {
+            for(Class<? extends ConfiguredObject> candidate : candidateClasses)
+            {
+                if(hasDescendant(candidate, descendantClass))
+                {
+                    return candidate;
+                }
+            }
+            Set<Class<? extends ConfiguredObject>> previous = new HashSet<Class<? extends ConfiguredObject>>(candidateClasses);
+            candidateClasses = new HashSet<Class<? extends ConfiguredObject>>();
+            for(Class<? extends ConfiguredObject> prev : previous)
+            {
+                candidateClasses.addAll(model.getParentTypes(prev));
+            }
+        }
+        return null;
+    }
+
+    private static boolean hasDescendant(final Class<? extends ConfiguredObject> candidate,
+                                         final Class<? extends ConfiguredObject> descendantClass)
+    {
+        int oldSize = 0;
+        Model model = Model.getInstance();
+
+        Set<Class<? extends ConfiguredObject>> allDescendants = new HashSet<Class<? extends ConfiguredObject>>(Collections.singleton(candidate));
+        while(allDescendants.size() > oldSize)
+        {
+            oldSize = allDescendants.size();
+            Set<Class<? extends ConfiguredObject>> prev = new HashSet<Class<? extends ConfiguredObject>>(allDescendants);
+            for(Class<? extends ConfiguredObject> clazz : prev)
+            {
+                allDescendants.addAll(model.getChildTypes(clazz));
+            }
+        }
+        return allDescendants.contains(descendantClass);
+    }
+
+    private static Class<? extends ConfiguredObject> getCategory(final Class<?> clazz)
+    {
+        ManagedObject annotation = clazz.getAnnotation(ManagedObject.class);
+        if(annotation != null && annotation.category())
+        {
+            return (Class<? extends ConfiguredObject>) clazz;
+        }
+        for(Class<?> iface : clazz.getInterfaces() )
+        {
+            Class<? extends ConfiguredObject> cat = getCategory(iface);
+            if(cat != null)
+            {
+                return cat;
+            }
+        }
+        if(clazz.getSuperclass() != null)
+        {
+            return getCategory(clazz.getSuperclass());
+        }
+        return null;
+    }
+
+
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderFactory.java Mon Mar  3 01:59:53 2014
@@ -23,6 +23,7 @@ package org.apache.qpid.server.model.ada
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -31,10 +32,7 @@ import org.apache.qpid.server.model.Auth
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.plugin.QpidServiceLoader;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager;
-import org.apache.qpid.server.model.adapter.AuthenticationProviderAdapter.PrincipalDatabaseAuthenticationManagerAdapter;
-import org.apache.qpid.server.model.adapter.AuthenticationProviderAdapter.SimpleAuthenticationProviderAdapter;
+import org.apache.qpid.server.security.auth.manager.AbstractAuthenticationManager;
 
 public class AuthenticationProviderFactory
 {
@@ -60,9 +58,7 @@ public class AuthenticationProviderFacto
      */
     public AuthenticationProvider create(UUID id, Broker broker, Map<String, Object> attributes)
     {
-        AuthenticationProviderAdapter provider = createAuthenticationProvider(id, broker, attributes);
-        provider.getAuthManager().onCreate();
-        return provider;
+        return createAuthenticationProvider(id, broker, attributes, false);
     }
 
     /**
@@ -73,27 +69,20 @@ public class AuthenticationProviderFacto
      */
     public AuthenticationProvider recover(UUID id, Map<String, Object> attributes, Broker broker)
     {
-        return createAuthenticationProvider(id, broker, attributes);
+        return createAuthenticationProvider(id, broker, attributes, true);
     }
 
-    private AuthenticationProviderAdapter createAuthenticationProvider(UUID id, Broker broker, Map<String, Object> attributes)
+    private AuthenticationProvider createAuthenticationProvider(UUID id, Broker broker, Map<String, Object> attributes, boolean recovering)
     {
+        attributes = new HashMap<String, Object>(attributes);
+        attributes.put(AuthenticationProvider.ID,id);
+
         for (AuthenticationManagerFactory factory : _factories)
         {
-            AuthenticationManager manager = factory.createInstance(broker, attributes);
+            AbstractAuthenticationManager manager = factory.createInstance(broker, attributes, recovering);
             if (manager != null)
             {
-                AuthenticationProviderAdapter authenticationProvider;
-                if (manager instanceof PrincipalDatabaseAuthenticationManager)
-                {
-                    authenticationProvider = new PrincipalDatabaseAuthenticationManagerAdapter(id, broker,
-                            (PrincipalDatabaseAuthenticationManager) manager, attributes, factory.getAttributeNames());
-                }
-                else
-                {
-                    authenticationProvider = new SimpleAuthenticationProviderAdapter(id, broker, manager, attributes, factory.getAttributeNames());
-                }
-                return authenticationProvider;
+                return manager;
             }
         }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BrokerAdapter.java Mon Mar  3 01:59:53 2014
@@ -45,13 +45,11 @@ import org.apache.qpid.server.logging.ac
 import org.apache.qpid.server.logging.actors.CurrentActor;
 import org.apache.qpid.server.logging.messages.BrokerMessages;
 import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.model.adapter.AuthenticationProviderAdapter.SimpleAuthenticationProviderAdapter;
 import org.apache.qpid.server.plugin.PreferencesProviderFactory;
 import org.apache.qpid.server.plugin.VirtualHostFactory;
 import org.apache.qpid.server.security.SecurityManager;
 import org.apache.qpid.server.security.SubjectCreator;
 import org.apache.qpid.server.security.access.Operation;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
 import org.apache.qpid.server.security.auth.manager.SimpleAuthenticationManager;
 import org.apache.qpid.server.stats.StatisticsGatherer;
 import org.apache.qpid.server.store.MessageStoreCreator;
@@ -198,9 +196,12 @@ public class BrokerAdapter<X extends Bro
         _brokerStore = brokerStore;
         if (_brokerOptions.isManagementMode())
         {
-            AuthenticationManager authManager = new SimpleAuthenticationManager(BrokerOptions.MANAGEMENT_MODE_USER_NAME, _brokerOptions.getManagementModePassword());
-            _managementAuthenticationProvider = new SimpleAuthenticationProviderAdapter(UUID.randomUUID(), this,
-                    authManager, Collections.<String, Object> emptyMap(), Collections.<String> emptySet());
+            Map<String,Object> authManagerAttrs = new HashMap<String, Object>();
+            authManagerAttrs.put(NAME,"MANAGEMENT_MODE_AUTHENTICATION");
+            authManagerAttrs.put(ID, UUID.randomUUID());
+            SimpleAuthenticationManager authManager = new SimpleAuthenticationManager(this, Collections.<String,Object>emptyMap(), authManagerAttrs);
+            authManager.addUser(BrokerOptions.MANAGEMENT_MODE_USER_NAME, _brokerOptions.getManagementModePassword());
+            _managementAuthenticationProvider = authManager;
         }
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/AuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/AuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/AuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/AuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -21,13 +21,11 @@ package org.apache.qpid.server.plugin;
 import java.util.Collection;
 import java.util.Map;
 
-import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
+import org.apache.qpid.server.security.auth.manager.AbstractAuthenticationManager;
 
 public interface AuthenticationManagerFactory extends Pluggable
 {
-    public static final String ATTRIBUTE_TYPE = AuthenticationProvider.TYPE;
 
     /**
      * Returns the authentication provider type
@@ -37,17 +35,21 @@ public interface AuthenticationManagerFa
 
     /**
      * Creates authentication manager from the provided attributes
+     *
      * @param broker
      *            broker model object
      * @param attributes
      *            attributes to create authentication manager
      *
+     * @param recovering
      * @return authentication manager instance
      */
-    AuthenticationManager createInstance(Broker broker, Map<String, Object> attributes);
+    AbstractAuthenticationManager createInstance(Broker broker,
+                                                 Map<String, Object> attributes,
+                                                 final boolean recovering);
 
     /**
-     * Get the names of attributes the authentication manager which can be passed into {@link #createInstance(Broker, Map)} to create the
+     * Get the names of attributes the authentication manager which can be passed into {@link #createInstance(org.apache.qpid.server.model.Broker, java.util.Map, boolean)} to create the
      * authentication manager
      *
      * @return the collection of attribute names

Added: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java?rev=1573421&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java (added)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AbstractAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -0,0 +1,312 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.security.auth.manager;
+
+import org.apache.log4j.Logger;
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.*;
+import org.apache.qpid.server.model.adapter.AbstractConfiguredObject;
+import org.apache.qpid.server.plugin.PreferencesProviderFactory;
+import org.apache.qpid.server.security.SubjectCreator;
+import org.apache.qpid.server.security.access.Operation;
+import org.apache.qpid.server.util.MapValueConverter;
+
+import java.security.AccessControlException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+
+public abstract class AbstractAuthenticationManager<T extends AbstractAuthenticationManager<T>>
+    extends AbstractConfiguredObject<T>
+    implements AuthenticationProvider<T>, AuthenticationManager
+{
+    private static final Logger LOGGER = Logger.getLogger(AbstractAuthenticationManager.class);
+
+    private final Broker _broker;
+    private PreferencesProvider _preferencesProvider;
+    private AtomicReference<State> _state = new AtomicReference<State>(State.INITIALISING);
+
+    protected AbstractAuthenticationManager(final Broker broker,
+                                            final Map<String, Object> defaults,
+                                            final Map<String, Object> attributes)
+    {
+        super(Collections.<Class<? extends ConfiguredObject>, ConfiguredObject<?>>singletonMap(Broker.class, broker),
+              defaults, attributes, broker.getTaskExecutor());
+        _broker = broker;
+    }
+
+    protected final Broker getBroker()
+    {
+        return _broker;
+    }
+
+    @Override
+    public Collection<VirtualHostAlias> getVirtualHostPortBindings()
+    {
+        return null;
+    }
+
+    @Override
+    public SubjectCreator getSubjectCreator()
+    {
+        return new SubjectCreator(this, _broker.getGroupProviders());
+    }
+
+    @Override
+    public PreferencesProvider getPreferencesProvider()
+    {
+        return _preferencesProvider;
+    }
+
+    @Override
+    public void setPreferencesProvider(final PreferencesProvider preferencesProvider)
+    {
+        _preferencesProvider = preferencesProvider;
+    }
+
+
+
+
+    @Override
+    public String setName(final String currentName, final String desiredName)
+            throws IllegalStateException, AccessControlException
+    {
+        return null;
+    }
+
+    @Override
+    public State getState()
+    {
+        return _state.get();
+    }
+
+    @Override
+    public boolean isDurable()
+    {
+        return true;
+    }
+
+    @Override
+    public void setDurable(final boolean durable)
+            throws IllegalStateException, AccessControlException, IllegalArgumentException
+    {
+
+    }
+
+    @Override
+    public LifetimePolicy getLifetimePolicy()
+    {
+        return LifetimePolicy.PERMANENT;
+    }
+
+    @Override
+    public LifetimePolicy setLifetimePolicy(final LifetimePolicy expected, final LifetimePolicy desired)
+            throws IllegalStateException, AccessControlException, IllegalArgumentException
+    {
+        return null;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <C extends ConfiguredObject> C addChild(Class<C> childClass, Map<String, Object> attributes, ConfiguredObject... otherParents)
+    {
+        if(childClass == PreferencesProvider.class)
+        {
+            String name = MapValueConverter.getStringAttribute(PreferencesProvider.NAME, attributes);
+            String type = MapValueConverter.getStringAttribute(PreferencesProvider.TYPE, attributes);
+            PreferencesProviderFactory factory = PreferencesProviderFactory.FACTORIES.get(type);
+            UUID id = UUIDGenerator.generatePreferencesProviderUUID(name, getName());
+            PreferencesProvider pp = factory.createInstance(id, attributes, this);
+            pp.setDesiredState(State.INITIALISING, State.ACTIVE);
+            _preferencesProvider = pp;
+            return (C)pp;
+        }
+        throw new IllegalArgumentException("Cannot create child of class " + childClass.getSimpleName());
+    }
+
+
+    @Override
+    protected void authoriseSetDesiredState(State currentState, State desiredState) throws AccessControlException
+    {
+        if(desiredState == State.DELETED)
+        {
+            if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), AuthenticationProvider.class, Operation.DELETE))
+            {
+                throw new AccessControlException("Deletion of authentication provider is denied");
+            }
+        }
+    }
+
+    @Override
+    protected void authoriseSetAttribute(String name, Object expected, Object desired) throws AccessControlException
+    {
+        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), AuthenticationProvider.class, Operation.UPDATE))
+        {
+            throw new AccessControlException("Setting of authentication provider attributes is denied");
+        }
+    }
+
+    @Override
+    protected void authoriseSetAttributes(Map<String, Object> attributes) throws AccessControlException
+    {
+        if (!_broker.getSecurityManager().authoriseConfiguringBroker(getName(), AuthenticationProvider.class, Operation.UPDATE))
+        {
+            throw new AccessControlException("Setting of authentication provider attributes is denied");
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <C extends ConfiguredObject> Collection<C> getChildren(Class<C> clazz)
+    {
+        if (clazz == PreferencesProvider.class && _preferencesProvider != null)
+        {
+            return (Collection<C>) Collections.<PreferencesProvider>singleton(_preferencesProvider);
+        }
+        return Collections.emptySet();
+    }
+
+    @Override
+    public boolean setState(State currentState, State desiredState)
+            throws IllegalStateTransitionException, AccessControlException
+    {
+        State state = _state.get();
+        if(desiredState == State.DELETED)
+        {
+            String providerName = getName();
+
+            // verify that provider is not in use
+            Collection<Port> ports = new ArrayList<Port>(_broker.getPorts());
+            for (Port port : ports)
+            {
+                if (providerName.equals(port.getAttribute(Port.AUTHENTICATION_PROVIDER)))
+                {
+                    throw new IntegrityViolationException("Authentication provider '" + providerName + "' is set on port " + port.getName());
+                }
+            }
+
+            if ((state == State.INITIALISING || state == State.ACTIVE || state == State.STOPPED || state == State.QUIESCED  || state == State.ERRORED)
+                && _state.compareAndSet(state, State.DELETED))
+            {
+                close();
+                delete();
+                if (_preferencesProvider != null)
+                {
+                    _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.DELETED);
+                }
+                return true;
+            }
+            else
+            {
+                throw new IllegalStateException("Cannot delete authentication provider in state: " + state);
+            }
+        }
+        else if(desiredState == State.ACTIVE)
+        {
+            if ((state == State.INITIALISING || state == State.QUIESCED || state == State.STOPPED) && _state.compareAndSet(state, State.ACTIVE))
+            {
+                try
+                {
+                    initialise();
+                    if (_preferencesProvider != null)
+                    {
+                        _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.ACTIVE);
+                    }
+                    return true;
+                }
+                catch(RuntimeException e)
+                {
+                    _state.compareAndSet(State.ACTIVE, State.ERRORED);
+                    if (_broker.isManagementMode())
+                    {
+                        LOGGER.warn("Failed to activate authentication provider: " + getName(), e);
+                    }
+                    else
+                    {
+                        throw e;
+                    }
+                }
+            }
+            else
+            {
+                throw new IllegalStateException("Cannot activate authentication provider in state: " + state);
+            }
+        }
+        else if (desiredState == State.QUIESCED)
+        {
+            if (state == State.INITIALISING && _state.compareAndSet(state, State.QUIESCED))
+            {
+                return true;
+            }
+        }
+        else if(desiredState == State.STOPPED)
+        {
+            if (_state.compareAndSet(state, State.STOPPED))
+            {
+                close();
+                if (_preferencesProvider != null)
+                {
+                    _preferencesProvider.setDesiredState(_preferencesProvider.getState(), State.STOPPED);
+                }
+                return true;
+            }
+            else
+            {
+                throw new IllegalStateException("Cannot stop authentication provider in state: " + state);
+            }
+        }
+
+        return false;
+    }
+
+
+    protected boolean updateState(State from, State to)
+    {
+        return _state.compareAndSet(from, to);
+    }
+
+    @Override
+    public Collection<String> getAttributeNames()
+    {
+        return getAttributeNames(getClass());
+    }
+
+    @Override
+    public Object getAttribute(final String name)
+    {
+        if(STATE.equals(name))
+        {
+            return getState();
+        }
+        else if(DURABLE.equals(name))
+        {
+            return isDurable();
+        }
+        else if(LIFETIME_POLICY.equals(name))
+        {
+            return getLifetimePolicy();
+        }
+        return super.getAttribute(name);
+    }
+}

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -21,16 +21,19 @@
 package org.apache.qpid.server.security.auth.manager;
 
 import java.security.Principal;
+import java.util.Map;
 
 import javax.security.auth.Subject;
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.sasl.anonymous.AnonymousSaslServer;
 
-public class AnonymousAuthenticationManager implements AuthenticationManager
+public class AnonymousAuthenticationManager extends AbstractAuthenticationManager<AnonymousAuthenticationManager>
 {
     private static final String ANONYMOUS = "ANONYMOUS";
 
@@ -46,10 +49,11 @@ public class AnonymousAuthenticationMana
 
     private static final AuthenticationResult ANONYMOUS_AUTHENTICATION = new AuthenticationResult(ANONYMOUS_PRINCIPAL);
 
-    static final AnonymousAuthenticationManager INSTANCE = new AnonymousAuthenticationManager();
-
-    AnonymousAuthenticationManager()
+    protected AnonymousAuthenticationManager(final Broker broker,
+                                             final Map<String, Object> defaults,
+                                             final Map<String, Object> attributes)
     {
+        super(broker, defaults, attributes);
     }
 
     @Override
@@ -112,13 +116,7 @@ public class AnonymousAuthenticationMana
     }
 
     @Override
-    public void onCreate()
-    {
-        // nothing to do, no external resource is required
-    }
-
-    @Override
-    public void onDelete()
+    public void delete()
     {
         // nothing to do, no external resource is used
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 
@@ -31,11 +32,13 @@ public class AnonymousAuthenticationMana
     public static final String PROVIDER_TYPE = "Anonymous";
 
     @Override
-    public AuthenticationManager createInstance(Broker broker, Map<String, Object> attributes)
+    public AnonymousAuthenticationManager createInstance(Broker broker,
+                                                         Map<String, Object> attributes,
+                                                         final boolean recovering)
     {
-        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(ATTRIBUTE_TYPE)))
+        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
         {
-            return new AnonymousAuthenticationManager();
+            return new AnonymousAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes);
         }
         return null;
     }
@@ -43,7 +46,7 @@ public class AnonymousAuthenticationMana
     @Override
     public Collection<String> getAttributeNames()
     {
-        return Collections.<String>singletonList(ATTRIBUTE_TYPE);
+        return Collections.<String>singletonList(AuthenticationProvider.TYPE);
     }
 
     @Override

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/AuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -83,12 +83,7 @@ public interface AuthenticationManager e
     AuthenticationResult authenticate(String username, String password);
 
     /**
-     * Called after manager creation to create the required resources, for example, user databases etc.
+     * Called before manager deletion to release and clean the resources.
      */
-    void onCreate();
-
-    /**
-     * Called before manager deletion to release and clean the resources created in {@link #onCreate()}.
-     */
-    void onDelete();
+    void delete();
 }

Added: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java?rev=1573421&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java (added)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordDatabaseAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -0,0 +1,52 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.security.auth.manager;
+
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase;
+import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
+import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+public class Base64MD5PasswordDatabaseAuthenticationManager
+        extends PrincipalDatabaseAuthenticationManager<Base64MD5PasswordDatabaseAuthenticationManager>
+{
+
+
+    protected Base64MD5PasswordDatabaseAuthenticationManager(final Broker broker,
+                                                             final Map<String, Object> defaults,
+                                                             final Map<String, Object> attributes,
+                                                             final boolean recovering)
+    {
+        super(broker, defaults, attributes,recovering);
+    }
+
+    @Override
+    protected PrincipalDatabase createDatabase()
+    {
+        return new Base64MD5PasswordFilePrincipalDatabase();
+    }
+}

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -20,15 +20,26 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 
-import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.util.ResourceBundleLoader;
 
-public class Base64MD5PasswordFileAuthenticationManagerFactory extends AbstractPrincipalDatabaseAuthManagerFactory
+public class Base64MD5PasswordFileAuthenticationManagerFactory implements AuthenticationManagerFactory
 {
     public static final String PROVIDER_TYPE = "Base64MD5PasswordFile";
+    public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.PasswordFileAuthenticationProviderAttributeDescriptions";
+    public static final String ATTRIBUTE_PATH = "path";
+
+
+    public static final Collection<String> ATTRIBUTES = Collections.unmodifiableList(Arrays.asList(
+            AuthenticationProvider.TYPE,
+            ATTRIBUTE_PATH));
 
     @Override
     public String getType()
@@ -37,15 +48,29 @@ public class Base64MD5PasswordFileAuthen
     }
 
     @Override
-    PrincipalDatabase createPrincipalDatabase()
+    public Map<String, String> getAttributeDescriptions()
     {
-        return new Base64MD5PasswordFilePrincipalDatabase();
+        return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
     }
 
+
     @Override
-    public Map<String, String> getAttributeDescriptions()
+    public AbstractAuthenticationManager createInstance(final Broker broker,
+                                                        final Map<String, Object> attributes,
+                                                        final boolean recovering)
     {
-        return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
+        if (attributes == null || !getType().equals(attributes.get(AuthenticationProvider.TYPE)))
+        {
+            return null;
+        }
+
+        return new Base64MD5PasswordDatabaseAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes,recovering);
+    }
+
+    @Override
+    public Collection<String> getAttributeNames()
+    {
+        return ATTRIBUTES;
     }
 
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -19,31 +19,44 @@
 package org.apache.qpid.server.security.auth.manager;
 
 import java.security.Principal;
+import java.util.Map;
 
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ManagedAttribute;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.sasl.external.ExternalSaslServer;
 
-public class ExternalAuthenticationManager implements AuthenticationManager
+public class ExternalAuthenticationManager extends AbstractAuthenticationManager<ExternalAuthenticationManager>
 {
     private static final String EXTERNAL = "EXTERNAL";
 
-    private boolean _useFullDN = false;
+    private boolean _useFullDN;
 
-    ExternalAuthenticationManager(boolean useFullDN)
+    protected ExternalAuthenticationManager(final Broker broker,
+                                            final Map<String, Object> defaults,
+                                            final Map<String, Object> attributes)
     {
-        _useFullDN = useFullDN;
+        super(broker, defaults, attributes);
     }
 
+
     @Override
     public void initialise()
     {
 
     }
 
+    @ManagedAttribute( automate = true )
+    public boolean getUseFullDN()
+    {
+        return _useFullDN;
+    }
+
     @Override
     public String getMechanisms()
     {
@@ -101,13 +114,7 @@ public class ExternalAuthenticationManag
     }
 
     @Override
-    public void onCreate()
-    {
-        // nothing to do, no external resource is required
-    }
-
-    @Override
-    public void onDelete()
+    public void delete()
     {
         // nothing to do, no external resource is used
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.util.ResourceBundleLoader;
@@ -35,17 +36,17 @@ public class ExternalAuthenticationManag
     public static final String ATTRIBUTE_USE_FULL_DN = "useFullDN";
 
     public static final Collection<String> ATTRIBUTES = Collections.<String> unmodifiableList(Arrays.asList(
-            ATTRIBUTE_TYPE,
+            AuthenticationProvider.TYPE,
             ATTRIBUTE_USE_FULL_DN));
 
     @Override
-    public AuthenticationManager createInstance(Broker broker, Map<String, Object> attributes)
+    public ExternalAuthenticationManager createInstance(Broker broker,
+                                                        Map<String, Object> attributes,
+                                                        final boolean recovering)
     {
-        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(ATTRIBUTE_TYPE)))
+        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
         {
-            boolean useFullDN = Boolean.valueOf(String.valueOf(attributes.get(ATTRIBUTE_USE_FULL_DN)));
-
-            return new ExternalAuthenticationManager(useFullDN);
+            return new ExternalAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes);
         }
         return null;
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -21,6 +21,7 @@ package org.apache.qpid.server.security.
 import java.io.IOException;
 import java.security.Principal;
 import java.util.HashMap;
+import java.util.Map;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
@@ -28,18 +29,25 @@ import javax.security.sasl.AuthorizeCall
 import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
+
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 
-public class KerberosAuthenticationManager implements AuthenticationManager
+public class KerberosAuthenticationManager extends AbstractAuthenticationManager<KerberosAuthenticationManager>
 {
     private static final String GSSAPI_MECHANISM = "GSSAPI";
     private final CallbackHandler _callbackHandler = new GssApiCallbackHandler();
 
-    KerberosAuthenticationManager()
+    protected KerberosAuthenticationManager(final Broker broker,
+                                            final Map<String, Object> defaults,
+                                            final Map<String, Object> attributes)
     {
+        super(broker, defaults, attributes);
     }
 
+
     @Override
     public void initialise()
     {
@@ -57,16 +65,8 @@ public class KerberosAuthenticationManag
     {
         if(GSSAPI_MECHANISM.equals(mechanism))
         {
-            try
-            {
             return Sasl.createSaslServer(GSSAPI_MECHANISM, "AMQP", localFQDN,
                                          new HashMap<String, Object>(), _callbackHandler);
-            }
-            catch (SaslException e)
-            {
-                e.printStackTrace(System.err);
-                throw e;
-            }
         }
         else
         {
@@ -110,13 +110,7 @@ public class KerberosAuthenticationManag
     }
 
     @Override
-    public void onCreate()
-    {
-        // nothing to do, no external resource is required
-    }
-
-    @Override
-    public void onDelete()
+    public void delete()
     {
         // nothing to do, no external resource is used
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 
@@ -31,11 +32,13 @@ public class KerberosAuthenticationManag
     public static final String PROVIDER_TYPE = "Kerberos";
 
     @Override
-    public AuthenticationManager createInstance(Broker broker, Map<String, Object> attributes)
+    public KerberosAuthenticationManager createInstance(Broker broker,
+                                                        Map<String, Object> attributes,
+                                                        final boolean recovering)
     {
-        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(ATTRIBUTE_TYPE)))
+        if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
         {
-            return new KerberosAuthenticationManager();
+            return new KerberosAuthenticationManager(broker, Collections.<String,Object>emptyMap(), attributes);
         }
         return null;
     }
@@ -43,7 +46,7 @@ public class KerberosAuthenticationManag
     @Override
     public Collection<String> getAttributeNames()
     {
-        return Collections.<String>singletonList(ATTRIBUTE_TYPE);
+        return Collections.<String>singletonList(AuthenticationProvider.TYPE);
     }
 
     @Override



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


Mime
View raw message