@Override public NamespaceDescriptor getNamespace(String name) throws IOException { NamespaceDescriptor nsd = getTableNamespaceManager().get(name); if (nsd == null) throw new NamespaceNotFoundException(name); return nsd; }
protected void verifyNamespaces() throws IOException{ Connection connection = getConnection(); Admin admin = connection.getAdmin(); // iterating concurrent map for (String nsName : namespaceMap.keySet()){ try { Assert.assertTrue( "Namespace: " + nsName + " in namespaceMap does not exist", admin.getNamespaceDescriptor(nsName) != null); } catch (NamespaceNotFoundException nsnfe) { Assert.fail( "Namespace: " + nsName + " in namespaceMap does not exist: " + nsnfe.getMessage()); } } admin.close(); }
setFailure("master-delete-namespace", new NamespaceNotFoundException(namespaceName)); return false; tableCount = env.getMasterServices().listTableDescriptorsByNamespace(namespaceName).size(); } catch (FileNotFoundException fnfe) { setFailure("master-delete-namespace", new NamespaceNotFoundException(namespaceName)); return false;
protected void verifyNamespaces() throws IOException{ Connection connection = getConnection(); Admin admin = connection.getAdmin(); // iterating concurrent map for (String nsName : namespaceMap.keySet()){ try { Assert.assertTrue( "Namespace: " + nsName + " in namespaceMap does not exist", admin.getNamespaceDescriptor(nsName) != null); } catch (NamespaceNotFoundException nsnfe) { Assert.fail( "Namespace: " + nsName + " in namespaceMap does not exist: " + nsnfe.getMessage()); } } admin.close(); }
/** * Action before any real action of adding namespace. * @param env MasterProcedureEnv * @throws IOException */ private boolean prepareModify(final MasterProcedureEnv env) throws IOException { if (getTableNamespaceManager(env).doesNamespaceExist(newNsDescriptor.getName()) == false) { setFailure("master-modify-namespace", new NamespaceNotFoundException(newNsDescriptor.getName())); return false; } try { getTableNamespaceManager(env).validateTableAndRegionCount(newNsDescriptor); } catch (ConstraintException e) { setFailure("master-modify-namespace", e); return false; } // This is used for rollback oldNsDescriptor = getTableNamespaceManager(env).get(newNsDescriptor.getName()); return true; } }
/** * Ensure that the specified namespace exists, otherwise throws a NamespaceNotFoundException * * @param name the namespace to check * @throws IOException if the namespace manager is not ready yet. * @throws NamespaceNotFoundException if the namespace does not exists */ private void ensureNamespaceExists(final String name) throws IOException, NamespaceNotFoundException { checkNamespaceManagerReady(); NamespaceDescriptor nsd = tableNamespaceManager.get(name); if (nsd == null) { throw new NamespaceNotFoundException(name); } }
@Override public NamespaceDescriptor getNamespaceDescriptor(String name) throws IOException { checkNamespaceManagerReady(); if (cpHost != null) { cpHost.preGetNamespaceDescriptor(name); } NamespaceDescriptor nsd = tableNamespaceManager.get(name); if (nsd == null) { throw new NamespaceNotFoundException(name); } if (cpHost != null) { cpHost.postGetNamespaceDescriptor(nsd); } return nsd; }
public synchronized void remove(String name) throws IOException { if (get(name) == null) { throw new NamespaceNotFoundException(name); tableCount = masterServices.listTableDescriptorsByNamespace(name).size(); } catch (FileNotFoundException fnfe) { throw new NamespaceNotFoundException(name);
public synchronized void update(NamespaceDescriptor ns) throws IOException { Table table = getNamespaceTable(); if (get(table, ns.getName()) == null) { throw new NamespaceNotFoundException(ns.getName()); } upsert(table, ns); }