@Override public NamespaceDescriptor getNamespace(String name) throws IOException { NamespaceDescriptor nsd = getTableNamespaceManager().get(name); if (nsd == null) throw new NamespaceNotFoundException(name); return nsd; }
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); }
nsDescriptor = getTableNamespaceManager(env).get(namespaceName); return true;
public synchronized void remove(String name) throws IOException { if (get(name) == null) { throw new NamespaceNotFoundException(name);
/** * 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; }
private void create(Table table, NamespaceDescriptor ns) throws IOException { if (get(table, ns.getName()) != null) { throw new NamespaceExistException(ns.getName()); } validateTableAndRegionCount(ns); FileSystem fs = masterServices.getMasterFileSystem().getFileSystem(); fs.mkdirs(FSUtils.getNamespaceDir( masterServices.getMasterFileSystem().getRootDir(), ns.getName())); upsert(table, ns); if (this.masterServices.isInitialized()) { this.masterServices.getMasterQuotaManager().setNamespaceQuota(ns); } }