throw new IllegalArgumentException("Nested resources are only supported on instances of ["
+ ExtendedExternalResourceDescription_impl.class.getName() + "] which"
+ "can be created with uimaFIT's createExternalResourceDescription() methods.");
}
ExtendedExternalResourceDescription_impl extRes = (ExtendedExternalResourceDescription_impl) aRes;
// Create a map of all bindings
Map<String, ExternalResourceBinding> bindings = new HashMap<String, ExternalResourceBinding>();
for (ExternalResourceBinding b : extRes.getExternalResourceBindings()) {
bindings.put(b.getKey(), b);
}
// Create a map of all resources
Map<String, ExternalResourceDescription> resources = new HashMap<String, ExternalResourceDescription>();
for (ExternalResourceDescription r : extRes.getExternalResources()) {
resources.put(r.getName(), r);
}
// For the current resource, add resource and binding
ExternalResourceBinding extResBind = createExternalResourceBinding(aBindTo, aNestedRes);
bindings.put(extResBind.getKey(), extResBind);
resources.put(aRes.getName(), aRes);
// Handle nested resources
bindNestedResources(aRes, bindings, resources);
// Commit everything to the resource manager configuration
extRes.setExternalResourceBindings(bindings.values());
extRes.setExternalResources(resources.values());
}