@RequestMapping(method = RequestMethod.POST, value = "/schema/list")
@Transactional(readOnly = true)
public List<String> getSchemaNames(@RequestBody final ConnInstanceTO connInstanceTO,
@RequestParam(required = false, value = "showall", defaultValue = "false") final boolean showall) {
final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getId());
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceTO.getId() + "'");
}
// consider the possibility to receive overridden properties only
final Set<ConnConfProperty> conf = binder.mergeConnConfProperties(connInstanceTO.getConfiguration(),
connInstance.getConfiguration());
// We cannot use Spring bean because this method could be used during resource definition or modification:
// bean couldn't exist or couldn't be updated.
// This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
final List<String> result =
new ArrayList<String>(connFactory.createConnector(connInstance, conf).getSchema(showall));
Collections.sort(result);
auditManager.audit(Category.connector, ConnectorSubCategory.getSchemaNames, Result.success,
"Successfully listed " + (showall ? "all " : "") + "schema names (" + result.size() + ") for connector "
+ connInstance.getDisplayName());
return result;
}