diff options
| author | Keith Wall <kwall@apache.org> | 2014-07-20 09:18:41 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-07-20 09:18:41 +0000 |
| commit | cd126b93a9ec0b3891e19a2b3012e5ccc222cbbd (patch) | |
| tree | c49ea400c3d846b17488c15dac9b1404baea02b9 /qpid/java/bdbstore/src/main | |
| parent | f6d0e98d352eaa20596906e0a54316b023d99c33 (diff) | |
| download | qpid-python-cd126b93a9ec0b3891e19a2b3012e5ccc222cbbd.tar.gz | |
QPID-5867: [Java Broker] Allow the virtualhost's permitted node list to passed via the virtualhostnode's virtualhost blueprint context variable.
Work completed by Andrew MacBean <macbean@apache.org> and me.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1612064 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore/src/main')
| -rw-r--r-- | qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java index e5e24de4bb..e629da3d26 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java @@ -66,6 +66,8 @@ import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironment import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacadeFactory; import org.apache.qpid.server.store.berkeleydb.replication.ReplicationGroupListener; import org.apache.qpid.server.util.ServerScopedRuntimeException; +import org.apache.qpid.server.virtualhost.berkeleydb.BDBHAVirtualHost; +import org.apache.qpid.server.virtualhost.berkeleydb.BDBHAVirtualHostImpl; import org.apache.qpid.server.virtualhostnode.AbstractVirtualHostNode; @ManagedObject( category = false, type = BDBHAVirtualHostNodeImpl.VIRTUAL_HOST_NODE_TYPE ) @@ -414,14 +416,43 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu { if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Creating new virtualhost with name : " + getGroupName()); + LOGGER.debug("Creating new virtualhost with name : " + getGroupName()); + } + + boolean hasBlueprint = getContext().containsKey(VIRTUALHOST_BLUEPRINT_CONTEXT_VAR); + boolean blueprintUtilised = getContext().containsKey(VIRTUALHOST_BLUEPRINT_UTILISED_CONTEXT_VAR) + && Boolean.parseBoolean(String.valueOf(getContext().get( + VIRTUALHOST_BLUEPRINT_UTILISED_CONTEXT_VAR))); + + Map<String, Object> hostAttributes = new HashMap<>(); + if (hasBlueprint && !blueprintUtilised) + { + Map<String, Object> virtualhostBlueprint = + getContextValue(Map.class, VIRTUALHOST_BLUEPRINT_CONTEXT_VAR); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Using virtualhost blueprint " + virtualhostBlueprint); + } + + hostAttributes.putAll(virtualhostBlueprint); + + } - Map<String, Object> hostAttributes = new HashMap<String, Object>(); hostAttributes.put(VirtualHost.MODEL_VERSION, BrokerModel.MODEL_VERSION); hostAttributes.put(VirtualHost.NAME, getGroupName()); - hostAttributes.put(VirtualHost.TYPE, "BDB_HA"); + hostAttributes.put(VirtualHost.TYPE, BDBHAVirtualHostImpl.VIRTUAL_HOST_TYPE); host = createChild(VirtualHost.class, hostAttributes); + + if (hasBlueprint && !blueprintUtilised) + { + // Update the context with the utilised flag + Map<String, String> actualContext = (Map<String, String>) getActualAttributes().get(CONTEXT); + Map<String, String> context = new HashMap<>(actualContext); + context.put(VIRTUALHOST_BLUEPRINT_UTILISED_CONTEXT_VAR, Boolean.TRUE.toString()); + setAttribute(CONTEXT, getContext(), context); + } } else { |
