congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
NamespaceOperations.create
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using org.apache.accumulo.core.client.admin.NamespaceOperations.create (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

@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: 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: 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: org.apache.accumulo/accumulo-test

 @Override
 public void visit(State state, Environment env, Properties props) throws Exception {
  Connector conn = env.getConnector();

  Random rand = (Random) state.get("rand");

  @SuppressWarnings("unchecked")
  List<String> namespaces = (List<String>) state.get("namespaces");

  String namespace = namespaces.get(rand.nextInt(namespaces.size()));

  try {
   conn.namespaceOperations().create(namespace);
   log.debug("Created namespace " + namespace);
  } catch (NamespaceExistsException e) {
   log.debug("Create namespace " + namespace + " failed, it exists");
  }
 }
}
origin: org.apache.accumulo/accumulo-proxy

@Override
public void createNamespace(ByteBuffer login, String namespaceName)
  throws org.apache.accumulo.proxy.thrift.AccumuloException,
  org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
  org.apache.accumulo.proxy.thrift.NamespaceExistsException, TException {
 try {
  getConnector(login).namespaceOperations().create(namespaceName);
 } catch (NamespaceExistsException e) {
  throw new org.apache.accumulo.proxy.thrift.NamespaceExistsException(e.toString());
 } catch (Exception e) {
  handleException(e);
 }
}
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 missingVolumePreferredVolumeChooser() throws Exception {
 log.info("Starting missingVolumePreferredVolumeChooser");
 // Create namespace
 Connector connector = getConnector();
 connector.namespaceOperations().create(namespace1);
 // Set properties on the namespace
 String propertyName = Property.TABLE_VOLUME_CHOOSER.getKey();
 String volume = PreferredVolumeChooser.class.getName();
 connector.namespaceOperations().setProperty(namespace1, propertyName, volume);
 // Create table1 on namespace1
 String tableName = namespace1 + ".1";
 connector.tableOperations().create(tableName);
 String tableID = connector.tableOperations().tableIdMap().get(tableName);
 // Add 10 splits to the table
 addSplits(connector, tableName);
 // Write some data to the table
 writeAndReadData(connector, tableName);
 // Verify the new files are written to the Volumes specified
 verifyVolumes(connector, tableName, TabletsSection.getRange(tableID),
   v1.toString() + "," + v2.toString() + "," + v4.toString());
}
origin: org.apache.accumulo/accumulo-test

@Test
public void notInstancePreferredVolumeChooser() throws Exception {
 log.info("Starting notInstancePreferredVolumeChooser");
 // Create namespace
 Connector connector = getConnector();
 connector.namespaceOperations().create(namespace1);
 // Set properties on the namespace
 String propertyName = Property.TABLE_VOLUME_CHOOSER.getKey();
 String volume = PreferredVolumeChooser.class.getName();
 connector.namespaceOperations().setProperty(namespace1, propertyName, volume);
 propertyName = "table.custom.preferredVolumes";
 volume = v3.toString();
 connector.namespaceOperations().setProperty(namespace1, propertyName, volume);
 // Create table1 on namespace1
 String tableName = namespace1 + ".1";
 connector.tableOperations().create(tableName);
 String tableID = connector.tableOperations().tableIdMap().get(tableName);
 // Add 10 splits to the table
 addSplits(connector, tableName);
 // Write some data to the table
 writeAndReadData(connector, tableName);
 // Verify the new files are written to the Volumes specified
 verifyVolumes(connector, tableName, TabletsSection.getRange(tableID),
   v1.toString() + "," + v2.toString() + "," + v4.toString());
}
origin: org.apache.accumulo/accumulo-test

assertNull(map.get(namespace));
c.namespaceOperations().create(namespace);
namespaces = c.namespaceOperations().list();
map = c.namespaceOperations().namespaceIdMap();
origin: org.apache.accumulo/accumulo-test

connector.namespaceOperations().create(namespace1);
  v1.toString() + "," + v2.toString() + "," + v4.toString());
connector.namespaceOperations().create(namespace2);
origin: org.apache.accumulo/accumulo-test

@Test
public void verifySystemPropertyInheritance() throws Exception {
 String t1 = "1";
 String t2 = namespace + "." + t1;
 c.tableOperations().create(t1);
 c.namespaceOperations().create(namespace);
 c.tableOperations().create(t2);
 // verify iterator inheritance
 _verifySystemPropertyInheritance(t1, t2, Property.TABLE_ITERATOR_PREFIX.getKey() + "scan.sum",
   "20," + SimpleFilter.class.getName(), false);
 // verify constraint inheritance
 _verifySystemPropertyInheritance(t1, t2, Property.TABLE_CONSTRAINT_PREFIX.getKey() + "42",
   NumericValueConstraint.class.getName(), false);
 // verify other inheritance
 _verifySystemPropertyInheritance(t1, t2,
   Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + "dummy", "dummy", true);
}
origin: dbs-leipzig/gradoop

try {
 if (!conn.namespaceOperations().exists(namespace)) {
  conn.namespaceOperations().create(namespace);
origin: org.apache.accumulo/accumulo-test

connector.namespaceOperations().create(namespace1);
  v1.toString() + "," + v2.toString() + "," + v4.toString());
connector.namespaceOperations().create(namespace2);
origin: org.apache.accumulo/accumulo-test

connector.namespaceOperations().create(namespace1);
connector.namespaceOperations().create(namespace2);
origin: org.apache.accumulo/accumulo-test

@Test
public void verifyIteratorInheritance() throws Exception {
 String t1 = namespace + ".1";
 c.namespaceOperations().create(namespace);
 c.tableOperations().create(t1);
 String iterName = namespace + "_iter";
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: org.apache.accumulo/accumulo-test

String t5 = "5";
c.namespaceOperations().create(namespace);
c.namespaceOperations().create(namespace2);
origin: org.apache.accumulo/accumulo-test

 assertEquals(NamespaceNotFoundException.class.getName(), e.getCause().getClass().getName());
c.namespaceOperations().create(namespace);
assertTrue(c.namespaceOperations().exists(namespace));
assertFalse(c.tableOperations().exists(t1));
org.apache.accumulo.core.client.adminNamespaceOperationscreate

Javadoc

Create an empty namespace with no initial configuration. Valid names for a namespace contain letters, numbers, and the underscore character.

Popular methods of NamespaceOperations

  • exists
    A method to check if a namespace exists in Accumulo.
  • 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

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • getApplicationContext (Context)
  • findViewById (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Kernel (java.awt.image)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Permission (java.security)
    Legacy security code; do not use.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Top 12 Jupyter Notebook Extensions
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