use of org.apache.qpid.server.model.OperationParameter in project qpid-broker-j by apache.
the class ManagementNode method performGetOperations.
private Map<String, Map<String, List<String>>> performGetOperations(final Map<String, Object> headers) {
// TODO - enumerate management operations
final Map<String, List<String>> managementOperations = new HashMap<>();
return performManagementOperation(headers, clazz -> {
final Map<String, ConfiguredObjectOperation<?>> operations = _model.getTypeRegistry().getOperations(clazz);
Map<String, List<String>> result = new HashMap<>();
for (Map.Entry<String, ConfiguredObjectOperation<?>> operation : operations.entrySet()) {
List<String> arguments = new ArrayList<>();
for (OperationParameter param : operation.getValue().getParameters()) {
arguments.add(param.getName());
}
result.put(operation.getKey(), arguments);
}
return result;
}, managementOperations);
}
use of org.apache.qpid.server.model.OperationParameter in project qpid-broker-j by apache.
the class MetaDataServlet method processOperations.
private Map<String, Map> processOperations(final Class<? extends ConfiguredObject> type, final Model model) {
Collection<ConfiguredObjectOperation<?>> operations = model.getTypeRegistry().getOperations(type).values();
Map<String, Map> attributeDetails = new LinkedHashMap<>();
for (ConfiguredObjectOperation<?> operation : operations) {
Map<String, Object> attrDetails = new LinkedHashMap<>();
attrDetails.put("name", operation.getName());
attrDetails.put("returnType", operation.getReturnType().getSimpleName());
if (!"".equals(operation.getDescription())) {
attrDetails.put("description", operation.getDescription());
}
List<OperationParameter> parameters = operation.getParameters();
if (!parameters.isEmpty()) {
Map<String, Map> paramDetails = new LinkedHashMap<>();
for (OperationParameter param : parameters) {
Map<String, Object> paramAttrs = new LinkedHashMap<>();
paramAttrs.put("type", param.getType().getSimpleName());
paramAttrs.put("mandatory", param.isMandatory());
if (!"".equals(param.getDefaultValue())) {
paramAttrs.put("defaultValue", param.getDefaultValue());
}
paramDetails.put(param.getName(), paramAttrs);
}
attrDetails.put("parameters", paramDetails);
}
attributeDetails.put(operation.getName(), attrDetails);
}
return attributeDetails;
}
use of org.apache.qpid.server.model.OperationParameter in project qpid-broker-j by apache.
the class ApiDocsServlet method renderParameters.
private String renderParameters(final List<OperationParameter> parameters) {
StringBuilder writer = new StringBuilder();
writer.append("<table class=\"parameters\">");
writer.append("<thead>");
writer.append("<tr><th class=\"name\">Parameter Name</th><th>Type</th><th>Default</th><th>Mandatory?</th><th>Description</th></tr>");
writer.append("</thead>");
writer.append("<tbody>");
for (OperationParameter param : parameters) {
writer.append("<tr><td class=\"name\">" + param.getName() + "</td><td class=\"type\">" + renderType(param) + "</td><td class=\"default\">" + param.getDefaultValue() + "</td><td class=\"mandatory\">" + param.isMandatory() + "</td><td class=\"description\">" + param.getDescription() + "</td></tr>");
}
writer.append("</tbody>");
writer.append("</table>");
return writer.toString();
}
Aggregations