/** * Constructor. * * @param connectorContext connector context * @param restTemplate rest template */ public DruidHttpClientImpl(final ConnectorContext connectorContext, final RestTemplate restTemplate) { this.restTemplate = restTemplate; final Map<String, String> config = connectorContext.getConfiguration(); final String coordinatorUri = config.get(DruidConfigConstants.DRUID_COORDINATOR_URI); if (coordinatorUri == null) { throw new MetacatException("Druid cluster ending point not provided."); } try { new URI(coordinatorUri); } catch (URISyntaxException exception) { throw new MetacatException("Druid ending point invalid"); } this.druidURI = coordinatorUri; log.info("druid server uri={}", this.druidURI); }
status = HttpStatus.INTERNAL_SERVER_ERROR.value(); log.error(e.getLocalizedMessage(), e); response.sendError(status, e.getLocalizedMessage());
/** * Parse the configuration to get operation control. The control is at userName level * and the controlled operations include create, delete, and rename for table. * The format is below. * db1:user1,user2|db2:user1,user2 * * @param aclConfig the config strings for dbs * @return acl config */ @VisibleForTesting private static Map<QualifiedName, Set<String>> getAclMap(final String aclConfig) { final Map<QualifiedName, Set<String>> aclMap = new HashMap<>(); try { for (String aclstr : StringUtils.split(aclConfig, "|")) { for (QualifiedName key : PropertyUtils.delimitedStringsToQualifiedNamesList( aclstr.substring(0, aclstr.indexOf(":")), ',')) { aclMap.put(key, new HashSet<>(Arrays.asList( StringUtils.split(aclstr.substring(aclstr.indexOf(":") + 1), ",")))); } } } catch (Exception e) { throw new MetacatException("metacat acl property parsing error" + e.getMessage()); } return aclMap; } }
/** * Parse the configuration to get operation control. The control is at userName level * and the controlled operations include create, delete, and rename for table. * The format is below. * db1:user1,user2|db2:user1,user2 * * @param aclConfig the config strings for dbs * @return acl config */ @VisibleForTesting private static Map<QualifiedName, Set<String>> getAclMap(final String aclConfig) { final Map<QualifiedName, Set<String>> aclMap = new HashMap<>(); try { for (String aclstr : StringUtils.split(aclConfig, "|")) { for (QualifiedName key : PropertyUtils.delimitedStringsToQualifiedNamesList( aclstr.substring(0, aclstr.indexOf(":")), ',')) { aclMap.put(key, new HashSet<>(Arrays.asList( StringUtils.split(aclstr.substring(aclstr.indexOf(":") + 1), ",")))); } } } catch (Exception e) { throw new MetacatException("metacat acl property parsing error" + e.getMessage()); } return aclMap; } }
resourceRequestName); log.error(message, e); throw new MetacatException(message, e); } finally { final long duration = registry.clock().wallTime() - start;
throw new MetacatException(message, e); } catch (UserMetadataServiceException e) { collectRequestExceptionMetrics(tags, e.getClass().getSimpleName()); e.getCause() == null ? "" : e.getCause().getMessage(), resourceRequestName, name); log.error(message, e); throw new MetacatException(message, e); } finally { final long duration = registry.clock().wallTime() - start;
return new RetryableException(message, null); default: return new MetacatException(message);