use of org.jboss.as.clustering.controller.descriptions.SimpleResourceDescriptionResolver in project wildfly by wildfly.
the class ProtocolResourceRegistrationHandler method createProtocolResourceDefinition.
private ResourceDefinition createProtocolResourceDefinition(String protocolName, Class<? extends Protocol> protocolClass) {
SimpleResourceDescriptionResolver resolver = new SimpleResourceDescriptionResolver(protocolName, protocolClass.getSimpleName());
ResourceBuilder builder = ResourceBuilder.Factory.create(ProtocolResourceDefinition.pathElement(protocolName), resolver).setRuntime();
ProtocolMetricsHandler handler = new ProtocolMetricsHandler(this);
for (Map.Entry<String, Attribute> entry : ProtocolMetricsHandler.findProtocolAttributes(protocolClass).entrySet()) {
String name = entry.getKey();
Attribute attribute = entry.getValue();
FieldType type = FieldType.valueOf(attribute.getType());
resolver.addDescription(name, attribute.getDescription());
builder.addMetric(new SimpleAttributeDefinitionBuilder(name, type.getModelType(), true).setStorageRuntime().build(), handler);
}
return builder.build();
}
Aggregations