You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2014/04/05 00:34:30 UTC
svn commit: r1584931 [4/7] - in /qpid/trunk/qpid/java: ./
bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/
bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/
bdbstore/src/main/java/org/apache/qpid/server/store/be...
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=1584931&r1=1584930&r2=1584931&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 Fri Apr 4 22:34:26 2014
@@ -32,9 +32,11 @@ 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.ManagedObject;
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.UsernamePrincipal;
+@ManagedObject( category = false, type = "Kerberos" )
public class KerberosAuthenticationManager extends AbstractAuthenticationManager<KerberosAuthenticationManager>
{
private static final String GSSAPI_MECHANISM = "GSSAPI";
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=1584931&r1=1584930&r2=1584931&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 Fri Apr 4 22:34:26 2014
@@ -19,28 +19,21 @@
*/
package org.apache.qpid.server.security.auth.manager;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+
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;
-
-public class KerberosAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class KerberosAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<KerberosAuthenticationManager>
{
public static final String PROVIDER_TYPE = "Kerberos";
- @Override
- public KerberosAuthenticationManager createInstance(Broker broker,
- Map<String, Object> attributes,
- final boolean recovering)
+ public KerberosAuthenticationManagerFactory()
{
- if (attributes != null && PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
- {
- return new KerberosAuthenticationManager(broker, Collections.<String,Object>emptyMap(), attributes);
- }
- return null;
+ super(KerberosAuthenticationManager.class);
}
@Override
@@ -50,14 +43,16 @@ public class KerberosAuthenticationManag
}
@Override
- public String getType()
+ public Map<String, String> getAttributeDescriptions()
{
- return PROVIDER_TYPE;
+ return Collections.emptyMap();
}
@Override
- public Map<String, String> getAttributeDescriptions()
+ public KerberosAuthenticationManager createInstance(final Map<String, Object> attributes,
+ final ConfiguredObject<?>... parents)
{
- return null;
+ return new KerberosAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(), attributes);
}
+
}
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java Fri Apr 4 22:34:26 2014
@@ -21,11 +21,13 @@
package org.apache.qpid.server.security.auth.manager;
import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ManagedObject;
import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
import java.util.Map;
+@ManagedObject( category = false, type = "PlainPasswordFile" )
public class PlainPasswordDatabaseAuthenticationManager extends PrincipalDatabaseAuthenticationManager<PlainPasswordDatabaseAuthenticationManager>
{
protected PlainPasswordDatabaseAuthenticationManager(final Broker broker,
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java Fri Apr 4 22:34:26 2014
@@ -20,17 +20,21 @@
*/
package org.apache.qpid.server.security.auth.manager;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.store.ConfiguredObjectRecord;
+import org.apache.qpid.server.store.ResolvedObject;
+import org.apache.qpid.server.store.UnresolvedConfiguredObject;
+import org.apache.qpid.server.util.ResourceBundleLoader;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
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;
-
-public class PlainPasswordFileAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class PlainPasswordFileAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<PlainPasswordDatabaseAuthenticationManager>
{
public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.PasswordFileAuthenticationProviderAttributeDescriptions";
public static final String ATTRIBUTE_PATH = "path";
@@ -42,23 +46,9 @@ public class PlainPasswordFileAuthentica
public static final String PROVIDER_TYPE = "PlainPasswordFile";
- @Override
- public String getType()
- {
- return PROVIDER_TYPE;
- }
-
- @Override
- public AbstractAuthenticationManager createInstance(final Broker broker,
- final Map<String, Object> attributes,
- final boolean recovering)
+ public PlainPasswordFileAuthenticationManagerFactory()
{
- if (attributes == null || !getType().equals(attributes.get(AuthenticationProvider.TYPE)))
- {
- return null;
- }
-
- return new PlainPasswordDatabaseAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes,recovering);
+ super(PlainPasswordDatabaseAuthenticationManager.class);
}
@Override
@@ -73,4 +63,27 @@ public class PlainPasswordFileAuthentica
{
return ATTRIBUTES;
}
+
+ @Override
+ public PlainPasswordDatabaseAuthenticationManager createInstance(final Map<String, Object> attributes,
+ final ConfiguredObject<?>... parents)
+ {
+ return new PlainPasswordDatabaseAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(),attributes,false);
+ }
+
+ @Override
+ public UnresolvedConfiguredObject<PlainPasswordDatabaseAuthenticationManager> recover(final ConfiguredObjectRecord record,
+ final ConfiguredObject<?>... parents)
+ {
+
+ Map<String, Object> attributes = new HashMap<String, Object>(record.getAttributes());
+ attributes.put(ConfiguredObject.ID, record.getId());
+ PlainPasswordDatabaseAuthenticationManager authManager = new PlainPasswordDatabaseAuthenticationManager(
+ getParent(Broker.class, parents),
+ Collections.<String, Object>emptyMap(),
+ attributes,
+ true);
+
+ return ResolvedObject.newInstance(authManager);
+ }
}
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java Fri Apr 4 22:34:26 2014
@@ -39,8 +39,7 @@ import javax.security.sasl.SaslServer;
import org.apache.log4j.Logger;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.model.adapter.AbstractConfiguredObject;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
import org.apache.qpid.server.security.access.Operation;
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.UsernamePrincipal;
@@ -420,14 +419,6 @@ public abstract class PrincipalDatabaseA
}
@Override
- public <C extends ConfiguredObject> C createChild(Class<C> childClass,
- Map<String, Object> attributes,
- ConfiguredObject... otherParents)
- {
- return null;
- }
-
- @Override
public Collection<String> getAttributeNames()
{
return getAttributeNames(User.class);
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManager.java Fri Apr 4 22:34:26 2014
@@ -20,18 +20,18 @@
*/
package org.apache.qpid.server.security.auth.manager;
-import org.apache.qpid.server.configuration.ConfigurationEntry;
import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
import org.apache.qpid.server.configuration.RecovererProvider;
import org.apache.qpid.server.configuration.updater.ChangeAttributesTask;
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.model.AbstractConfiguredObject;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.security.access.Operation;
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.UsernamePrincipal;
import org.apache.qpid.server.security.auth.sasl.scram.ScramSHA1SaslServer;
+import org.apache.qpid.server.store.ConfiguredObjectRecord;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
@@ -40,7 +40,6 @@ import javax.security.sasl.SaslException
import javax.security.sasl.SaslServer;
import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.AccessControlException;
import java.security.InvalidKeyException;
@@ -56,6 +55,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
+@ManagedObject( category = false, type = "SCRAM-SHA1" )
public class ScramSHA1AuthenticationManager
extends AbstractAuthenticationManager<ScramSHA1AuthenticationManager>
implements PasswordCredentialManagingAuthenticationProvider<ScramSHA1AuthenticationManager>,
@@ -71,8 +71,7 @@ public class ScramSHA1AuthenticationMana
protected ScramSHA1AuthenticationManager(final Broker broker,
final Map<String, Object> defaults,
- final Map<String, Object> attributes,
- final boolean recovering)
+ final Map<String, Object> attributes)
{
super(broker, defaults, attributes);
}
@@ -265,7 +264,7 @@ public class ScramSHA1AuthenticationMana
userAttrs.put(User.NAME, username);
userAttrs.put(User.PASSWORD, createStoredPassword(password));
userAttrs.put(User.TYPE, SCRAM_USER_TYPE);
- ScramAuthUser user = new ScramAuthUser(userAttrs);
+ ScramAuthUser user = new ScramAuthUser(userAttrs, this);
_users.put(username, user);
return true;
@@ -425,30 +424,25 @@ public class ScramSHA1AuthenticationMana
@Override
public ConfiguredObjectRecoverer<? extends ConfiguredObject> getRecoverer(final String type)
{
- if("User".equals(type))
- {
- return new UserRecoverer();
- }
- else
- {
- return null;
- }
+ return null;
}
- private class ScramAuthUser extends AbstractConfiguredObject<ScramAuthUser> implements User<ScramAuthUser>
+ @ManagedObject( category = false, type = "scram")
+ static class ScramAuthUser extends AbstractConfiguredObject<ScramAuthUser> implements User<ScramAuthUser>
{
-
- protected ScramAuthUser(final Map<String, Object> attributes)
+ private ScramSHA1AuthenticationManager _authenticationManager;
+ protected ScramAuthUser(final Map<String, Object> attributes, ScramSHA1AuthenticationManager parent)
{
- super(parentsMap(ScramSHA1AuthenticationManager.this),
+ super(parentsMap(parent),
Collections.<String,Object>emptyMap(),
- attributes, ScramSHA1AuthenticationManager.this.getTaskExecutor());
-
+ attributes, parent.getTaskExecutor());
+ _authenticationManager = parent;
if(!ASCII.newEncoder().canEncode(getName()))
{
throw new IllegalArgumentException("Scram SHA1 user names are restricted to characters in the ASCII charset");
}
+
}
@Override
@@ -456,9 +450,9 @@ public class ScramSHA1AuthenticationMana
{
if(desiredState == State.DELETED)
{
- getSecurityManager().authoriseUserOperation(Operation.DELETE, getName());
- _users.remove(getName());
- ScramSHA1AuthenticationManager.this.childRemoved(this);
+ _authenticationManager.getSecurityManager().authoriseUserOperation(Operation.DELETE, getName());
+ _authenticationManager._users.remove(getName());
+ _authenticationManager.childRemoved(this);
return true;
}
else
@@ -479,7 +473,7 @@ public class ScramSHA1AuthenticationMana
{
try
{
- modifiedAttributes.put(User.PASSWORD, createStoredPassword(newPassword));
+ modifiedAttributes.put(User.PASSWORD, _authenticationManager.createStoredPassword(newPassword));
}
catch (SaslException e)
{
@@ -514,11 +508,12 @@ public class ScramSHA1AuthenticationMana
@Override
public void setPassword(final String password)
{
- getSecurityManager().authoriseUserOperation(Operation.UPDATE, getName());
+ _authenticationManager.getSecurityManager().authoriseUserOperation(Operation.UPDATE, getName());
try
{
- changeAttribute(User.PASSWORD, getAttribute(User.PASSWORD), createStoredPassword(password));
+ changeAttribute(User.PASSWORD, getAttribute(User.PASSWORD), _authenticationManager.createStoredPassword(
+ password));
}
catch (SaslException e)
{
@@ -579,7 +574,7 @@ public class ScramSHA1AuthenticationMana
@Override
public Map<String, Object> getPreferences()
{
- PreferencesProvider preferencesProvider = getPreferencesProvider();
+ PreferencesProvider preferencesProvider = _authenticationManager.getPreferencesProvider();
if (preferencesProvider == null)
{
return null;
@@ -601,7 +596,7 @@ public class ScramSHA1AuthenticationMana
@Override
public Map<String, Object> setPreferences(Map<String, Object> preferences)
{
- PreferencesProvider preferencesProvider = getPreferencesProvider();
+ PreferencesProvider preferencesProvider = _authenticationManager.getPreferencesProvider();
if (preferencesProvider == null)
{
return null;
@@ -612,7 +607,7 @@ public class ScramSHA1AuthenticationMana
@Override
public boolean deletePreferences()
{
- PreferencesProvider preferencesProvider = getPreferencesProvider();
+ PreferencesProvider preferencesProvider = _authenticationManager.getPreferencesProvider();
if (preferencesProvider == null)
{
return false;
@@ -680,17 +675,13 @@ public class ScramSHA1AuthenticationMana
}
}
- private class UserRecoverer implements ConfiguredObjectRecoverer<ScramAuthUser>
+ public void instantiateUser(User<?> user)
{
- @Override
- public ScramAuthUser create(final RecovererProvider recovererProvider,
- final ConfigurationEntry entry,
- final ConfiguredObject... parents)
+ if(!(user instanceof ScramAuthUser))
{
-
- Map<String,Object> attributes = new HashMap<String, Object>(entry.getAttributes());
- attributes.put(User.ID,entry.getId());
- return new ScramAuthUser(attributes);
+ throw new IllegalArgumentException("Only users of type " + ScramAuthUser.class.getSimpleName() + " can be add to a " + getClass().getSimpleName());
}
+ _users.put(user.getName(), (ScramAuthUser) user);
+
}
}
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerFactory.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ScramSHA1AuthenticationManagerFactory.java Fri Apr 4 22:34:26 2014
@@ -21,15 +21,14 @@ package org.apache.qpid.server.security.
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;
+import org.apache.qpid.server.model.ConfiguredObject;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
-public class ScramSHA1AuthenticationManagerFactory implements AuthenticationManagerFactory
+public class ScramSHA1AuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<ScramSHA1AuthenticationManager>
{
public static final String PROVIDER_TYPE = "SCRAM-SHA1";
@@ -40,18 +39,9 @@ public class ScramSHA1AuthenticationMana
AuthenticationProvider.TYPE
));
- @Override
- public ScramSHA1AuthenticationManager createInstance(Broker broker,
- Map<String, Object> attributes,
- final boolean recovering)
+ public ScramSHA1AuthenticationManagerFactory()
{
- if (attributes == null || !PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
- {
- return null;
- }
-
-
- return new ScramSHA1AuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes, false);
+ super(ScramSHA1AuthenticationManager.class);
}
@Override
@@ -61,14 +51,16 @@ public class ScramSHA1AuthenticationMana
}
@Override
- public String getType()
+ public Map<String, String> getAttributeDescriptions()
{
- return PROVIDER_TYPE;
+ return Collections.emptyMap();
}
@Override
- public Map<String, String> getAttributeDescriptions()
+ public ScramSHA1AuthenticationManager createInstance(final Map<String, Object> attributes,
+ final ConfiguredObject<?>... parents)
{
- return Collections.emptyMap();
+ return new ScramSHA1AuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(),attributes);
}
+
}
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java Fri Apr 4 22:34:26 2014
@@ -38,11 +38,13 @@ import javax.security.sasl.SaslServer;
import org.apache.log4j.Logger;
import org.apache.qpid.server.configuration.updater.TaskExecutor;
import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ManagedObject;
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.UsernamePrincipal;
import org.apache.qpid.server.security.auth.sasl.plain.PlainPasswordCallback;
import org.apache.qpid.server.security.auth.sasl.plain.PlainSaslServer;
+@ManagedObject( category = false, type = "Simple" )
public class SimpleAuthenticationManager extends AbstractAuthenticationManager<SimpleAuthenticationManager>
{
private static final Logger _logger = Logger.getLogger(SimpleAuthenticationManager.class);
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java Fri Apr 4 22:34:26 2014
@@ -50,6 +50,7 @@ import org.apache.qpid.server.configurat
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.ManagedAttribute;
import org.apache.qpid.server.model.ManagedAttributeField;
+import org.apache.qpid.server.model.ManagedObject;
import org.apache.qpid.server.model.TrustStore;
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
@@ -62,6 +63,7 @@ import org.apache.qpid.server.util.Serve
import org.apache.qpid.server.util.StringUtil;
import org.apache.qpid.ssl.SSLContextFactory;
+@ManagedObject( category = false, type = "SimpleLDAP" )
public class SimpleLDAPAuthenticationManager extends AbstractAuthenticationManager<SimpleLDAPAuthenticationManager>
{
private static final Logger _logger = Logger.getLogger(SimpleLDAPAuthenticationManager.class);
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java Fri Apr 4 22:34:26 2014
@@ -19,22 +19,19 @@
*/
package org.apache.qpid.server.security.auth.manager;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.util.ResourceBundleLoader;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.TrustStore;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-import org.apache.qpid.server.util.ResourceBundleLoader;
-
-public class SimpleLDAPAuthenticationManagerFactory implements AuthenticationManagerFactory
+public class SimpleLDAPAuthenticationManagerFactory extends AbstractAuthenticationManagerFactory<SimpleLDAPAuthenticationManager>
{
public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.SimpleLDAPAuthenticationProviderAttributeDescriptions";
- private static final String DEFAULT_LDAP_CONTEXT_FACTORY = "com.sun.jndi.ldap.LdapCtxFactory";
public static final String PROVIDER_TYPE = "SimpleLDAP";
@@ -56,18 +53,9 @@ public class SimpleLDAPAuthenticationMan
ATTRIBUTE_LDAP_CONTEXT_FACTORY
));
- @Override
- public SimpleLDAPAuthenticationManager createInstance(Broker broker,
- Map<String, Object> attributes,
- final boolean recovering)
+ public SimpleLDAPAuthenticationManagerFactory()
{
- if (attributes == null || !PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
- {
- return null;
- }
-
-
- return new SimpleLDAPAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes);
+ super(SimpleLDAPAuthenticationManager.class);
}
@Override
@@ -77,14 +65,16 @@ public class SimpleLDAPAuthenticationMan
}
@Override
- public String getType()
+ public Map<String, String> getAttributeDescriptions()
{
- return PROVIDER_TYPE;
+ return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
}
@Override
- public Map<String, String> getAttributeDescriptions()
+ public SimpleLDAPAuthenticationManager createInstance(final Map<String, Object> attributes,
+ final ConfiguredObject<?>... parents)
{
- return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
+ return new SimpleLDAPAuthenticationManager(getParent(Broker.class, parents), Collections.<String,Object>emptyMap(),attributes);
}
+
}
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/stats/StatisticsGatherer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/stats/StatisticsGatherer.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/stats/StatisticsGatherer.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/stats/StatisticsGatherer.java Fri Apr 4 22:34:26 2014
@@ -103,4 +103,9 @@ public interface StatisticsGatherer
* Reset the counters for this, and any child {@link StatisticsGatherer}s.
*/
void resetStatistics();
+
+ interface Source
+ {
+ StatisticsGatherer getStatisticsGatherer();
+ }
}
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractDurableConfiguredObjectRecoverer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractDurableConfiguredObjectRecoverer.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractDurableConfiguredObjectRecoverer.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractDurableConfiguredObjectRecoverer.java Fri Apr 4 22:34:26 2014
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import java.util.Map;
import java.util.UUID;
public abstract class AbstractDurableConfiguredObjectRecoverer<T> implements DurableConfiguredObjectRecoverer
@@ -41,21 +40,26 @@ public abstract class AbstractDurableCon
else
{
durableConfigurationRecoverer.addResolutionListener(dependency.getType(), dependency.getId(),
- new DependencyListener()
- {
+ new DependencyListener()
+ {
- @Override
- public void dependencyResolved(final String depType,
- final UUID depId,
- final Object o)
- {
- dependency.resolve(o);
- if(obj.getUnresolvedDependencies().length == 0)
- {
- durableConfigurationRecoverer.resolve(getType(), record.getId(), obj.resolve());
- }
- }
- });
+ @Override
+ public void dependencyResolved(final String depType,
+ final UUID depId,
+ final Object o)
+ {
+ dependency.resolve(o);
+ if (obj.getUnresolvedDependencies().length
+ == 0)
+ {
+ durableConfigurationRecoverer.resolve(
+ getType(),
+ record.getId(),
+ obj.resolve());
+ }
+ }
+ }
+ );
}
}
if(obj.getUnresolvedDependencies().length == 0)
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java Fri Apr 4 22:34:26 2014
@@ -41,7 +41,8 @@ public interface DurableConfigurationSto
/**
* Called after instantiation in order to configure the message store. A particular implementation can define
* whatever parameters it wants.
- * @param parent host name
+ *
+ * @param parent
* @param storeSettings store settings
*/
void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings) throws StoreException;
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java Fri Apr 4 22:34:26 2014
@@ -93,7 +93,6 @@ public class JsonFileConfigStore impleme
public void openConfigurationStore(ConfiguredObject<?> parent, Map<String, Object> storeSettings)
{
_name = parent.getName();
-
setup(storeSettings);
load();
}
Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/BrokerConfigurationStoreCreatorTest.java Fri Apr 4 22:34:26 2014
@@ -20,28 +20,37 @@
*/
package org.apache.qpid.server.configuration;
-import java.io.File;
-import java.io.StringWriter;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
import org.apache.qpid.server.BrokerOptions;
import org.apache.qpid.server.configuration.store.JsonConfigurationEntryStore;
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.logging.EventLogger;
+import org.apache.qpid.server.logging.LogRecorder;
import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObjectFactory;
import org.apache.qpid.server.model.Model;
+import org.apache.qpid.server.model.SystemContext;
import org.apache.qpid.test.utils.QpidTestCase;
import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.util.FileUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
+import java.io.File;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
public class BrokerConfigurationStoreCreatorTest extends QpidTestCase
{
private File _userStoreLocation;
private BrokerConfigurationStoreCreator _storeCreator;
+ private SystemContext _systemContext;
public void setUp() throws Exception
{
@@ -56,6 +65,13 @@ public class BrokerConfigurationStoreCre
}
_storeCreator = new BrokerConfigurationStoreCreator();
_userStoreLocation = new File(TMP_FOLDER, "_store_" + System.currentTimeMillis() + "_" + getTestName());
+ final BrokerOptions brokerOptions = mock(BrokerOptions.class);
+ when(brokerOptions.getConfigurationStoreLocation()).thenReturn(_userStoreLocation.getAbsolutePath());
+ _systemContext = new SystemContext(new TaskExecutor(),
+ new ConfiguredObjectFactory(),
+ mock(EventLogger.class),
+ mock(LogRecorder.class),
+ brokerOptions);
}
public void tearDown() throws Exception
@@ -73,13 +89,15 @@ public class BrokerConfigurationStoreCre
}
}
+
public void testCreateJsonStore()
{
- ConfigurationEntryStore store = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, false, new BrokerOptions().getConfigProperties());
+ ConfigurationEntryStore store = _storeCreator.createStore(_systemContext, "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, false, new BrokerOptions().getConfigProperties());
assertNotNull("Store was not created", store);
assertTrue("File should exists", _userStoreLocation.exists());
assertTrue("File size should be greater than 0", _userStoreLocation.length() > 0);
- JsonConfigurationEntryStore jsonStore = new JsonConfigurationEntryStore(_userStoreLocation.getAbsolutePath(), null, false, Collections.<String,String>emptyMap());
+ JsonConfigurationEntryStore jsonStore = new JsonConfigurationEntryStore(_systemContext, null, false, Collections
+ .<String,String>emptyMap());
Set<UUID> childrenIds = jsonStore.getRootEntry().getChildrenIds();
assertFalse("Unexpected children: " + childrenIds, childrenIds.isEmpty());
}
@@ -116,11 +134,11 @@ public class BrokerConfigurationStoreCre
File _initialStoreFile = TestFileUtils.createTempFile(this, ".json", brokerJson);
- ConfigurationEntryStore store = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", _initialStoreFile.getAbsolutePath(), false, Collections.<String,String>emptyMap());
+ ConfigurationEntryStore store = _storeCreator.createStore(_systemContext, "json", _initialStoreFile.getAbsolutePath(), false, Collections.<String,String>emptyMap());
assertNotNull("Store was not created", store);
assertTrue("File should exists", _userStoreLocation.exists());
assertTrue("File size should be greater than 0", _userStoreLocation.length() > 0);
- JsonConfigurationEntryStore jsonStore = new JsonConfigurationEntryStore(_userStoreLocation.getAbsolutePath(), null, false, Collections.<String,String>emptyMap());
+ JsonConfigurationEntryStore jsonStore = new JsonConfigurationEntryStore(_systemContext, null, false, Collections.<String,String>emptyMap());
ConfigurationEntry entry = jsonStore.getRootEntry();
assertEquals("Unexpected root id", testBrokerId, entry.getId());
Map<String, Object> attributes = entry.getAttributes();
@@ -132,13 +150,13 @@ public class BrokerConfigurationStoreCre
if(overwrite)
{
- ConfigurationEntryStore overwrittenStore = _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, true, new BrokerOptions().getConfigProperties());
+ ConfigurationEntryStore overwrittenStore = _storeCreator.createStore(_systemContext, "json", BrokerOptions.DEFAULT_INITIAL_CONFIG_LOCATION, true, new BrokerOptions().getConfigProperties());
assertNotNull("Store was not created", overwrittenStore);
assertTrue("File should exists", _userStoreLocation.exists());
assertTrue("File size should be greater than 0", _userStoreLocation.length() > 0);
//check the contents reflect the test store content having been overwritten with the default store
- JsonConfigurationEntryStore reopenedOverwrittenStore = new JsonConfigurationEntryStore(_userStoreLocation.getAbsolutePath(), null, false, Collections.<String,String>emptyMap());
+ JsonConfigurationEntryStore reopenedOverwrittenStore = new JsonConfigurationEntryStore(_systemContext, null, false, Collections.<String,String>emptyMap());
entry = reopenedOverwrittenStore.getRootEntry();
assertFalse("Root id did not change, store content was not overwritten", testBrokerId.equals(entry.getId()));
attributes = entry.getAttributes();
@@ -154,7 +172,7 @@ public class BrokerConfigurationStoreCre
{
try
{
- _storeCreator.createStore(_userStoreLocation.getAbsolutePath(), "other", null, false, Collections.<String,String>emptyMap());
+ _storeCreator.createStore(_systemContext, "other", null, false, Collections.<String,String>emptyMap());
fail("Store is not yet supported");
}
catch(IllegalConfigurationException e)
@@ -162,4 +180,5 @@ public class BrokerConfigurationStoreCre
// pass
}
}
+
}
Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/BrokerRecovererTest.java Fri Apr 4 22:34:26 2014
@@ -20,74 +20,61 @@
*/
package org.apache.qpid.server.configuration.startup;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import junit.framework.TestCase;
+import org.apache.qpid.server.BrokerOptions;
+import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.configuration.RecovererProvider;
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.logging.EventLogger;
+import org.apache.qpid.server.logging.LogRecorder;
+import org.apache.qpid.server.model.*;
+import org.apache.qpid.server.store.ConfiguredObjectRecord;
+import org.apache.qpid.server.store.ConfiguredObjectRecordImpl;
+import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.TestMemoryMessageStore;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.UUID;
-import junit.framework.TestCase;
-
-import org.apache.qpid.server.BrokerOptions;
-import org.apache.qpid.server.configuration.ConfigurationEntry;
-import org.apache.qpid.server.configuration.ConfiguredObjectRecoverer;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.configuration.RecovererProvider;
-import org.apache.qpid.server.logging.LogRecorder;
-import org.apache.qpid.server.model.AuthenticationProvider;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.ConfiguredObject;
-import org.apache.qpid.server.model.GroupProvider;
-import org.apache.qpid.server.model.KeyStore;
-import org.apache.qpid.server.model.Model;
-import org.apache.qpid.server.model.Plugin;
-import org.apache.qpid.server.model.Port;
-import org.apache.qpid.server.model.TrustStore;
-import org.apache.qpid.server.model.UUIDGenerator;
-import org.apache.qpid.server.model.VirtualHost;
-import org.apache.qpid.server.model.adapter.AccessControlProviderFactory;
-import org.apache.qpid.server.model.adapter.AuthenticationProviderFactory;
-import org.apache.qpid.server.model.adapter.GroupProviderFactory;
-import org.apache.qpid.server.model.adapter.PortFactory;
-import org.apache.qpid.server.configuration.store.StoreConfigurationChangeListener;
-import org.apache.qpid.server.configuration.updater.TaskExecutor;
-import org.apache.qpid.server.stats.StatisticsGatherer;
-import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class BrokerRecovererTest extends TestCase
{
- private BrokerRecoverer _brokerRecoverer;
- private ConfigurationEntry _brokerEntry = mock(ConfigurationEntry.class);
+ private ConfiguredObjectRecord _brokerEntry = mock(ConfiguredObjectRecord.class);
private UUID _brokerId = UUID.randomUUID();
- private Map<String, Collection<ConfigurationEntry>> _brokerEntryChildren = new HashMap<String, Collection<ConfigurationEntry>>();
- private ConfigurationEntry _authenticationProviderEntry1;
+ private Map<String, Collection<ConfiguredObjectRecord>> _brokerEntryChildren = new HashMap<String, Collection<ConfiguredObjectRecord>>();
+ private ConfiguredObjectRecord _authenticationProviderEntry1;
private AuthenticationProvider _authenticationProvider1;
private UUID _authenticationProvider1Id = UUID.randomUUID();
+ private SystemContext _systemContext;
+ private ConfiguredObjectFactory _configuredObjectFactory;
@Override
protected void setUp() throws Exception
{
super.setUp();
- _brokerRecoverer = new BrokerRecoverer(mock(AuthenticationProviderFactory.class), mock(GroupProviderFactory.class), mock(AccessControlProviderFactory.class), mock(PortFactory.class),
- mock(StatisticsGatherer.class), mock(VirtualHostRegistry.class), mock(LogRecorder.class),
- mock(TaskExecutor.class), mock(BrokerOptions.class),
- mock(StoreConfigurationChangeListener.class));
+ _configuredObjectFactory = new ConfiguredObjectFactory();
+ _systemContext = new SystemContext(mock(TaskExecutor.class),
+ _configuredObjectFactory, mock(EventLogger.class), mock(LogRecorder.class), mock(BrokerOptions.class));
+
when(_brokerEntry.getId()).thenReturn(_brokerId);
- when(_brokerEntry.getChildren()).thenReturn(_brokerEntryChildren);
+ when(_brokerEntry.getType()).thenReturn(Broker.class.getSimpleName());
when(_brokerEntry.getAttributes()).thenReturn(Collections.<String, Object>singletonMap(Broker.MODEL_VERSION, Model.MODEL_VERSION));
+ when(_brokerEntry.getParents()).thenReturn(Collections.singletonMap(SystemContext.class.getSimpleName(), _systemContext.asObjectRecord()));
//Add a base AuthenticationProvider for all tests
_authenticationProvider1 = mock(AuthenticationProvider.class);
when(_authenticationProvider1.getName()).thenReturn("authenticationProvider1");
when(_authenticationProvider1.getId()).thenReturn(_authenticationProvider1Id);
- _authenticationProviderEntry1 = mock(ConfigurationEntry.class);
+ _authenticationProviderEntry1 = mock(ConfiguredObjectRecord.class);
_brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1));
}
@@ -120,16 +107,9 @@ public class BrokerRecovererTest extends
when(_brokerEntry.getAttributes()).thenReturn(entryAttributes);
- final ConfigurationEntry virtualHostEntry = mock(ConfigurationEntry.class);
- String typeName = VirtualHost.class.getSimpleName();
- when(virtualHostEntry.getType()).thenReturn(typeName);
- _brokerEntryChildren.put(typeName, Arrays.asList(virtualHostEntry));
- final VirtualHost virtualHost = mock(VirtualHost.class);
- when(virtualHost.getName()).thenReturn("test");
+ _systemContext.resolveObjects(_brokerEntry);
+ Broker broker = _systemContext.getBroker();
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[] { virtualHostEntry, _authenticationProviderEntry1 },
- new ConfiguredObject[] { virtualHost, _authenticationProvider1 });
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
assertNotNull(broker);
assertEquals(_brokerId, broker.getId());
@@ -142,153 +122,136 @@ public class BrokerRecovererTest extends
public void testCreateBrokerWithVirtualHost()
{
- final ConfigurationEntry virtualHostEntry = mock(ConfigurationEntry.class);
+ final ConfiguredObjectRecord virtualHostEntry = mock(ConfiguredObjectRecord.class);
String typeName = VirtualHost.class.getSimpleName();
when(virtualHostEntry.getType()).thenReturn(typeName);
_brokerEntryChildren.put(typeName, Arrays.asList(virtualHostEntry));
- final VirtualHost virtualHost = mock(VirtualHost.class);
-
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{virtualHostEntry, _authenticationProviderEntry1},
- new ConfiguredObject[]{virtualHost, _authenticationProvider1});
-
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
+ UUID vhostId = UUID.randomUUID();
+ _systemContext.resolveObjects(_brokerEntry, createVhostRecord(vhostId));
+ Broker<?> broker = _systemContext.getBroker();
assertNotNull(broker);
assertEquals(_brokerId, broker.getId());
assertEquals(1, broker.getVirtualHosts().size());
- assertEquals(virtualHost, broker.getVirtualHosts().iterator().next());
+ assertEquals(vhostId, broker.getVirtualHosts().iterator().next().getId());
+
}
- public void testCreateBrokerWithPorts()
+ public ConfiguredObjectRecord createVhostRecord(UUID id)
{
- ConfigurationEntry portEntry = mock(ConfigurationEntry.class);
- Port port = mock(Port.class);
- _brokerEntryChildren.put(Port.class.getSimpleName(), Arrays.asList(portEntry));
-
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{portEntry, _authenticationProviderEntry1},
- new ConfiguredObject[]{port, _authenticationProvider1});
-
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
-
- assertNotNull(broker);
- assertEquals(_brokerId, broker.getId());
- assertEquals(Collections.singletonList(port), broker.getPorts());
+ final Map<String, Object> vhostAttributes = new HashMap<String, Object>();
+ vhostAttributes.put(VirtualHost.NAME, "vhost");
+ vhostAttributes.put(VirtualHost.TYPE, "STANDARD");
+ vhostAttributes.put(VirtualHost.MESSAGE_STORE_SETTINGS, Collections.singletonMap(MessageStore.STORE_TYPE,
+ TestMemoryMessageStore.TYPE));
+ return new ConfiguredObjectRecordImpl(id, VirtualHost.class.getSimpleName(), vhostAttributes, Collections
+ .singletonMap(Broker.class.getSimpleName(), _brokerEntry));
}
- public void testCreateBrokerWithOneAuthenticationProvider()
+ public ConfiguredObjectRecord createAuthProviderRecord(UUID id, String name)
{
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{_authenticationProviderEntry1},
- new ConfiguredObject[]{_authenticationProvider1});
-
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
+ final Map<String, Object> authProviderAttrs = new HashMap<String, Object>();
+ authProviderAttrs.put(AuthenticationProvider.NAME, name);
+ authProviderAttrs.put(AuthenticationProvider.TYPE, "Anonymous");
- assertNotNull(broker);
- assertEquals(_brokerId, broker.getId());
- assertEquals(Collections.singletonList(_authenticationProvider1), broker.getAuthenticationProviders());
+ return new ConfiguredObjectRecordImpl(id, AuthenticationProvider.class.getSimpleName(), authProviderAttrs, Collections
+ .singletonMap(Broker.class.getSimpleName(), _brokerEntry));
}
- public void testCreateBrokerWithMultipleAuthenticationProvidersAndPorts()
+
+ public ConfiguredObjectRecord createGroupProviderRecord(UUID id, String name)
{
- //Create a second authentication provider
- AuthenticationProvider authenticationProvider2 = mock(AuthenticationProvider.class);
- when(authenticationProvider2.getName()).thenReturn("authenticationProvider2");
- ConfigurationEntry authenticationProviderEntry2 = mock(ConfigurationEntry.class);
- _brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1, authenticationProviderEntry2));
-
- //Add a couple ports
- ConfigurationEntry portEntry1 = mock(ConfigurationEntry.class);
- Port port1 = mock(Port.class);
- when(port1.getId()).thenReturn(UUIDGenerator.generateRandomUUID());
- when(port1.getName()).thenReturn("port1");
- when(port1.getPort()).thenReturn(5671);
- when(port1.getAttribute(Port.AUTHENTICATION_PROVIDER)).thenReturn("authenticationProvider1");
- ConfigurationEntry portEntry2 = mock(ConfigurationEntry.class);
- Port port2 = mock(Port.class);
- when(port2.getId()).thenReturn(UUIDGenerator.generateRandomUUID());
- when(port2.getName()).thenReturn("port2");
- when(port2.getPort()).thenReturn(5672);
- when(port2.getAttribute(Port.AUTHENTICATION_PROVIDER)).thenReturn("authenticationProvider2");
- _brokerEntryChildren.put(Port.class.getSimpleName(), Arrays.asList(portEntry1, portEntry2));
-
- RecovererProvider recovererProvider = createRecoveryProvider(
- new ConfigurationEntry[]{portEntry1, portEntry2, authenticationProviderEntry2, _authenticationProviderEntry1},
- new ConfiguredObject[]{port1, port2, authenticationProvider2, _authenticationProvider1});
+ final Map<String, Object> groupProviderAttrs = new HashMap<String, Object>();
+ groupProviderAttrs.put(GroupProvider.NAME, name);
+ groupProviderAttrs.put(GroupProvider.TYPE, "GroupFile");
+ groupProviderAttrs.put("path", "/no-such-path");
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
+ return new ConfiguredObjectRecordImpl(id, GroupProvider.class.getSimpleName(), groupProviderAttrs, Collections
+ .singletonMap(Broker.class.getSimpleName(), _brokerEntry));
+ }
- assertNotNull(broker);
- assertEquals("Unexpected number of authentication providers", 2, broker.getAuthenticationProviders().size());
+ public ConfiguredObjectRecord createPortRecord(UUID id, int port, Object authProviderRef)
+ {
+ final Map<String, Object> portAttrs = new HashMap<String, Object>();
+ portAttrs.put(Port.NAME, "port-"+port);
+ portAttrs.put(Port.TYPE, "HTTP");
+ portAttrs.put(Port.PORT, port);
+ portAttrs.put(Port.AUTHENTICATION_PROVIDER, authProviderRef);
- Collection<Port> ports = broker.getPorts();
- assertEquals("Unexpected number of ports", 2, ports.size());
- assertTrue(ports.contains(port1));
- assertTrue(ports.contains(port2));
+ return new ConfiguredObjectRecordImpl(id, Port.class.getSimpleName(), portAttrs, Collections
+ .singletonMap(Broker.class.getSimpleName(), _brokerEntry));
}
- public void testCreateBrokerWithGroupProvider()
+
+ public void testCreateBrokerWithPorts()
{
- ConfigurationEntry groupProviderEntry = mock(ConfigurationEntry.class);
- GroupProvider groupProvider = mock(GroupProvider.class);
- _brokerEntryChildren.put(GroupProvider.class.getSimpleName(), Arrays.asList(groupProviderEntry));
+ UUID authProviderId = UUID.randomUUID();
+ UUID portId = UUID.randomUUID();
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{groupProviderEntry, _authenticationProviderEntry1},
- new ConfiguredObject[]{groupProvider, _authenticationProvider1});
+ _systemContext.resolveObjects(_brokerEntry, createAuthProviderRecord(authProviderId, "authProvider"), createPortRecord(
+ portId,
+ 5672,
+ "authProvider"));
+ Broker<?> broker = _systemContext.getBroker();
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
assertNotNull(broker);
assertEquals(_brokerId, broker.getId());
- assertEquals(Collections.singletonList(groupProvider), broker.getGroupProviders());
+ assertEquals(1, broker.getPorts().size());
}
- public void testCreateBrokerWithPlugins()
+ public void testCreateBrokerWithOneAuthenticationProvider()
{
- ConfigurationEntry pluginEntry = mock(ConfigurationEntry.class);
- Plugin plugin = mock(Plugin.class);
- _brokerEntryChildren.put(Plugin.class.getSimpleName(), Arrays.asList(pluginEntry));
+ UUID authProviderId = UUID.randomUUID();
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{pluginEntry, _authenticationProviderEntry1},
- new ConfiguredObject[]{plugin, _authenticationProvider1});
+ _systemContext.resolveObjects(_brokerEntry, createAuthProviderRecord(authProviderId, "authProvider"));
+ Broker<?> broker = _systemContext.getBroker();
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
assertNotNull(broker);
assertEquals(_brokerId, broker.getId());
- assertEquals(Collections.singleton(plugin), new HashSet<ConfiguredObject>(broker.getChildren(Plugin.class)));
+ assertEquals(1, broker.getAuthenticationProviders().size());
+
}
- public void testCreateBrokerWithKeyStores()
+ public void testCreateBrokerWithMultipleAuthenticationProvidersAndPorts()
{
- ConfigurationEntry pluginEntry = mock(ConfigurationEntry.class);
- KeyStore keyStore = mock(KeyStore.class);
- _brokerEntryChildren.put(KeyStore.class.getSimpleName(), Arrays.asList(pluginEntry));
-
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{pluginEntry, _authenticationProviderEntry1},
- new ConfiguredObject[]{keyStore, _authenticationProvider1});
+ UUID authProviderId = UUID.randomUUID();
+ UUID portId = UUID.randomUUID();
+ UUID authProvider2Id = UUID.randomUUID();
+ UUID port2Id = UUID.randomUUID();
+
+ _systemContext.resolveObjects(_brokerEntry,
+ createAuthProviderRecord(authProviderId, "authProvider"),
+ createPortRecord(portId, 5672, "authProvider"),
+ createAuthProviderRecord(authProvider2Id, "authProvider2"),
+ createPortRecord(port2Id, 5673, "authProvider2"));
+ Broker<?> broker = _systemContext.getBroker();
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
assertNotNull(broker);
assertEquals(_brokerId, broker.getId());
- assertEquals(Collections.singleton(keyStore), new HashSet<ConfiguredObject>(broker.getChildren(KeyStore.class)));
+ assertEquals(2, broker.getPorts().size());
+
+ assertEquals("Unexpected number of authentication providers", 2, broker.getAuthenticationProviders().size());
+
}
- public void testCreateBrokerWithTrustStores()
+ public void testCreateBrokerWithGroupProvider()
{
- ConfigurationEntry pluginEntry = mock(ConfigurationEntry.class);
- TrustStore trustStore = mock(TrustStore.class);
- _brokerEntryChildren.put(TrustStore.class.getSimpleName(), Arrays.asList(pluginEntry));
- RecovererProvider recovererProvider = createRecoveryProvider(new ConfigurationEntry[]{pluginEntry, _authenticationProviderEntry1},
- new ConfiguredObject[]{trustStore, _authenticationProvider1});
+ UUID authProviderId = UUID.randomUUID();
+
+ _systemContext.resolveObjects(_brokerEntry, createGroupProviderRecord(authProviderId, "groupProvider"));
+ Broker<?> broker = _systemContext.getBroker();
- Broker broker = _brokerRecoverer.create(recovererProvider, _brokerEntry);
assertNotNull(broker);
assertEquals(_brokerId, broker.getId());
- assertEquals(Collections.singleton(trustStore), new HashSet<ConfiguredObject>(broker.getChildren(TrustStore.class)));
+ assertEquals(1, broker.getGroupProviders().size());
+
}
public void testModelVersionValidationForIncompatibleMajorVersion() throws Exception
@@ -302,7 +265,8 @@ public class BrokerRecovererTest extends
try
{
- _brokerRecoverer.create(null, _brokerEntry);
+ _systemContext.resolveObjects(_brokerEntry);
+ Broker<?> broker = _systemContext.getBroker();
fail("The broker creation should fail due to unsupported model version");
}
catch (IllegalConfigurationException e)
@@ -323,7 +287,7 @@ public class BrokerRecovererTest extends
try
{
- _brokerRecoverer.create(null, _brokerEntry);
+ Broker broker = (Broker) _configuredObjectFactory.recover(_brokerEntry, _systemContext).resolve();
fail("The broker creation should fail due to unsupported model version");
}
catch (IllegalConfigurationException e)
@@ -344,7 +308,8 @@ public class BrokerRecovererTest extends
try
{
- _brokerRecoverer.create(null, _brokerEntry);
+ Broker broker = (Broker) _configuredObjectFactory.recover(_brokerEntry, _systemContext).resolve();
+
fail("The broker creation should fail due to unsupported model version");
}
catch (IllegalConfigurationException e)
@@ -359,7 +324,7 @@ public class BrokerRecovererTest extends
return String.valueOf(attributeValue);
}
- private RecovererProvider createRecoveryProvider(final ConfigurationEntry[] entries, final ConfiguredObject[] objectsToRecoverer)
+ private RecovererProvider createRecoveryProvider(final ConfiguredObjectRecord[] entries, final ConfiguredObject[] objectsToRecoverer)
{
RecovererProvider recovererProvider = new RecovererProvider()
{
@@ -369,12 +334,11 @@ public class BrokerRecovererTest extends
@SuppressWarnings({ "unchecked", "rawtypes" })
final ConfiguredObjectRecoverer<? extends ConfiguredObject> recoverer = new ConfiguredObjectRecoverer()
{
- @Override
- public ConfiguredObject create(RecovererProvider recovererProvider, ConfigurationEntry entry, ConfiguredObject... parents)
+ public ConfiguredObject create(RecovererProvider recovererProvider, ConfiguredObjectRecord entry, ConfiguredObject... parents)
{
for (int i = 0; i < entries.length; i++)
{
- ConfigurationEntry e = entries[i];
+ ConfiguredObjectRecord e = entries[i];
if (entry == e)
{
return objectsToRecoverer[i];
Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java?rev=1584931&r1=1584930&r2=1584931&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java Fri Apr 4 22:34:26 2014
@@ -27,9 +27,10 @@ import java.util.Set;
import java.util.UUID;
import org.apache.qpid.server.configuration.ConfigurationEntry;
-import org.apache.qpid.server.configuration.ConfigurationEntryStore;
+import org.apache.qpid.server.configuration.ConfigurationEntryImpl;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.GroupProvider;
import org.apache.qpid.server.model.KeyStore;
import org.apache.qpid.server.model.Port;
@@ -40,11 +41,12 @@ import org.apache.qpid.server.model.Virt
import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager;
import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManager;
+import org.apache.qpid.server.store.ConfiguredObjectRecord;
import org.apache.qpid.test.utils.QpidTestCase;
public abstract class ConfigurationEntryStoreTestCase extends QpidTestCase
{
- private ConfigurationEntryStore _store;
+ private MemoryConfigurationEntryStore _store;
private UUID _brokerId;
private UUID _virtualHostId;
@@ -92,7 +94,8 @@ public abstract class ConfigurationEntry
}
// ??? perhaps it should not be abstract
- protected abstract ConfigurationEntryStore createStore(UUID brokerId, Map<String, Object> brokerAttributes) throws Exception;
+
+ protected abstract MemoryConfigurationEntryStore createStore(UUID brokerId, Map<String, Object> brokerAttributes) throws Exception;
protected abstract void addConfiguration(UUID id, String type, Map<String, Object> attributes, UUID parentId);
@@ -101,7 +104,7 @@ public abstract class ConfigurationEntry
addConfiguration(id, type, attributes, _brokerId);
}
- protected ConfigurationEntryStore getStore()
+ protected MemoryConfigurationEntryStore getStore()
{
return _store;
}
@@ -133,16 +136,49 @@ public abstract class ConfigurationEntry
public void testRemove()
{
- Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
+ final Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
virtualHostAttributes.put(VirtualHost.NAME, getName());
virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
- UUID virtualHostId = UUID.randomUUID();
+ final UUID virtualHostId = UUID.randomUUID();
addConfiguration(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes);
assertNotNull("Virtual host with id " + virtualHostId + " should exist", _store.getEntry(virtualHostId));
- _store.remove(virtualHostId);
- assertNull("Authentication provider configuration should be removed", _store.getEntry(virtualHostId));
+ _store.remove(createConfiguredObjectRecord(virtualHostId, VirtualHost.class, virtualHostAttributes));
+ assertNull("Virtual host configuration should be removed", _store.getEntry(virtualHostId));
+ }
+
+ protected ConfiguredObjectRecord createConfiguredObjectRecord(final UUID virtualHostId,
+ final Class<? extends ConfiguredObject> type,
+ final Map<String, Object> virtualHostAttributes)
+ {
+ return new ConfiguredObjectRecord()
+ {
+ @Override
+ public UUID getId()
+ {
+ return virtualHostId;
+ }
+
+ @Override
+ public String getType()
+ {
+ return type.getSimpleName();
+ }
+
+ @Override
+ public Map<String, Object> getAttributes()
+ {
+ return virtualHostAttributes;
+ }
+
+ @Override
+ public Map<String, ConfiguredObjectRecord> getParents()
+ {
+ // TODO RG : rectify this
+ return null;
+ }
+ };
}
public void testRemoveMultipleEntries()
@@ -162,7 +198,10 @@ public abstract class ConfigurationEntry
assertNotNull("Virtual host with id " + virtualHost1Id + " should exist", _store.getEntry(virtualHost1Id));
assertNotNull("Virtual host with id " + virtualHost2Id + " should exist", _store.getEntry(virtualHost2Id));
- UUID[] deletedIds = _store.remove(virtualHost1Id, virtualHost2Id);
+ UUID[] deletedIds =
+ _store.remove(createConfiguredObjectRecord(virtualHost1Id, VirtualHost.class, virtualHost1Attributes),
+ createConfiguredObjectRecord(virtualHost2Id, VirtualHost.class, virtualHost2Attributes));
+
assertNotNull("Unexpected deleted ids", deletedIds);
assertEquals("Unexpected id of first deleted virtual host", virtualHost1Id , deletedIds[0]);
assertEquals("Unexpected id of second deleted virtual host", virtualHost2Id , deletedIds[1]);
@@ -189,7 +228,8 @@ public abstract class ConfigurationEntry
attributes.put(Broker.CONNECTION_HEART_BEAT_DELAY, 12000);
attributes.put(Broker.STATISTICS_REPORTING_PERIOD, 14000);
attributes.put(Broker.STATISTICS_REPORTING_RESET_ENABLED, false);
- ConfigurationEntry updatedBrokerEntry = new ConfigurationEntry(_brokerId, Broker.class.getSimpleName(), attributes,
+ ConfigurationEntry
+ updatedBrokerEntry = new ConfigurationEntryImpl(_brokerId, Broker.class.getSimpleName(), attributes,
brokerConfigEntry.getChildrenIds(), _store);
_store.save(updatedBrokerEntry);
@@ -209,7 +249,7 @@ public abstract class ConfigurationEntry
virtualHostAttributes.put(VirtualHost.NAME, "test1");
virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
UUID virtualHostId = UUID.randomUUID();
- ConfigurationEntry hostEntry = new ConfigurationEntry(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
+ ConfigurationEntry hostEntry = new ConfigurationEntryImpl(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
Collections.<UUID> emptySet(), _store);
_store.save(hostEntry);
@@ -230,7 +270,7 @@ public abstract class ConfigurationEntry
virtualHostAttributes.put(VirtualHost.NAME, "test");
virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
- ConfigurationEntry updatedEntry = new ConfigurationEntry(_virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
+ ConfigurationEntry updatedEntry = new ConfigurationEntryImpl(_virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
hostEntry.getChildrenIds(), _store);
_store.save(updatedEntry);
@@ -247,7 +287,7 @@ public abstract class ConfigurationEntry
Map<String, Object> authenticationProviderAttributes = new HashMap<String, Object>();
authenticationProviderAttributes.put(AuthenticationProvider.NAME, "authenticationProvider1");
authenticationProviderAttributes.put(AuthenticationProvider.TYPE, ExternalAuthenticationManager.class.getSimpleName());
- ConfigurationEntry providerEntry = new ConfigurationEntry(authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
+ ConfigurationEntry providerEntry = new ConfigurationEntryImpl(authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
authenticationProviderAttributes, Collections.<UUID> emptySet(), _store);
_store.save(providerEntry);
@@ -267,7 +307,7 @@ public abstract class ConfigurationEntry
Map<String, Object> authenticationProviderAttributes = new HashMap<String, Object>();
authenticationProviderAttributes.put(AuthenticationProvider.NAME, "authenticationProvider1");
authenticationProviderAttributes.put(AuthenticationProvider.TYPE, ExternalAuthenticationManager.class.getSimpleName());
- ConfigurationEntry updatedEntry = new ConfigurationEntry(_authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
+ ConfigurationEntry updatedEntry = new ConfigurationEntryImpl(_authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
authenticationProviderAttributes, Collections.<UUID> emptySet(), _store);
_store.save(updatedEntry);
@@ -289,7 +329,8 @@ public abstract class ConfigurationEntry
attributes.put(TrustStore.TRUST_MANAGER_FACTORY_ALGORITHM, "NON-STANDARD");
attributes.put(TrustStore.DESCRIPTION, "Description");
- ConfigurationEntry trustStoreEntry = new ConfigurationEntry(trustStoreId, TrustStore.class.getSimpleName(), attributes,
+ ConfigurationEntry
+ trustStoreEntry = new ConfigurationEntryImpl(trustStoreId, TrustStore.class.getSimpleName(), attributes,
Collections.<UUID> emptySet(), _store);
_store.save(trustStoreEntry);
@@ -313,7 +354,7 @@ public abstract class ConfigurationEntry
attributes.put(KeyStore.DESCRIPTION, "Description");
attributes.put(KeyStore.CERTIFICATE_ALIAS, "Alias");
- ConfigurationEntry keyStoreEntry = new ConfigurationEntry(keyStoreId, KeyStore.class.getSimpleName(), attributes, Collections.<UUID> emptySet(),
+ ConfigurationEntry keyStoreEntry = new ConfigurationEntryImpl(keyStoreId, KeyStore.class.getSimpleName(), attributes, Collections.<UUID> emptySet(),
_store);
_store.save(keyStoreEntry);
@@ -331,7 +372,7 @@ public abstract class ConfigurationEntry
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(GroupProvider.NAME, getName());
- ConfigurationEntry groupProviderEntry = new ConfigurationEntry(groupProviderId, GroupProvider.class.getSimpleName(), attributes,
+ ConfigurationEntry groupProviderEntry = new ConfigurationEntryImpl(groupProviderId, GroupProvider.class.getSimpleName(), attributes,
Collections.<UUID> emptySet(), _store);
_store.save(groupProviderEntry);
@@ -356,7 +397,8 @@ public abstract class ConfigurationEntry
attributes.put(Port.NEED_CLIENT_AUTH, true);
attributes.put(Port.WANT_CLIENT_AUTH, true);
- ConfigurationEntry portEntry = new ConfigurationEntry(portId, Port.class.getSimpleName(), attributes, Collections.<UUID> emptySet(), _store);
+ ConfigurationEntry portEntry = new ConfigurationEntryImpl(portId, Port.class.getSimpleName(), attributes, Collections
+ .<UUID> emptySet(), _store);
_store.save(portEntry);
@@ -373,7 +415,7 @@ public abstract class ConfigurationEntry
Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();
virtualHostAttributes.put(VirtualHost.NAME, "test1");
virtualHostAttributes.put(VirtualHost.TYPE, "STANDARD");
- ConfigurationEntry hostEntry = new ConfigurationEntry(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
+ ConfigurationEntry hostEntry = new ConfigurationEntryImpl(virtualHostId, VirtualHost.class.getSimpleName(), virtualHostAttributes,
Collections.<UUID> emptySet(), _store);
UUID keyStoreId = UUID.randomUUID();
@@ -386,7 +428,7 @@ public abstract class ConfigurationEntry
attributes.put(KeyStore.DESCRIPTION, "Description");
attributes.put(KeyStore.CERTIFICATE_ALIAS, "Alias");
- ConfigurationEntry keyStoreEntry = new ConfigurationEntry(keyStoreId, KeyStore.class.getSimpleName(), attributes, Collections.<UUID> emptySet(),
+ ConfigurationEntry keyStoreEntry = new ConfigurationEntryImpl(keyStoreId, KeyStore.class.getSimpleName(), attributes, Collections.<UUID> emptySet(),
_store);
_store.save(hostEntry, keyStoreEntry);
@@ -418,7 +460,7 @@ public abstract class ConfigurationEntry
protected void addPreferencesProvider(UUID preferencesProviderId, String name, String path)
{
ConfigurationEntry authenticationProviderEntry = _store.getEntry(_authenticationProviderId);
- ConfigurationEntry newAuthenticationProviderConfigEntry = new ConfigurationEntry(authenticationProviderEntry.getId(),
+ ConfigurationEntry newAuthenticationProviderConfigEntry = new ConfigurationEntryImpl(authenticationProviderEntry.getId(),
authenticationProviderEntry.getType(), authenticationProviderEntry.getAttributes(),
Collections.<UUID>singleton(preferencesProviderId), _store);
@@ -427,7 +469,7 @@ public abstract class ConfigurationEntry
preferencesProviderAttributes.put(FileSystemPreferencesProvider.PATH, path);
preferencesProviderAttributes.put(PreferencesProvider.NAME, name);
- ConfigurationEntry preferencesProviderEntry = new ConfigurationEntry(preferencesProviderId, PreferencesProvider.class.getSimpleName(),
+ ConfigurationEntry preferencesProviderEntry = new ConfigurationEntryImpl(preferencesProviderId, PreferencesProvider.class.getSimpleName(),
preferencesProviderAttributes, Collections.<UUID> emptySet(), _store);
_store.save(newAuthenticationProviderConfigEntry, preferencesProviderEntry);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org