use of org.apache.accumulo.core.client.NamespaceNotFoundException in project accumulo by apache.
the class NamespaceOperationsImpl method testClassLoad.
@Override
public boolean testClassLoad(final String namespace, final String className, final String asTypeName) throws NamespaceNotFoundException, AccumuloException, AccumuloSecurityException {
checkArgument(namespace != null, "namespace is null");
checkArgument(className != null, "className is null");
checkArgument(asTypeName != null, "asTypeName is null");
try {
return ServerClient.executeRaw(context, new ClientExecReturn<Boolean, ClientService.Client>() {
@Override
public Boolean execute(ClientService.Client client) throws Exception {
return client.checkNamespaceClass(Tracer.traceInfo(), context.rpcCreds(), namespace, className, asTypeName);
}
});
} catch (ThriftTableOperationException e) {
switch(e.getType()) {
case NAMESPACE_NOTFOUND:
throw new NamespaceNotFoundException(e);
default:
throw new AccumuloException(e.description, e);
}
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
throw e;
} catch (Exception e) {
throw new AccumuloException(e);
}
}
use of org.apache.accumulo.core.client.NamespaceNotFoundException in project accumulo by apache.
the class Namespaces method getNamespaceId.
/**
* Look for namespace ID in ZK. Throw NamespaceNotFoundException if not found.
*/
public static Namespace.ID getNamespaceId(Instance instance, String namespaceName) throws NamespaceNotFoundException {
final ArrayList<Namespace.ID> singleId = new ArrayList<>(1);
getAllNamespaces(instance, (id, name) -> {
if (name.equals(namespaceName))
singleId.add(Namespace.ID.of(id));
});
if (singleId.isEmpty())
throw new NamespaceNotFoundException(null, namespaceName, "getNamespaceId() failed to find namespace");
return singleId.get(0);
}
use of org.apache.accumulo.core.client.NamespaceNotFoundException in project accumulo by apache.
the class Namespaces method getNamespaceName.
/**
* Look for namespace name in ZK. Throw NamespaceNotFoundException if not found.
*/
public static String getNamespaceName(Instance instance, Namespace.ID namespaceId) throws NamespaceNotFoundException {
String name;
ZooCache zc = getZooCache(instance);
byte[] path = zc.get(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + namespaceId.canonicalID() + Constants.ZNAMESPACE_NAME);
if (path != null)
name = new String(path, UTF_8);
else
throw new NamespaceNotFoundException(namespaceId.canonicalID(), null, "getNamespaceName() failed to find namespace");
return name;
}
Aggregations