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

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

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

origin: apache/accumulo

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
  TableExistsException, NamespaceNotFoundException, NamespaceExistsException {
 String old = cl.getArgs()[0];
 String newer = cl.getArgs()[1];
 boolean resetContext = false;
 Table.ID currentTableId = null;
 if (!(shellState.getTableName() == null) && !shellState.getTableName().isEmpty()) {
  Namespace.ID namespaceId = Namespaces.getNamespaceId(shellState.getContext(), old);
  List<Table.ID> tableIds = Namespaces.getTableIds(shellState.getContext(), namespaceId);
  currentTableId = Tables.getTableId(shellState.getContext(), shellState.getTableName());
  resetContext = tableIds.contains(currentTableId);
 }
 shellState.getAccumuloClient().namespaceOperations().rename(old, newer);
 if (resetContext) {
  shellState.setTableName(Tables.getTableName(shellState.getContext(), currentTableId));
 }
 return 0;
}
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 srcName = namespaces.get(rand.nextInt(namespaces.size()));
  String newName = namespaces.get(rand.nextInt(namespaces.size()));

  try {
   conn.namespaceOperations().rename(srcName, newName);
   log.debug("Renamed namespace " + srcName + " " + newName);
  } catch (NamespaceExistsException e) {
   log.debug("Rename namespace " + srcName + " failed, " + newName + " exists");
  } catch (NamespaceNotFoundException e) {
   log.debug("Rename namespace " + srcName + " failed, doesn't exist");
  }
 }
}
origin: org.apache.accumulo/accumulo-shell

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
  throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
  TableExistsException, NamespaceNotFoundException, NamespaceExistsException {
 String old = cl.getArgs()[0];
 String newer = cl.getArgs()[1];
 boolean resetContext = false;
 String currentTableId = "";
 if (!(shellState.getTableName() == null) && !shellState.getTableName().isEmpty()) {
  String namespaceId = Namespaces.getNamespaceId(shellState.getInstance(), old);
  List<String> tableIds = Namespaces.getTableIds(shellState.getInstance(), namespaceId);
  currentTableId = Tables.getTableId(shellState.getInstance(), shellState.getTableName());
  resetContext = tableIds.contains(currentTableId);
 }
 shellState.getConnector().namespaceOperations().rename(old, newer);
 if (resetContext) {
  shellState.setTableName(Tables.getTableName(shellState.getInstance(), currentTableId));
 }
 return 0;
}
origin: org.apache.accumulo/accumulo-proxy

@Override
public void renameNamespace(ByteBuffer login, String oldNamespaceName, String newNamespaceName)
  throws org.apache.accumulo.proxy.thrift.AccumuloException,
  org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
  org.apache.accumulo.proxy.thrift.NamespaceNotFoundException,
  org.apache.accumulo.proxy.thrift.NamespaceExistsException, TException {
 try {
  getConnector(login).namespaceOperations().rename(oldNamespaceName, newNamespaceName);
 } catch (NamespaceNotFoundException e) {
  throw new org.apache.accumulo.proxy.thrift.NamespaceNotFoundException(e.toString());
 } catch (NamespaceExistsException e) {
  throw new org.apache.accumulo.proxy.thrift.NamespaceExistsException(e.toString());
 } catch (Exception e) {
  handleException(e);
 }
}
origin: org.apache.accumulo/accumulo-test

 break;
case 11:
 ops.rename(namespace, namespace + "2");
 fail();
 break;
 ops.create(namespace + i + "_1");
 ops.create(namespace + i + "_2");
 ops.rename(namespace + i + "_1", namespace + i + "_2"); // should fail here
 fail();
 break;
case 4:
 ops.create(namespace + i + "_1");
 ops.rename(namespace + i + "_1", Namespaces.DEFAULT_NAMESPACE); // should fail here
 fail();
 break;
case 5:
 ops.create(namespace + i + "_1");
 ops.rename(namespace + i + "_1", Namespaces.ACCUMULO_NAMESPACE); // should fail here
 fail();
 break;
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

 throw new IllegalStateException("Should be able to remove a table property");
loginAs(testUser);
test_user_conn.namespaceOperations().rename(namespace, namespace2);
loginAs(rootUser);
if (root_conn.namespaceOperations().list().contains(namespace)
origin: org.apache.accumulo/accumulo-test

try {
 loginAs(testUser);
 test_user_conn.namespaceOperations().rename(namespace, namespace2);
 throw new IllegalStateException("Should NOT be able to rename a namespace");
} catch (AccumuloSecurityException e) {
org.apache.accumulo.core.client.adminNamespaceOperationsrename

Javadoc

Rename a namespace

Popular methods of NamespaceOperations

  • create
    Create an empty namespace with no initial configuration. Valid names for a namespace contain letters
  • 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.
  • namespaceIdMap,
  • removeConstraint,
  • removeIterator,
  • removeProperty,
  • setProperty,
  • testClassLoad,
  • checkIteratorConflicts,
  • defaultNamespace,
  • systemNamespace

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Top 12 Jupyter Notebook extensions
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