ServiceReference[] references =
context.getBundleContext().getServiceReferences(
Operation.class.getName(), null);
if (null == references || references.length < 1) {
throw new OperationNotFoundException(
"operation-type-not-found",
localDescriptor.getResourceType());
} else {
Result result = Result.UNSUPPORTED;
for (int i=0; i< references.length &&
result == Result.UNSUPPORTED; i++) {
ServiceReference ref = references[i];
Object service =
context.getBundleContext().getService(ref);
if (null == service) {
Object[] params = new Object[] {
ref.getProperty("service.pid"),
ref.getBundle().getSymbolicName()
};
LOGGER.error("service-has-been-unregistered", params);
} else {
Operation operation =
(Operation) service;
result = operation.execute(
localDescriptor, request, response);
}
}
if (result == Result.UNSUPPORTED) {
throw new OperationNotFoundException(
"no-plugin-available",
new String[] { localDescriptor.getExternalID(),
localDescriptor.getResourceType() });
}
}
} catch (InvalidSyntaxException e) {
// this can never happen as we don't use a filter.
throw new OperationNotFoundException(
"syntax-error-in-filter", null, e);
}
}