use of org.apache.qpid.server.store.ConfiguredObjectRecordImpl in project qpid-broker-j by apache.
the class BDBHAVirtualHostNodeTestHelper method recoverHaVHN.
public BDBHAVirtualHostNode<?> recoverHaVHN(UUID id, Map<String, Object> attributes) {
Map<String, UUID> parents = new HashMap<>();
parents.put(Broker.class.getSimpleName(), _broker.getId());
ConfiguredObjectRecordImpl record = new ConfiguredObjectRecordImpl(id, VirtualHostNode.class.getSimpleName(), attributes, parents);
@SuppressWarnings("unchecked") UnresolvedConfiguredObject<BDBHAVirtualHostNodeImpl> unresolved = _objectFactory.recover(record, _broker);
BDBHAVirtualHostNode<?> node = unresolved.resolve();
node.open();
_nodes.add(node);
return node;
}
use of org.apache.qpid.server.store.ConfiguredObjectRecordImpl in project qpid-broker-j by apache.
the class TestBrokerConfiguration method setObjectAttribute.
private boolean setObjectAttribute(ConfiguredObjectRecord entry, String attributeName, Object value) {
Map<String, Object> attributes = new HashMap<String, Object>(entry.getAttributes());
attributes.put(attributeName, value);
ConfiguredObjectRecord newEntry = new ConfiguredObjectRecordImpl(entry.getId(), entry.getType(), attributes, entry.getParents());
_store.update(false, newEntry);
return true;
}
use of org.apache.qpid.server.store.ConfiguredObjectRecordImpl in project qpid-broker-j by apache.
the class TestBrokerConfiguration method addObjectConfiguration.
public UUID addObjectConfiguration(final Class<? extends ConfiguredObject> parentCategory, final String parentName, Class<? extends ConfiguredObject> type, Map<String, Object> attributes) {
UUID id = UUIDGenerator.generateRandomUUID();
ConfiguredObjectRecord entry = new ConfiguredObjectRecordImpl(id, type.getSimpleName(), attributes, Collections.singletonMap(parentCategory.getSimpleName(), findObject(parentCategory, parentName).getId()));
_store.update(true, entry);
return id;
}
use of org.apache.qpid.server.store.ConfiguredObjectRecordImpl in project qpid-broker-j by apache.
the class ManagementModeStoreHandler method recoverRecords.
public void recoverRecords(final List<ConfiguredObjectRecord> records) {
boolean b = _systemConfig.getManagementModeHttpPortOverride() > 0;
for (ConfiguredObjectRecord object : records) {
String entryType = object.getType();
Map<String, Object> attributes = object.getAttributes();
boolean quiesce = false;
if (VIRTUAL_HOST_TYPE.equals(entryType) && _systemConfig.isManagementModeQuiesceVirtualHosts()) {
quiesce = true;
} else if (PORT_TYPE.equals(entryType)) {
if (attributes == null) {
throw new IllegalConfigurationException("Port attributes are not set in " + object);
}
Set<Protocol> protocols = getPortProtocolsAttribute(attributes);
if (protocols == null) {
quiesce = true;
} else {
for (Protocol protocol : protocols) {
switch(protocol) {
case HTTP:
quiesce = b;
break;
default:
quiesce = true;
}
}
}
}
if (quiesce) {
LOGGER.debug("Management mode quiescing entry {}", object);
// save original state
_quiescedEntriesOriginalState.put(object.getId(), attributes.get(ATTRIBUTE_STATE));
Map<String, Object> modifiedAttributes = new HashMap<String, Object>(attributes);
modifiedAttributes.put(ATTRIBUTE_STATE, State.QUIESCED);
ConfiguredObjectRecord record = new ConfiguredObjectRecordImpl(object.getId(), object.getType(), modifiedAttributes, object.getParents());
_records.put(record.getId(), record);
} else {
_records.put(object.getId(), object);
}
}
}
use of org.apache.qpid.server.store.ConfiguredObjectRecordImpl in project qpid-broker-j by apache.
the class ManagementModeStoreHandler method createCLIPortEntry.
private ConfiguredObjectRecord createCLIPortEntry(int port, Protocol protocol) {
ConfiguredObjectRecord parent = findBroker();
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put(Port.PORT, port);
attributes.put(Port.PROTOCOLS, Collections.singleton(protocol));
attributes.put(Port.NAME, MANAGEMENT_MODE_PORT_PREFIX + protocol.name());
attributes.put(Port.AUTHENTICATION_PROVIDER, BrokerImpl.MANAGEMENT_MODE_AUTHENTICATION);
ConfiguredObjectRecord portEntry = new ConfiguredObjectRecordImpl(UUID.randomUUID(), PORT_TYPE, attributes, Collections.singletonMap(parent.getType(), parent.getId()));
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Add management mode port configuration " + portEntry + " for port " + port + " and protocol " + protocol);
}
return portEntry;
}
Aggregations