Tabnine Logo
NamespaceNotFoundException
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using co.cask.cdap.common.NamespaceNotFoundException (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 static void verifyNotFound(NamespaceId namespaceId) throws Exception {
  try {
   namespaceAdmin.get(namespaceId);
   Assert.fail(String.format("Namespace '%s' should not be found since it was just deleted",
                namespaceId.getNamespace()));
  } catch (NamespaceNotFoundException e) {
   Assert.assertEquals(namespaceId, e.getId());
  }
 }
}
origin: cdapio/cdap

 Assert.fail("Namespace 'random' should not exist.");
} catch (NamespaceNotFoundException e) {
 Assert.assertEquals(new NamespaceId("random"), e.getId());
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-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: 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: cdapio/cdap

@Override
public synchronized void deleteDatasets(@Name("namespaceId") NamespaceId namespaceId) throws Exception {
 // TODO: CDAP-870, CDAP-1427: Delete should be in a single transaction.
 if (!exists(namespaceId)) {
  throw new NamespaceNotFoundException(namespaceId);
 }
 if (checkProgramsRunning(namespaceId)) {
  throw new NamespaceCannotBeDeletedException(namespaceId,
                        String.format("Some programs are currently running in namespace " +
                                "'%s', please stop them before deleting datasets " +
                                "in the namespace.",
                               namespaceId));
 }
 try {
  dsFramework.deleteAllInstances(namespaceId);
 } catch (DatasetManagementException | IOException e) {
  LOG.warn("Error while deleting datasets in namespace {}", namespaceId, e);
  throw new NamespaceCannotBeDeletedException(namespaceId, e);
 }
 LOG.debug("Deleted datasets in namespace '{}'.", namespaceId);
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public synchronized void deleteDatasets(@Name("namespaceId") NamespaceId namespaceId) throws Exception {
 // TODO: CDAP-870, CDAP-1427: Delete should be in a single transaction.
 if (!exists(namespaceId)) {
  throw new NamespaceNotFoundException(namespaceId);
 }
 if (checkProgramsRunning(namespaceId)) {
  throw new NamespaceCannotBeDeletedException(namespaceId,
                        String.format("Some programs are currently running in namespace " +
                                "'%s', please stop them before deleting datasets " +
                                "in the namespace.",
                               namespaceId));
 }
 try {
  dsFramework.deleteAllInstances(namespaceId);
 } catch (DatasetManagementException | IOException e) {
  LOG.warn("Error while deleting datasets in namespace {}", namespaceId, e);
  throw new NamespaceCannotBeDeletedException(namespaceId, e);
 }
 LOG.debug("Deleted datasets in namespace '{}'.", 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()));
}
co.cask.cdap.commonNamespaceNotFoundException

Javadoc

Thrown when a namespace is not found in CDAP.

Most used methods

  • <init>
  • getId

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JOptionPane (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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