public String getHBaseNamespace(NamespaceMeta namespaceMeta) { if (!Strings.isNullOrEmpty(namespaceMeta.getConfig().getHbaseNamespace())) { return namespaceMeta.getConfig().getHbaseNamespace(); } return toCDAPManagedHBaseNamespace(namespaceMeta.getNamespaceId()); }
private boolean hasCustomMapping(NamespaceMeta metadata) { NamespaceConfig config = metadata.getConfig(); return !(Strings.isNullOrEmpty(config.getRootDirectory()) && Strings.isNullOrEmpty(config.getHbaseNamespace()) && Strings.isNullOrEmpty(config.getHiveDatabase())); }
private boolean hasCustomMapping(NamespaceMeta metadata) { NamespaceConfig config = metadata.getConfig(); return !(Strings.isNullOrEmpty(config.getRootDirectory()) && Strings.isNullOrEmpty(config.getHbaseNamespace()) && Strings.isNullOrEmpty(config.getHiveDatabase())); }
public String getHBaseNamespace(NamespaceMeta namespaceMeta) { if (!Strings.isNullOrEmpty(namespaceMeta.getConfig().getHbaseNamespace())) { return namespaceMeta.getConfig().getHbaseNamespace(); } return toCDAPManagedHBaseNamespace(namespaceMeta.getNamespaceId()); }
builder.append("='").append(namespaceConfig.getRootDirectory()).append("', "); if (namespaceConfig.getHbaseNamespace() != null) { builder.append(ArgumentName.NAMESPACE_HBASE_NAMESPACE); builder.append("='").append(namespaceConfig.getHbaseNamespace()).append("', ");
builder.append("='").append(namespaceConfig.getRootDirectory()).append("', "); if (namespaceConfig.getHbaseNamespace() != null) { builder.append(ArgumentName.NAMESPACE_HBASE_NAMESPACE); builder.append("='").append(namespaceConfig.getHbaseNamespace()).append("', ");
@SuppressWarnings("ConstantConditions") @Override public void delete(NamespaceId namespaceId) throws IOException, ExploreException, SQLException { // delete namespace directory from filesystem super.delete(namespaceId); if (NamespaceId.DEFAULT.equals(namespaceId)) { return; } // delete HBase namespace NamespaceConfig namespaceConfig; try { namespaceConfig = namespaceQueryAdmin.get(namespaceId).getConfig(); } catch (Exception ex) { throw new IOException("Could not fetch custom HBase mapping.", ex); } if (!Strings.isNullOrEmpty(namespaceConfig.getHbaseNamespace())) { // custom namespace mapping is set for HBase, hence don't do anything during delete since the lifecycle of the // namespace will be managed by the user LOG.debug("Custom HBase mapping {} was found while deleting {}. Hence skipping deletion of HBase namespace", namespaceConfig.getHbaseNamespace(), namespaceId); return; } // delete HBase namespace String namespace = tableUtil.getHBaseNamespace(namespaceId); try (HBaseDDLExecutor executor = hBaseDDLExecutorFactory.get()) { executor.deleteNamespaceIfExists(namespace); } } }
@SuppressWarnings("ConstantConditions") @Override public void delete(NamespaceId namespaceId) throws IOException, ExploreException, SQLException { // delete namespace directory from filesystem super.delete(namespaceId); if (NamespaceId.DEFAULT.equals(namespaceId)) { return; } // delete HBase namespace NamespaceConfig namespaceConfig; try { namespaceConfig = namespaceQueryAdmin.get(namespaceId).getConfig(); } catch (Exception ex) { throw new IOException("Could not fetch custom HBase mapping.", ex); } if (!Strings.isNullOrEmpty(namespaceConfig.getHbaseNamespace())) { // custom namespace mapping is set for HBase, hence don't do anything during delete since the lifecycle of the // namespace will be managed by the user LOG.debug("Custom HBase mapping {} was found while deleting {}. Hence skipping deletion of HBase namespace", namespaceConfig.getHbaseNamespace(), namespaceId); return; } // delete HBase namespace String namespace = tableUtil.getHBaseNamespace(namespaceId); try (HBaseDDLExecutor executor = hBaseDDLExecutorFactory.get()) { executor.deleteNamespaceIfExists(namespace); } } }
NamespaceConfig existingConfig = existingNamespaceMeta.getConfig(); if (!Strings.isNullOrEmpty(metadata.getConfig().getHbaseNamespace()) && metadata.getConfig().getHbaseNamespace().equals(existingConfig.getHbaseNamespace())) { throw new BadRequestException(String.format("A namespace '%s' already exists with the given " + "namespace mapping for hbase namespace '%s'", existingNamespaceMeta.getName(), existingConfig.getHbaseNamespace()));
NamespaceConfig existingConfig = existingNamespaceMeta.getConfig(); if (!Strings.isNullOrEmpty(metadata.getConfig().getHbaseNamespace()) && metadata.getConfig().getHbaseNamespace().equals(existingConfig.getHbaseNamespace())) { throw new BadRequestException(String.format("A namespace '%s' already exists with the given " + "namespace mapping for hbase namespace '%s'", existingNamespaceMeta.getName(), existingConfig.getHbaseNamespace()));
if (Strings.isNullOrEmpty(namespaceMeta.getConfig().getHbaseNamespace())) { try (HBaseDDLExecutor executor = hBaseDDLExecutorFactory.get()) { boolean created = executor.createNamespaceIfNotExists(hbaseNamespace);
if (Strings.isNullOrEmpty(namespaceMeta.getConfig().getHbaseNamespace())) { try (HBaseDDLExecutor executor = hBaseDDLExecutorFactory.get()) { boolean created = executor.createNamespaceIfNotExists(hbaseNamespace);
public Builder(NamespaceMeta meta) { this.name = meta.getName(); this.description = meta.getDescription(); NamespaceConfig config = meta.getConfig(); if (config != null) { this.schedulerQueueName = config.getSchedulerQueueName(); this.rootDirectory = config.getRootDirectory(); this.hbaseNamespace = config.getHbaseNamespace(); this.hiveDatabase = config.getHiveDatabase(); this.principal = config.getPrincipal(); this.groupName = config.getGroupName(); this.keytabURIWithoutVersion = config.getKeytabURIWithoutVersion(); this.keytabURIVersion = config.getKeytabURIVersion(); this.exploreAsPrincipal = config.isExploreAsPrincipal(); } }
public Builder(NamespaceMeta meta) { this.name = meta.getName(); this.description = meta.getDescription(); NamespaceConfig config = meta.getConfig(); if (config != null) { this.schedulerQueueName = config.getSchedulerQueueName(); this.rootDirectory = config.getRootDirectory(); this.hbaseNamespace = config.getHbaseNamespace(); this.hiveDatabase = config.getHiveDatabase(); this.principal = config.getPrincipal(); this.groupName = config.getGroupName(); this.keytabURIWithoutVersion = config.getKeytabURIWithoutVersion(); this.keytabURIVersion = config.getKeytabURIVersion(); this.exploreAsPrincipal = config.isExploreAsPrincipal(); } }