use of org.apache.qpid.server.model.ConfiguredObjectOperation in project qpid-broker-j by apache.
the class ManagementNode method performOperation.
private InternalMessage performOperation(final Class<? extends ConfiguredObject> clazz, final String operation, InternalMessage message) {
try {
if (STANDARD_OPERATIONS.contains(operation)) {
StandardOperation standardOperation;
if ((standardOperation = _standardOperations.get(clazz).get(operation)) != null) {
return standardOperation.performOperation(clazz, message);
}
} else {
final InternalMessageHeader requestHeader = message.getMessageHeader();
final Map<String, Object> headers = requestHeader.getHeaderMap();
ConfiguredObject<?> object = findObject(clazz, headers);
if (object == null) {
return createFailureResponse(message, STATUS_CODE_NOT_FOUND, "Not found");
}
final Map<String, ConfiguredObjectOperation<?>> operations = _model.getTypeRegistry().getOperations(object.getClass());
@SuppressWarnings("unchecked") final ConfiguredObjectOperation<ConfiguredObject<?>> method = (ConfiguredObjectOperation<ConfiguredObject<?>>) operations.get(operation);
if (method != null) {
return performConfiguredObjectOperation(object, message, method);
}
}
return createFailureResponse(message, STATUS_CODE_NOT_IMPLEMENTED, "Not implemented");
} catch (RuntimeException e) {
return createFailureResponse(message, STATUS_CODE_INTERNAL_ERROR, e.getMessage());
}
}
Aggregations