congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
NamespaceNotFoundException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
co.cask.cdap.common.NamespaceNotFoundException
constructor

Best Java code snippets using co.cask.cdap.common.NamespaceNotFoundException.<init> (Showing top 20 results out of 315)

origin: co.cask.cdap/cdap-common

@Override
public NamespaceMeta get(final NamespaceId namespaceId) throws Exception {
 Iterable<NamespaceMeta> filtered = Iterables.filter(namespaces, new Predicate<NamespaceMeta>() {
  @Override
  public boolean apply(NamespaceMeta input) {
   return input.getName().equals(namespaceId.getNamespace());
  }
 });
 if (Iterables.size(filtered) == 0) {
  throw new NamespaceNotFoundException(namespaceId);
 }
 return filtered.iterator().next();
}
origin: cdapio/cdap

private NamespaceMeta fetchNamespaceMeta(NamespaceId namespaceId) throws Exception {
 NamespaceMeta ns = nsStore.get(namespaceId);
 if (ns == null) {
  throw new NamespaceNotFoundException(namespaceId);
 }
 return ns;
}
origin: co.cask.cdap/cdap-app-fabric

private NamespaceMeta fetchNamespaceMeta(NamespaceId namespaceId) throws Exception {
 NamespaceMeta ns = nsStore.get(namespaceId);
 if (ns == null) {
  throw new NamespaceNotFoundException(namespaceId);
 }
 return ns;
}
origin: cdapio/cdap

/**
 * Validates if secret manager is loaded and the provided namespace exists.
 */
private void validate(String namespace) throws Exception {
 if (secretManager == null) {
  throw new RuntimeException("Secret manager is either not initialized or not loaded. ");
 }
 NamespaceId namespaceId = new NamespaceId(namespace);
 if (!namespaceQueryAdmin.exists(namespaceId)) {
  throw new NamespaceNotFoundException(namespaceId);
 }
}
origin: cdapio/cdap

@Override
public synchronized NamespaceMeta get(NamespaceId namespaceId) throws Exception {
 NamespaceMeta meta = namespaces.get(namespaceId);
 if (meta == null) {
  throw new NamespaceNotFoundException(namespaceId);
 }
 return meta;
}
origin: cdapio/cdap

@Override
public synchronized void delete(NamespaceId namespaceId) throws Exception {
 if (namespaces.remove(namespaceId) == null) {
  throw new NamespaceNotFoundException(namespaceId);
 }
}
origin: cdapio/cdap

/**
 * Throws an exception if the specified namespace is not the system namespace and does not exist
 */
private void ensureNamespaceExists(NamespaceId namespaceId) throws Exception {
 if (!NamespaceId.SYSTEM.equals(namespaceId)) {
  if (!namespaceQueryAdmin.exists(namespaceId)) {
   throw new NamespaceNotFoundException(namespaceId);
  }
 }
}
origin: cdapio/cdap

private void checkNamespaceExists(String namespace) throws Exception {
 NamespaceId namespaceId = new NamespaceId(namespace);
 if (!namespaceQueryAdmin.exists(namespaceId)) {
  throw new NamespaceNotFoundException(namespaceId);
 }
}
origin: cdapio/cdap

 @Override
 public void ensureExists(NamespaceId namespaceId) throws NotFoundException {
  if (!NamespaceId.SYSTEM.equals(namespaceId)) {
   boolean exists = false;
   try {
    exists = namespaceQueryAdmin.exists(namespaceId);
   } catch (Exception e) {
    throw Throwables.propagate(e);
   }
   if (!exists) {
    throw new NamespaceNotFoundException(namespaceId);
   }
  }
 }
}
origin: cdapio/cdap

 /**
  * Throws an exception if the specified namespace is not the system namespace and does not exist
  */
 private void ensureNamespaceExists(NamespaceId namespaceId) throws Exception {
  if (!NamespaceId.SYSTEM.equals(namespaceId)) {
   if (!namespaceQueryAdmin.exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
   }
  }
 }
}
origin: cdapio/cdap

private void checkNamespaceExists(String namespace) throws Exception {
 NamespaceId namespaceId = new NamespaceId(namespace);
 if (!namespaceQueryAdmin.exists(namespaceId)) {
  throw new NamespaceNotFoundException(namespaceId);
 }
}
origin: co.cask.cdap/cdap-data-fabric

/**
 * Throws an exception if the specified namespace is not the system namespace and does not exist
 */
