Tabnine Logo
NamespaceOperations.exists
Code IndexAdd Tabnine to your IDE (free)

How to use
exists
method
in
org.apache.accumulo.core.client.admin.NamespaceOperations

Best Java code snippets using org.apache.accumulo.core.client.admin.NamespaceOperations.exists (Showing top 20 results out of 315)

origin: prestodb/presto

/**
 * Ensures the given Accumulo namespace exist, creating it if necessary
 *
 * @param schema Presto schema (Accumulo namespace)
 */
public void ensureNamespace(String schema)
{
  try {
    // If the table schema is not "default" and the namespace does not exist, create it
    if (!schema.equals(DEFAULT) && !connector.namespaceOperations().exists(schema)) {
      connector.namespaceOperations().create(schema);
    }
  }
  catch (AccumuloException | AccumuloSecurityException e) {
    throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to check for existence or create Accumulo namespace", e);
  }
  catch (NamespaceExistsException e) {
    // Suppress race condition between test for existence and creation
    LOG.warn("NamespaceExistsException suppressed when creating " + schema);
  }
}
origin: apache/accumulo

public static String getNamespaceOpt(final CommandLine cl, final Shell shellState)
  throws NamespaceNotFoundException, AccumuloException, AccumuloSecurityException {
 String namespace = null;
 if (cl.hasOption(ShellOptions.namespaceOption)) {
  namespace = cl.getOptionValue(ShellOptions.namespaceOption);
  if (!shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
   throw new NamespaceNotFoundException(namespace, namespace,
     "specified namespace that doesn't exist");
  }
 } else {
  throw new NamespaceNotFoundException(null, null, "no namespace specified");
 }
 return namespace;
}
origin: apache/accumulo

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException, TableExistsException,
  TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
  NamespaceNotFoundException {
 if (createNamespaceOptCopyConfig == null) {
  getOptions();
 }
 String namespace = cl.getArgs()[0];
 shellState.getAccumuloClient().namespaceOperations().create(namespace);
 // Copy options if flag was set
 Iterable<Entry<String,String>> configuration = null;
 if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
  String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
  if (shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
   configuration = shellState.getAccumuloClient().namespaceOperations().getProperties(copy);
  }
 }
 if (configuration != null) {
  for (Entry<String,String> entry : configuration) {
   if (Property.isValidTablePropertyKey(entry.getKey())) {
    shellState.getAccumuloClient().namespaceOperations().setProperty(namespace,
      entry.getKey(), entry.getValue());
   }
  }
 }
 return 0;
}
origin: apache/accumulo

 && !shellState.getAccumuloClient().namespaceOperations().exists(namespace)) {
throw new NamespaceNotFoundException(null, namespace, null);
origin: NationalSecurityAgency/datawave

private void createNamespaceIfNecessary(NamespaceOperations namespaceOperations, String table) throws AccumuloException, AccumuloSecurityException {
  // if the table has a namespace in it that doesn't already exist, create it
  if (table.contains(".")) {
    String namespace = table.split("\\.")[0];
    try {
      if (!namespaceOperations.exists(namespace)) {
        namespaceOperations.create(namespace);
      }
    } catch (NamespaceExistsException e) {
      // in this case, somebody else must have created the namespace after our existence check
      log.info("Tried to create " + namespace + " but somebody beat us to the punch");
    }
  }
}

origin: NationalSecurityAgency/datawave

  private void createNamespaceIfNecessary(NamespaceOperations namespaceOperations, String table) throws AccumuloException, AccumuloSecurityException {
    // if the table has a namespace in it that doesn't already exist, create it
    if (table.contains(".")) {
      String namespace = table.split("\\.")[0];
      try {
        if (!namespaceOperations.exists(namespace)) {
          namespaceOperations.create(namespace);
        }
      } catch (NamespaceExistsException e) {
        // in this case, somebody else must have created the namespace after our existence check
        log.info("Tried to create Accumulo namespace," + namespace + ", but it already exists");
      }
    }
  }
}
origin: org.apache.accumulo/accumulo-test

@Test
public void checkBuiltInNamespaces() throws Exception {
 assertTrue(c.namespaceOperations().exists(Namespaces.DEFAULT_NAMESPACE));
 assertTrue(c.namespaceOperations().exists(Namespaces.ACCUMULO_NAMESPACE));
}
origin: org.apache.accumulo/accumulo-shell

