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 2013/04/23 22:54:24 UTC
svn commit: r1471141 [6/11] - in /qpid/branches/QPID-4659/qpid/java: ./
amqp-1-0-client-jms/ amqp-1-0-client/ amqp-1-0-common/
amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/
broker-plugins/access-control/src/main/java/org/apache/qpid...
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/IApplicationRegistry.java Tue Apr 23 20:54:19 2013
@@ -20,17 +20,14 @@
*/
package org.apache.qpid.server.registry;
+import org.apache.qpid.server.BrokerOptions;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.stats.StatisticsGatherer;
public interface IApplicationRegistry extends StatisticsGatherer
{
- /**
- * Initialise the application registry. All initialisation must be done in this method so that any components
- * that need access to the application registry itself for initialisation are able to use it. Attempting to
- * initialise in the constructor will lead to failures since the registry reference will not have been set.
- */
- void initialise() throws Exception;
+
+ void initialise(BrokerOptions brokerOptions) throws Exception;
/**
* Shutdown this Registry
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AccessControl.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AccessControl.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AccessControl.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/AccessControl.java Tue Apr 23 20:54:19 2013
@@ -42,4 +42,25 @@ public interface AccessControl
* Authorise an operation on an object defined by a set of properties.
*/
Result authorise(Operation operation, ObjectType objectType, ObjectProperties properties);
+
+ /**
+ * Called to open any resources required by the implementation.
+ */
+ void open();
+
+ /**
+ * Called to close any resources required by the implementation.
+ */
+ void close();
+
+ /**
+ * Called when deleting to allow clearing any resources used by the implementation.
+ */
+ void onDelete();
+
+ /**
+ * Called when first creating (but not when recovering after startup) to allow
+ * creating any resources required by the implementation.
+ */
+ void onCreate();
}
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SecurityManager.java Tue Apr 23 20:54:19 2013
@@ -23,6 +23,7 @@ import org.apache.log4j.Logger;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.server.exchange.Exchange;
+import org.apache.qpid.server.model.AccessControlProvider;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.ConfigurationChangeListener;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -30,6 +31,7 @@ import org.apache.qpid.server.model.Stat
import org.apache.qpid.server.plugin.AccessControlFactory;
import org.apache.qpid.server.plugin.QpidServiceLoader;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
import org.apache.qpid.server.security.access.ObjectProperties;
import org.apache.qpid.server.security.access.ObjectType;
import org.apache.qpid.server.security.access.Operation;
@@ -53,22 +55,13 @@ import static org.apache.qpid.server.sec
import javax.security.auth.Subject;
import java.net.SocketAddress;
-import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
-/**
- * The security manager contains references to all loaded {@link AccessControl}s and delegates security decisions to them based
- * on virtual host name. The plugins can be external <em>OSGi</em> .jar files that export the required classes or just internal
- * objects for simpler plugins.
- *
- * @see AccessControl
- */
public class SecurityManager implements ConfigurationChangeListener
{
private static final Logger _logger = Logger.getLogger(SecurityManager.class);
@@ -78,9 +71,12 @@ public class SecurityManager implements
public static final ThreadLocal<Boolean> _accessChecksDisabled = new ClearingThreadLocal(false);
- private Map<String, AccessControl> _globalPlugins = new ConcurrentHashMap<String, AccessControl>();
- private Map<String, AccessControl> _hostPlugins = new ConcurrentHashMap<String, AccessControl>();
- private Map<String, List<String>> _aclConfigurationToPluginNamesMapping = new ConcurrentHashMap<String, List<String>>();
+ private ConcurrentHashMap<String, AccessControl> _globalPlugins = new ConcurrentHashMap<String, AccessControl>();
+ private ConcurrentHashMap<String, AccessControl> _hostPlugins = new ConcurrentHashMap<String, AccessControl>();
+
+ private boolean _managementMode;
+
+ private Broker _broker;
/**
* A special ThreadLocal, which calls remove() on itself whenever the value is
@@ -128,34 +124,53 @@ public class SecurityManager implements
}
/*
- * Used by the VirtualHost to allow deferring to the broker level security plugins if required.
+ * Used by the Broker.
*/
- public SecurityManager(SecurityManager parent, String aclFile)
+ public SecurityManager(Broker broker, boolean managementMode)
{
- this(aclFile);
-
- // our global plugins are the parent's host plugins
- _globalPlugins = parent._hostPlugins;
+ _managementMode = managementMode;
+ _broker = broker;
}
- public SecurityManager(String aclFile)
+ /*
+ * Used by the VirtualHost to allow deferring to the broker level security plugins if required.
+ */
+ public SecurityManager(SecurityManager parent, String aclFile, String vhostName)
{
- configureACLPlugin(aclFile);
+ if(!_managementMode)
+ {
+ configureVirtualHostAclPlugin(aclFile, vhostName);
+
+ // our global plugins are the parent's host plugins
+ _globalPlugins = parent._hostPlugins;
+ }
}
- private void configureACLPlugin(String aclFile)
+ private void configureVirtualHostAclPlugin(String aclFile, String vhostName)
{
- Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put("aclFile", aclFile);
-
- for (AccessControlFactory provider : (new QpidServiceLoader<AccessControlFactory>()).instancesOf(AccessControlFactory.class))
+ if(aclFile != null)
{
- AccessControl accessControl = provider.createInstance(attributes);
- if(accessControl != null)
- {
- addHostPlugin(accessControl);
+ Map<String, Object> attributes = new HashMap<String, Object>();
+
+ attributes.put(AccessControlProvider.TYPE, FileAccessControlProviderConstants.ACL_FILE_PROVIDER_TYPE);
+ attributes.put(FileAccessControlProviderConstants.PATH, aclFile);
- mapAclConfigurationToPluginName(aclFile, accessControl.getClass().getName());
+ for (AccessControlFactory provider : (new QpidServiceLoader<AccessControlFactory>()).instancesOf(AccessControlFactory.class))
+ {
+ AccessControl accessControl = provider.createInstance(attributes);
+ accessControl.open();
+ if(accessControl != null)
+ {
+ String pluginTypeName = getPluginTypeName(accessControl);
+ _hostPlugins.put(pluginTypeName, accessControl);
+
+ if(_logger.isDebugEnabled())
+ {
+ _logger.debug("Added access control to host plugins with name: " + vhostName);
+ }
+
+ break;
+ }
}
}
@@ -165,15 +180,9 @@ public class SecurityManager implements
}
}
- private void mapAclConfigurationToPluginName(String aclFile, String pluginName)
+ private String getPluginTypeName(AccessControl accessControl)
{
- List<String> pluginNames = _aclConfigurationToPluginNamesMapping.get(aclFile);
- if (pluginNames == null)
- {
- pluginNames = new ArrayList<String>();
- _aclConfigurationToPluginNamesMapping.put(aclFile, pluginNames);
- }
- pluginNames.add(pluginName);
+ return accessControl.getClass().getName();
}
public static Subject getThreadSubject()
@@ -191,15 +200,6 @@ public class SecurityManager implements
return _logger;
}
- private static class CachedPropertiesMap extends LinkedHashMap<String, PublishAccessCheck>
- {
- @Override
- protected boolean removeEldestEntry(Entry<String, PublishAccessCheck> eldest)
- {
- return size() >= 200;
- }
- }
-
private abstract class AccessCheck
{
abstract Result allowed(AccessControl plugin);
@@ -500,16 +500,72 @@ public class SecurityManager implements
}
}
-
- public void addHostPlugin(AccessControl plugin)
- {
- _hostPlugins.put(plugin.getClass().getName(), plugin);
- }
-
@Override
public void stateChanged(ConfiguredObject object, State oldState, State newState)
{
- // no op
+ if(_managementMode)
+ {
+ //AccessControl is disabled in ManagementMode
+ return;
+ }
+
+ if(object instanceof AccessControlProvider)
+ {
+ if(newState == State.ACTIVE)
+ {
+ synchronized (_hostPlugins)
+ {
+ AccessControl accessControl = ((AccessControlProvider)object).getAccessControl();
+ String pluginTypeName = getPluginTypeName(accessControl);
+
+ _hostPlugins.put(pluginTypeName, accessControl);
+ }
+ }
+ else if(newState == State.DELETED)
+ {
+ synchronized (_hostPlugins)
+ {
+ AccessControl control = ((AccessControlProvider)object).getAccessControl();
+ String pluginTypeName = getPluginTypeName(control);
+
+ // Remove the type->control mapping for this type key only if the
+ // given control is actually referred to.
+ if(_hostPlugins.containsValue(control))
+ {
+ // If we are removing this control, check if another of the same
+ // type already exists on the broker and use it in instead.
+ AccessControl other = null;
+ Collection<AccessControlProvider> providers = _broker.getAccessControlProviders();
+ for(AccessControlProvider p : providers)
+ {
+ if(p == object || p.getActualState() != State.ACTIVE)
+ {
+ //we don't count ourself as another
+ continue;
+ }
+
+ AccessControl ac = p.getAccessControl();
+ if(pluginTypeName.equals(getPluginTypeName(ac)))
+ {
+ other = ac;
+ break;
+ }
+ }
+
+ if(other != null)
+ {
+ //Another control of this type was found, use it instead
+ _hostPlugins.replace(pluginTypeName, control, other);
+ }
+ else
+ {
+ //No other was found, remove the type entirely
+ _hostPlugins.remove(pluginTypeName);
+ }
+ }
+ }
+ }
+ }
}
@Override
@@ -527,29 +583,7 @@ public class SecurityManager implements
@Override
public void attributeSet(ConfiguredObject object, String attributeName, Object oldAttributeValue, Object newAttributeValue)
{
- if (object instanceof Broker && Broker.ACL_FILE.equals(attributeName))
- {
- // the code below is not thread safe, however, it should be fine in a management mode
- // as there will be no user connected
-
- if (oldAttributeValue != null)
- {
- List<String> pluginNames = _aclConfigurationToPluginNamesMapping.remove(oldAttributeValue);
- if (pluginNames != null)
- {
- for (String name : pluginNames)
- {
- _hostPlugins.remove(name);
- }
- }
- }
- if (newAttributeValue != null)
- {
- configureACLPlugin((String)newAttributeValue);
- }
- _immediatePublishPropsCache.clear();
- _publishPropsCache.clear();
- }
+ // no op
}
public boolean authoriseConfiguringBroker(String configuredObjectName, Class<? extends ConfiguredObject> configuredObjectType, Operation configuredObjectOperation)
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SubjectCreator.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SubjectCreator.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SubjectCreator.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/SubjectCreator.java Tue Apr 23 20:54:19 2013
@@ -35,6 +35,7 @@ import org.apache.qpid.server.security.a
import org.apache.qpid.server.security.auth.AuthenticationResult;
import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
import org.apache.qpid.server.security.auth.SubjectAuthenticationResult;
+import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager;
import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
/**
@@ -153,4 +154,9 @@ public class SubjectCreator
return Collections.unmodifiableSet(principals);
}
+
+ public boolean isAnonymousAuthenticationAllowed()
+ {
+ return _authenticationManager instanceof AnonymousAuthenticationManager;
+ }
}
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/external/ExternalSaslServer.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/external/ExternalSaslServer.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/external/ExternalSaslServer.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/sasl/external/ExternalSaslServer.java Tue Apr 23 20:54:19 2013
@@ -61,7 +61,7 @@ public class ExternalSaslServer implemen
public String getAuthorizationID()
{
- return null;
+ return getAuthenticatedPrincipal().getName();
}
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManager.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManager.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManager.java Tue Apr 23 20:54:19 2013
@@ -19,6 +19,7 @@
*/
package org.apache.qpid.server.security.group;
+import java.io.File;
import java.io.IOException;
import java.security.Principal;
import java.util.Collections;
@@ -34,32 +35,26 @@ import org.apache.qpid.server.security.a
* This plugin is configured in the following manner:
* </p>
* <pre>
- * <file-group-manager>
- * <attributes>
- * <attribute>
- * <name>groupFile</name>
- * <value>${conf}/groups</value>
- * </attribute>
- * </attributes>
- * </file-group-manager>
+ * "groupproviders":[
+ * ...
+ * {
+ * "name" : "...",
+ * "type" : "GroupFile",
+ * "path" : "path/to/file/with/groups",
+ * }
+ * ...
+ * ]
* </pre>
*/
public class FileGroupManager implements GroupManager
{
private final FileGroupDatabase _groupDatabase;
-
+ private final String _groupFile;
public FileGroupManager(String groupFile)
{
+ _groupFile = groupFile;
_groupDatabase = new FileGroupDatabase();
- try
- {
- _groupDatabase.setGroupFile(groupFile);
- }
- catch (IOException e)
- {
- throw new IllegalConfigurationException("Unable to set group file " + groupFile, e);
- }
}
@Override
@@ -144,4 +139,101 @@ public class FileGroupManager implements
}
+ @Override
+ public void onDelete()
+ {
+ File file = new File(_groupFile);
+ if (file.exists())
+ {
+ if (!file.delete())
+ {
+ throw new IllegalConfigurationException("Cannot delete group file");
+ }
+ }
+ }
+
+ @Override
+ public void onCreate()
+ {
+ File file = new File(_groupFile);
+ if (!file.exists())
+ {
+ File parent = file.getParentFile();
+ if (!parent.exists())
+ {
+ parent.mkdirs();
+ }
+ if (parent.exists())
+ {
+ try
+ {
+ file.createNewFile();
+ }
+ catch (IOException e)
+ {
+ throw new IllegalConfigurationException("Cannot create group file");
+ }
+ }
+ else
+ {
+ throw new IllegalConfigurationException("Cannot create group file");
+ }
+ }
+ }
+
+ @Override
+ public void open()
+ {
+ try
+ {
+ _groupDatabase.setGroupFile(_groupFile);
+ }
+ catch (IOException e)
+ {
+ throw new IllegalConfigurationException("Unable to set group file " + _groupFile, e);
+ }
+ }
+
+ @Override
+ public void close()
+ {
+ // no-op
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ((_groupFile == null) ? 0 : _groupFile.hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ FileGroupManager other = (FileGroupManager) obj;
+ if (_groupFile == null)
+ {
+ if (other._groupFile != null)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ return _groupFile.equals(other._groupFile);
+ }
+
}
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManagerFactory.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManagerFactory.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/FileGroupManagerFactory.java Tue Apr 23 20:54:19 2013
@@ -20,32 +20,60 @@ package org.apache.qpid.server.security.
import static org.apache.qpid.server.util.MapValueConverter.getStringAttribute;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
-import org.apache.commons.lang.StringUtils;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.model.GroupProvider;
import org.apache.qpid.server.plugin.GroupManagerFactory;
+import org.apache.qpid.server.util.ResourceBundleLoader;
public class FileGroupManagerFactory implements GroupManagerFactory
{
- static final String FILE_GROUP_MANAGER_TYPE = "file-group-manager";
- static final String FILE = "file";
+ public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.group.FileGroupProviderAttributeDescriptions";
+
+ public static final String GROUP_FILE_PROVIDER_TYPE = "GroupFile";
+ public static final String PATH = "path";
+
+ public static final Collection<String> ATTRIBUTES = Collections.<String> unmodifiableList(Arrays.asList(
+ ATTRIBUTE_TYPE,
+ PATH
+ ));
@Override
public GroupManager createInstance(Map<String, Object> attributes)
{
- if(!FILE_GROUP_MANAGER_TYPE.equals(getStringAttribute(GroupProvider.TYPE, attributes, null)))
+ if(attributes == null || !GROUP_FILE_PROVIDER_TYPE.equals(attributes.get(ATTRIBUTE_TYPE)))
{
return null;
}
- String groupFile = getStringAttribute(FILE, attributes, null);
- if (StringUtils.isBlank(groupFile))
+ String groupFile = getStringAttribute(PATH, attributes, null);
+ if (groupFile == null || "".equals(groupFile.trim()))
{
throw new IllegalConfigurationException("Path to file containing groups is not specified!");
}
+
return new FileGroupManager(groupFile);
}
+ @Override
+ public String getType()
+ {
+ return GROUP_FILE_PROVIDER_TYPE;
+ }
+
+ @Override
+ public Collection<String> getAttributeNames()
+ {
+ return ATTRIBUTES;
+ }
+
+ @Override
+ public Map<String, String> getAttributeDescriptions()
+ {
+ return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
+ }
+
}
Modified: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/GroupManager.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/GroupManager.java?rev=1471141&r1=1471140&r2=1471141&view=diff
==============================================================================
--- qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/GroupManager.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/security/group/GroupManager.java Tue Apr 23 20:54:19 2013
@@ -37,4 +37,12 @@ public interface GroupManager
void addUserToGroup(String user, String group);
void removeUserFromGroup(String user, String group);
+
+ void open();
+
+ void close();
+
+ void onDelete();
+
+ void onCreate();
}
Copied: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java (from r1470454, qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java)
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java?p2=qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java&p1=qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java&r1=1470454&r2=1471141&rev=1471141&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java (original)
+++ qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java Tue Apr 23 20:54:19 2013
@@ -50,6 +50,7 @@ import org.apache.qpid.framing.FieldTabl
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.message.EnqueableMessage;
+import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler.BindingRecoveryHandler;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler.ExchangeRecoveryHandler;
@@ -1129,8 +1130,8 @@ abstract public class AbstractJDBCMessag
ByteBuffer buf = ByteBuffer.wrap(dataAsBytes);
buf.position(1);
buf = buf.slice();
- MessageMetaDataType type = MessageMetaDataType.values()[dataAsBytes[0]];
- StorableMessageMetaData metaData = type.getFactory().createMetaData(buf);
+ MessageMetaDataType type = MessageMetaDataTypeRegistry.fromOrdinal(dataAsBytes[0]);
+ StorableMessageMetaData metaData = type.createMetaData(buf);
StoredJDBCMessage message = new StoredJDBCMessage(messageId, metaData, true);
messageHandler.message(message);
}
@@ -1381,8 +1382,8 @@ abstract public class AbstractJDBCMessag
ByteBuffer buf = ByteBuffer.wrap(dataAsBytes);
buf.position(1);
buf = buf.slice();
- MessageMetaDataType type = MessageMetaDataType.values()[dataAsBytes[0]];
- StorableMessageMetaData metaData = type.getFactory().createMetaData(buf);
+ MessageMetaDataType type = MessageMetaDataTypeRegistry.fromOrdinal(dataAsBytes[0]);
+ StorableMessageMetaData metaData = type.createMetaData(buf);
return metaData;
}
Propchange: qpid/branches/QPID-4659/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Apr 23 20:54:19 2013
@@ -0,0 +1,7 @@
+/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java:886720-886722,887145,892761,930288
+/qpid/branches/java-broker-0-10/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java:795950-829653
+/qpid/branches/java-network-refactor/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java:805429-821809
+/qpid/branches/jmx_mc_gsoc09/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java:787599
+/qpid/branches/qpid-2935/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java:1061302-1072333
+/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java:1463061,1470457,1470463,1470474,1470897,1470899,1471004
+/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java:742626,743015,743028-743029,743304,743306,743311,743357,744113,747363,747367,747369-747370,747376,747783,747868-747870,747875,748561,748591,748641,748680,748686,749149,749282,749285,749315,749340,749572,753219-753220,753253,754934,754958,755256,757258,757270,758730,759097,760919,761721,762365,762992,763959,764026,764109,764140,764790
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org