private void ensureNamespaceExists(NamespaceId namespaceId) throws Exception {
 if (!NamespaceId.SYSTEM.equals(namespaceId)) {
  if (!namespaceQueryAdmin.exists(namespaceId)) {
   throw new NamespaceNotFoundException(namespaceId);
  }
 }
}
origin: co.cask.cdap/cdap-app-fabric

 @Override
 public void ensureExists(NamespaceId namespaceId) throws NotFoundException {
  if (!NamespaceId.SYSTEM.equals(namespaceId)) {
   boolean exists = false;
   try {
    exists = namespaceQueryAdmin.exists(namespaceId);
   } catch (Exception e) {
    throw Throwables.propagate(e);
   }
   if (!exists) {
    throw new NamespaceNotFoundException(namespaceId);
   }
  }
 }
}
origin: co.cask.cdap/cdap-data-fabric

 /**
  * Throws an exception if the specified namespace is not the system namespace and does not exist
  */
 private void ensureNamespaceExists(NamespaceId namespaceId) throws Exception {
  if (!NamespaceId.SYSTEM.equals(namespaceId)) {
   if (!namespaceQueryAdmin.exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
   }
  }
 }
}
origin: cdapio/cdap

 @Override
 public synchronized void updateProperties(NamespaceId namespaceId, NamespaceMeta namespaceMeta) throws Exception {
  if (namespaces.replace(namespaceId, namespaceMeta) == null) {
   throw new NamespaceNotFoundException(namespaceId);
  }
 }
}
origin: co.cask.cdap/cdap-common

@Override
public NamespaceMeta get(NamespaceId namespaceId) throws Exception {
 HttpResponse response =
  execute(HttpRequest.get(resolve(String.format("namespaces/%s", namespaceId.getNamespace()))).build());
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NamespaceNotFoundException(namespaceId);
 } else if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
  return ObjectResponse.fromJsonBody(response, NamespaceMeta.class).getResponseObject();
 }
 throw new IOException(String.format("Cannot get namespace %s. Reason: %s",
                   namespaceId, response.getResponseBodyAsString()));
}
origin: caskdata/cdap

@Override
public NamespaceMeta get(NamespaceId namespaceId) throws Exception {
 HttpResponse response =
  execute(HttpRequest.get(resolve(String.format("namespaces/%s", namespaceId.getNamespace()))).build());
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NamespaceNotFoundException(namespaceId);
 } else if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
  return ObjectResponse.fromJsonBody(response, NamespaceMeta.class).getResponseObject();
 }
 throw new IOException(String.format("Cannot get namespace %s. Reason: %s",
                   namespaceId, response.getResponseBodyAsString()));
}
origin: caskdata/cdap

@Override
public void delete(NamespaceId namespaceId) throws Exception {
 URL url = resolve(String.format("unrecoverable/namespaces/%s", namespaceId.getNamespace()));
 HttpResponse response = execute(HttpRequest.delete(url).build());
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NamespaceNotFoundException(namespaceId);
 } else if (HttpURLConnection.HTTP_FORBIDDEN == response.getResponseCode()) {
  throw new NamespaceCannotBeDeletedException(namespaceId, response.getResponseBodyAsString());
 } else if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
  return;
 }
 throw new IOException(String.format("Cannot delete namespace %s. Reason: %s",
                   namespaceId, response.getResponseBodyAsString()));
}
origin: co.cask.cdap/cdap-common

@Override
public void delete(NamespaceId namespaceId) throws Exception {
 URL url = resolve(String.format("unrecoverable/namespaces/%s", namespaceId.getNamespace()));
 HttpResponse response = execute(HttpRequest.delete(url).build());
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NamespaceNotFoundException(namespaceId);
 } else if (HttpURLConnection.HTTP_FORBIDDEN == response.getResponseCode()) {
  throw new NamespaceCannotBeDeletedException(namespaceId, response.getResponseBodyAsString());
 } else if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
  return;
 }
 throw new IOException(String.format("Cannot delete namespace %s. Reason: %s",
                   namespaceId, response.getResponseBodyAsString()));
}
origin: cdapio/cdap

/**
 * Tests deploying an application in a non-existing non-default namespace.
 */
@Test
public void testDeployNonExistingNamespace() throws Exception {
 HttpResponse response = deploy(AllProgramsApp.class, 404, Constants.Gateway.API_VERSION_3_TOKEN, "random");
 NotFoundException nfe = new NamespaceNotFoundException(new NamespaceId("random"));
 Assert.assertEquals(nfe.getMessage(), response.getResponseBodyAsString());
}
co.cask.cdap.commonNamespaceNotFoundException<init>

Popular methods of NamespaceNotFoundException

  • getId

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now