public static String getNamespaceOpt(final CommandLine cl, final Shell shellState)
  throws NamespaceNotFoundException, AccumuloException, AccumuloSecurityException {
 String namespace = null;
 if (cl.hasOption(ShellOptions.namespaceOption)) {
  namespace = cl.getOptionValue(ShellOptions.namespaceOption);
  if (!shellState.getConnector().namespaceOperations().exists(namespace)) {
   throw new NamespaceNotFoundException(namespace, namespace,
     "specified namespace that doesn't exist");
  }
 } else {
  throw new NamespaceNotFoundException(null, null, "no namespace specified");
 }
 return namespace;
}
origin: org.apache.accumulo/accumulo-proxy

@Override
public boolean namespaceExists(ByteBuffer login, String namespaceName)
  throws org.apache.accumulo.proxy.thrift.AccumuloException,
  org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
 try {
  return getConnector(login).namespaceOperations().exists(namespaceName);
 } catch (Exception e) {
  handleException(e);
  return false;
 }
}
origin: org.apache.accumulo/accumulo-shell

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException, TableExistsException,
  TableNotFoundException, IOException, ClassNotFoundException, NamespaceExistsException,
  NamespaceNotFoundException {
 if (createNamespaceOptCopyConfig == null) {
  getOptions();
 }
 String namespace = cl.getArgs()[0];
 shellState.getConnector().namespaceOperations().create(namespace);
 // Copy options if flag was set
 Iterable<Entry<String,String>> configuration = null;
 if (cl.hasOption(createNamespaceOptCopyConfig.getOpt())) {
  String copy = cl.getOptionValue(createNamespaceOptCopyConfig.getOpt());
  if (shellState.getConnector().namespaceOperations().exists(namespace)) {
   configuration = shellState.getConnector().namespaceOperations().getProperties(copy);
  }
 }
 if (configuration != null) {
  for (Entry<String,String> entry : configuration) {
   if (Property.isValidTablePropertyKey(entry.getKey())) {
    shellState.getConnector().namespaceOperations().setProperty(namespace, entry.getKey(),
      entry.getValue());
   }
  }
 }
 return 0;
}
origin: org.apache.accumulo/accumulo-test

@Test
public void createTableInMissingNamespace() throws Exception {
 String t = namespace + ".1";
 assertFalse(c.namespaceOperations().exists(namespace));
 assertFalse(c.tableOperations().exists(t));
 try {
  c.tableOperations().create(t);
  fail();
 } catch (AccumuloException e) {
  assertEquals(NamespaceNotFoundException.class.getName(), e.getCause().getClass().getName());
  assertFalse(c.namespaceOperations().exists(namespace));
  assertFalse(c.tableOperations().exists(t));
 }
}
origin: dbs-leipzig/gradoop

