public static String getHBaseTableName(String repositoryName, String tableName) { if (! isValidTableName(tableName)) throw new IllegalArgumentException("Bad table name: " + tableName); if (! isValidTableName(repositoryName)) throw new IllegalArgumentException("Bad repository name: " + repositoryName); if (repositoryName.equals(DEFAULT_REPOSITORY)) { // Tables within the default repository are not prefixed with the repository name, because of backwards // compatibility with the pre-multiple-repositories situation. return tableName; } else { return repositoryName + REPOSITORY_TABLE_SEPARATOR + tableName; } }
@Override public LTable getTable(String tableName) throws InterruptedException, RepositoryException { if (! RepoAndTableUtil.isValidTableName(tableName)) throw new IllegalArgumentException("Not a valid table name: " + tableName); return repositoryManager.getRepository(repoTableKey.getRepositoryName(), tableName); }
@Override public RepositoryTable createTable(TableCreateDescriptor descriptor) throws InterruptedException, IOException { if (!RepoAndTableUtil.isValidTableName(descriptor.getName())) { throw new IllegalArgumentException(String.format("'%s' is not a valid table name. " + RepoAndTableUtil.VALID_NAME_EXPLANATION, descriptor.getName())); } if (tableExists(descriptor.getName())) { throw new IllegalArgumentException(String.format("Table '%s' already exists", descriptor.getName())); } LilyHBaseSchema.getRecordTable(tableFactory, repositoryName, descriptor.getName(), descriptor.getSplitKeys()); return new RepositoryTableImpl(repositoryName, descriptor.getName()); }