use of org.jboss.resteasy.core.ResourceInvoker in project openremote by openremote.
the class ServiceRegistry method scanRegistry.
private void scanRegistry() throws Exception {
methods = new ArrayList<MethodMetaData>();
locators = new ArrayList<ServiceRegistry>();
for (Entry<String, List<ResourceInvoker>> entry : registry.getBounded().entrySet()) {
List<ResourceInvoker> invokers = entry.getValue();
for (ResourceInvoker invoker : invokers) {
if (invoker instanceof ResourceMethodInvoker) {
methods.add(new MethodMetaData(this, (ResourceMethodInvoker) invoker));
} else if (invoker instanceof ResourceLocatorInvoker) {
ResourceLocatorInvoker locator = (ResourceLocatorInvoker) invoker;
Method method = locator.getMethod();
Class<?> locatorType = method.getReturnType();
Class<?>[] locatorResourceTypes = GetRestful.getSubResourceClasses(locatorType);
for (Class<?> locatorResourceType : locatorResourceTypes) {
if (locatorResourceType == null) {
// FIXME: we could generate an error for the client, which would be more informative than
// just logging this
LOG.warning("Error generating JS API: " + method.getDeclaringClass().getName() + ":" + method.getName());
// skip this
continue;
}
ResourceMethodRegistry locatorRegistry = new ResourceMethodRegistry(providerFactory);
locatorRegistry.addResourceFactory(null, null, locatorResourceType);
locators.add(new ServiceRegistry(this, locatorRegistry, providerFactory, locator));
}
}
}
}
}
Aggregations