本文整理了Java中org.apache.accumulo.core.client.Connector.namespaceOperations()
方法的一些代码示例,展示了Connector.namespaceOperations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.namespaceOperations()
方法的具体详情如下:
包路径:org.apache.accumulo.core.client.Connector
类名称:Connector
方法名:namespaceOperations
[英]Retrieves a NamespaceOperations object to perform namespace functions, such as create and delete.
[中]检索NamespaceOperations对象以执行命名空间函数,例如创建和删除。
代码示例来源: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: org.apache.accumulo/accumulo-test
@Test(expected = AccumuloSecurityException.class)
public void deleteDefaultNamespace() throws Exception {
c.namespaceOperations().delete(Namespaces.DEFAULT_NAMESPACE); // should fail
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Test(expected = AccumuloSecurityException.class)
public void deleteAccumuloNamespace() throws Exception {
c.namespaceOperations().delete(Namespaces.ACCUMULO_NAMESPACE); // should fail
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Test
public void loadClass() throws Exception {
assertTrue(c.namespaceOperations().testClassLoad(Namespaces.DEFAULT_NAMESPACE,
VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName()));
assertFalse(c.namespaceOperations().testClassLoad(Namespaces.DEFAULT_NAMESPACE, "dummy",
SortedKeyValueIterator.class.getName()));
try {
c.namespaceOperations().testClassLoad(namespace, "dummy", "dummy");
fail();
} catch (NamespaceNotFoundException e) {
// expected, ignore
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-proxy
@Override
public List<String> listNamespaces(ByteBuffer login)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
try {
return new LinkedList<>(getConnector(login).namespaceOperations().list());
} catch (Exception e) {
handleException(e);
return null;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Test
public void checkReservedNamespaces() throws Exception {
assertEquals(c.namespaceOperations().defaultNamespace(), Namespaces.DEFAULT_NAMESPACE);
assertEquals(c.namespaceOperations().systemNamespace(), Namespaces.ACCUMULO_NAMESPACE);
}
代码示例来源: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-proxy
@Override
public void setNamespaceProperty(ByteBuffer login, String namespaceName, String property,
String value) throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
getConnector(login).namespaceOperations().setProperty(namespaceName, property, value);
} catch (Exception e) {
handleExceptionNNF(e);
}
}
代码示例来源: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-proxy
@Override
public Map<String,Integer> listNamespaceConstraints(ByteBuffer login, String namespaceName)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
return getConnector(login).namespaceOperations().listConstraints(namespaceName);
} catch (Exception e) {
handleExceptionNNF(e);
return null;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-proxy
@Override
public Map<String,String> namespaceIdMap(ByteBuffer login)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
try {
return getConnector(login).namespaceOperations().namespaceIdMap();
} catch (Exception e) {
handleException(e);
return null;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-proxy
@Override
public int addNamespaceConstraint(ByteBuffer login, String namespaceName,
String constraintClassName) throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
return getConnector(login).namespaceOperations().addConstraint(namespaceName,
constraintClassName);
} catch (Exception e) {
handleExceptionNNF(e);
return -1;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-proxy
@Override
public boolean testNamespaceClassLoad(ByteBuffer login, String namespaceName, String className,
String asTypeName) throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
return getConnector(login).namespaceOperations().testClassLoad(namespaceName, className,
asTypeName);
} catch (Exception e) {
handleExceptionNNF(e);
return false;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-proxy
@Override
public void removeNamespaceProperty(ByteBuffer login, String namespaceName, String property)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
getConnector(login).namespaceOperations().removeProperty(namespaceName, property);
} catch (Exception e) {
handleExceptionNNF(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-proxy
@Override
public void removeNamespaceConstraint(ByteBuffer login, String namespaceName, int id)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
getConnector(login).namespaceOperations().removeConstraint(namespaceName, id);
} catch (Exception e) {
handleExceptionNNF(e);
}
}
代码示例来源: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-proxy
@Override
public void removeNamespaceIterator(ByteBuffer login, String namespaceName, String name,
Set<org.apache.accumulo.proxy.thrift.IteratorScope> scopes)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
getConnector(login).namespaceOperations().removeIterator(namespaceName, name,
getIteratorScopes(scopes));
} catch (Exception e) {
handleExceptionNNF(e);
}
}
代码示例来源: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-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: org.apache.accumulo/accumulo-proxy
@Override
public void checkNamespaceIteratorConflicts(ByteBuffer login, String namespaceName,
org.apache.accumulo.proxy.thrift.IteratorSetting setting,
Set<org.apache.accumulo.proxy.thrift.IteratorScope> scopes)
throws org.apache.accumulo.proxy.thrift.AccumuloException,
org.apache.accumulo.proxy.thrift.AccumuloSecurityException,
org.apache.accumulo.proxy.thrift.NamespaceNotFoundException, TException {
try {
getConnector(login).namespaceOperations().checkIteratorConflicts(namespaceName,
getIteratorSetting(setting), getIteratorScopes(scopes));
} catch (Exception e) {
handleExceptionNNF(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!