String namespace = prefix.substring(0, prefix.indexOf("."));
try {
 if (!conn.namespaceOperations().exists(namespace)) {
  conn.namespaceOperations().create(namespace);
origin: org.apache.accumulo/accumulo-test

@Test(expected = NamespaceNotEmptyException.class)
public void deleteNonEmptyNamespace() throws Exception {
 String tableName1 = namespace + ".1";
 assertFalse(c.namespaceOperations().exists(namespace));
 assertFalse(c.tableOperations().exists(tableName1));
 c.namespaceOperations().create(namespace);
 c.tableOperations().create(tableName1);
 assertTrue(c.namespaceOperations().exists(namespace));
 assertTrue(c.tableOperations().exists(tableName1));
 c.namespaceOperations().delete(namespace); // should fail
}
origin: org.apache.accumulo/accumulo-test

@Test
public void renameNamespaceWithTable() throws Exception {
 String namespace2 = namespace + "_renamed";
 String t1 = namespace + ".t";
 String t2 = namespace2 + ".t";
 c.namespaceOperations().create(namespace);
 c.tableOperations().create(t1);
 assertTrue(c.namespaceOperations().exists(namespace));
 assertTrue(c.tableOperations().exists(t1));
 assertFalse(c.namespaceOperations().exists(namespace2));
 assertFalse(c.tableOperations().exists(t2));
 String namespaceId = c.namespaceOperations().namespaceIdMap().get(namespace);
 String tableId = c.tableOperations().tableIdMap().get(t1);
 c.namespaceOperations().rename(namespace, namespace2);
 assertFalse(c.namespaceOperations().exists(namespace));
 assertFalse(c.tableOperations().exists(t1));
 assertTrue(c.namespaceOperations().exists(namespace2));
 assertTrue(c.tableOperations().exists(t2));
 // verify id's didn't change
 String namespaceId2 = c.namespaceOperations().namespaceIdMap().get(namespace2);
 String tableId2 = c.tableOperations().tableIdMap().get(t2);
 assertEquals(namespaceId, namespaceId2);
 assertEquals(tableId, tableId2);
}
origin: NationalSecurityAgency/timely

final String[] parts = metricsTable.split("\\.", 2);
final String namespace = parts[0];
if (!connector.namespaceOperations().exists(namespace)) {
  try {
    LOG.info("Creating namespace " + namespace);
origin: org.apache.accumulo/accumulo-test

int choice = Integer.parseInt(parts[1]);
Property property = tableSettings[choice].property;
if (env.getConnector().namespaceOperations().exists(namespace)) {
 log.debug("Setting " + property.getKey() + " on " + namespace + " back to "
   + property.getDefaultValue());
origin: org.apache.accumulo/accumulo-test

String t1 = namespace + ".1";
String t2 = namespace + ".2";
assertFalse(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
assertTrue(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
c.tableOperations().create(t1);
assertTrue(c.namespaceOperations().exists(namespace));
assertTrue(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
c.tableOperations().create(t2);
assertTrue(c.namespaceOperations().exists(namespace));
assertTrue(c.tableOperations().exists(t1));
assertTrue(c.tableOperations().exists(t2));
c.tableOperations().delete(t1);
assertTrue(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
assertTrue(c.tableOperations().exists(t2));
c.tableOperations().delete(t2);
assertTrue(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
c.namespaceOperations().delete(namespace);
assertFalse(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
origin: org.apache.accumulo/accumulo-test

c.namespaceOperations().create(namespace2);
assertTrue(c.namespaceOperations().exists(namespace));
assertTrue(c.namespaceOperations().exists(namespace2));
assertFalse(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
origin: org.apache.accumulo/accumulo-test

c.tableOperations().create(t1);
assertTrue(c.tableOperations().exists(t1));
assertFalse(c.namespaceOperations().exists(namespace2));
assertFalse(c.tableOperations().exists(t2));
assertFalse(c.tableOperations().exists(t3));
assertTrue(c.namespaceOperations().exists(namespace2));
assertFalse(c.tableOperations().exists(t2));
assertFalse(c.tableOperations().exists(t3));
 c.tableOperations().clone(t1, t, false, null, null);
assertTrue(c.namespaceOperations().exists(namespace2));
assertTrue(c.tableOperations().exists(t1));
assertTrue(c.tableOperations().exists(t2));
origin: org.apache.accumulo/accumulo-test

String v = "42K";
assertFalse(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
assertFalse(c.tableOperations().exists(t2));
c.tableOperations().create(t1);
c.tableOperations().create(t0);
assertTrue(c.namespaceOperations().exists(namespace));
assertTrue(c.tableOperations().exists(t1));
assertTrue(c.tableOperations().exists(t0));
org.apache.accumulo.core.client.adminNamespaceOperationsexists

Javadoc

A method to check if a namespace exists in Accumulo.

Popular methods of NamespaceOperations

  • create
    Create an empty namespace with no initial configuration. Valid names for a namespace contain letters
  • list
    Retrieve a list of namespaces in Accumulo.
  • getProperties
    Gets properties of a namespace, which are inherited by tables in this namespace. Note that recently
  • addConstraint
    Add a new constraint to a namespace.
  • attachIterator
    Add an iterator to a namespace on the given scopes.
  • delete
    Delete an empty namespace
  • getIteratorSetting
    Get the settings for an iterator.
  • listConstraints
    List constraints on a namespace with their assigned numbers.
  • listIterators
    Get a list of iterators for this namespace.
  • namespaceIdMap
    Get a mapping of namespace name to internal namespace id.
  • removeConstraint
    Remove a constraint from a namespace.
  • removeIterator
    Remove an iterator from a namespace by name.
  • removeConstraint,
  • removeIterator,
  • removeProperty,
  • rename,
  • setProperty,
  • testClassLoad,
  • checkIteratorConflicts,
  • defaultNamespace,
  • systemNamespace

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • getApplicationContext (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JFileChooser (javax.swing)
  • Best plugins for Eclipse
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