use of org.apache.qpid.server.model.ConfiguredObjectTypeRegistry in project qpid-broker-j by apache.
the class ManagementModeStoreHandler method getPortProtocolsAttribute.
private Set<Protocol> getPortProtocolsAttribute(Map<String, Object> attributes) {
Object object = attributes.get(Port.PROTOCOLS);
if (object == null) {
return null;
}
Model model = _parent.getModel();
ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry();
Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = typeRegistry.getAttributeTypes(Port.class);
ConfiguredSettableAttribute protocolsAttribute = (ConfiguredSettableAttribute) attributeTypes.get(Port.PROTOCOLS);
return (Set<Protocol>) protocolsAttribute.convert(object, _parent);
}
use of org.apache.qpid.server.model.ConfiguredObjectTypeRegistry in project qpid-broker-j by apache.
the class PortFactory method getProtocolType.
private ProtocolType getProtocolType(Map<String, Object> portAttributes, Broker<?> broker) {
Model model = broker.getModel();
ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry();
Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = typeRegistry.getAttributeTypes(Port.class);
ConfiguredSettableAttribute protocolsAttribute = (ConfiguredSettableAttribute) attributeTypes.get(Port.PROTOCOLS);
Set<Protocol> protocols = (Set<Protocol>) protocolsAttribute.convert(portAttributes.get(Port.PROTOCOLS), broker);
ProtocolType protocolType = null;
if (protocols == null || protocols.isEmpty()) {
// defaulting to AMQP if protocol is not specified
protocolType = ProtocolType.AMQP;
} else {
for (Protocol protocol : protocols) {
if (protocolType == null) {
protocolType = protocol.getProtocolType();
} else if (protocolType != protocol.getProtocolType()) {
throw new IllegalConfigurationException("Found different protocol types '" + protocolType + "' and '" + protocol.getProtocolType() + "' for port configuration: " + portAttributes);
}
}
}
return protocolType;
}
Aggregations