@Override public Location call() throws Exception { return namespacePathLocator.get(namespaceId); } });
@Override public Location call() throws Exception { return namespacedLocationFactory.get(namespaceId); } });
private void createNamespace(NamespaceId namespaceId) throws Exception { // since the namespace admin here is an in memory one we need to create the location explicitly namespacePathLocator.get(namespaceId).mkdirs(); // the framework.delete looks up namespace config through namespaceadmin add the meta there too. namespaceAdmin.create(new NamespaceMeta.Builder().setName(namespaceId).build()); }
@Override public void create(NamespaceMeta namespaceMeta) throws Exception { namespaceAdmin.create(namespaceMeta); }
@Override public Location get(NamespaceId namespaceId) throws IOException { if (isReservedNamespace(namespaceId)) { return getNonCustomMappedLocation(namespaceId); } // since this is not a cdap reserved namespace we look up meta if there is a custom mapping try { return get(namespaceQueryAdmin.get(namespaceId)); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(String.format("Failed to get namespace meta for namespace %s", namespaceId), e); } }
@Override public void delete(NamespaceId namespaceId) throws Exception { namespaceAdmin.delete(namespaceId); }
@Override public List<NamespaceMeta> list() throws Exception { return namespaceAdmin.list(); }
@Override public NamespaceMeta get(NamespaceId namespaceId) throws Exception { return namespaceAdmin.get(namespaceId); }
@Override public Boolean call() throws Exception { return injector.getInstance(NamespaceAdmin.class).exists(NamespaceId.DEFAULT); } }, 5, TimeUnit.SECONDS);
@Override public boolean exists(NamespaceId namespaceId) throws Exception { try { get(namespaceId); } catch (NamespaceNotFoundException e) { return false; } catch (UnauthorizedException e) { // get throws UnauthorizedException only after ensuring that the namespace exists. Ignoring since we have // semantics that user can check for existence without having access } return true; } }
protected NamespaceQueryAdmin getNamespaceQueryAdmin() { return new SimpleNamespaceQueryAdmin(customMap); }
@Override protected HttpResponse execute(HttpRequest request) throws IOException { return remoteClient.execute(addUserIdHeader(request)); }
@Override public Boolean call() throws Exception { return injector.getInstance(NamespaceAdmin.class).exists(NamespaceId.DEFAULT); } }, 5, TimeUnit.SECONDS);
/** * Returns the location for the given namespace that contains all streams belong to that namespace. */ private Location getStreamBaseLocation(NamespaceId namespace) throws IOException { return namespacedLocationFactory.get(namespace).append(streamBaseDirPath); }
@Override public boolean exists(NamespaceId namespaceId) throws Exception { try { get(namespaceId); } catch (NamespaceNotFoundException e) { return false; } catch (UnauthorizedException e) { // get throws UnauthorizedException only after ensuring that the namespace exists. Ignoring since we have // semantics that user can check for existence without having access } return true; } }
@Override public Location call() throws Exception { return namespacedLocationFactory.get(namespaceId).append(streamBaseDirPath); } });