@Test public void testSetRepositoryOwnership() { String repoName = "MyRepositoryName"; HTableDescriptor tableDescriptor = new HTableDescriptor("MyTable"); RepoAndTableUtil.setRepositoryOwnership(tableDescriptor, repoName); assertEquals(repoName, tableDescriptor.getValue(RepoAndTableUtil.OWNING_REPOSITORY_KEY)); }
public static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName) { String existingValue = tableDescriptor.getValue(OWNING_REPOSITORY_KEY); if (existingValue != null && !existingValue.equals(repositoryName)) { throw new IllegalStateException("Table descriptor already belongs to repository '" + existingValue + "', can't set owning repository to " + repositoryName); } tableDescriptor.setValue(OWNING_REPOSITORY_KEY, repositoryName); }
RepoAndTableUtil { public static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName) { String existingValue = tableDescriptor.getValue(OWNING_REPOSITORY_KEY); if (existingValue != null && !existingValue.equals(repositoryName)) { throw new IllegalStateException("Table descriptor already belongs to repository '" + existingValue + "', can't set owning repository to " + repositoryName); } tableDescriptor.setValue(OWNING_REPOSITORY_KEY, repositoryName); } }
RepoAndTableUtil { public static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName) { String existingValue = tableDescriptor.getValue(OWNING_REPOSITORY_KEY); if (existingValue != null && !existingValue.equals(repositoryName)) { throw new IllegalStateException("Table descriptor already belongs to repository '" + existingValue + "', can't set owning repository to " + repositoryName); } tableDescriptor.setValue(OWNING_REPOSITORY_KEY, repositoryName); }  }
RepoAndTableUtil { public static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName) { String existingValue = tableDescriptor.getValue(OWNING_REPOSITORY_KEY); if (existingValue != null && !existingValue.equals(repositoryName)) { throw new IllegalStateException("Table descriptor already belongs to repository '" + existingValue + "', can't set owning repository to " + repositoryName); } tableDescriptor.setValue(OWNING_REPOSITORY_KEY, repositoryName); }  static final boolean belongsToRepository(String hbaseTableName, String repositoryName); static String getHBaseTableName(String repositoryName, String tableName); static boolean isValidTableName(String name); static String extractLilyTableName(String repositoryName, String hbaseTableName); static String[] getRepositoryAndTable(String hbaseTableName); static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName); static String getOwningRepository(HTableDescriptor tableDescriptor); }
RepoAndTableUtil { public static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName) { String existingValue = tableDescriptor.getValue(OWNING_REPOSITORY_KEY); if (existingValue != null && !existingValue.equals(repositoryName)) { throw new IllegalStateException("Table descriptor already belongs to repository '" + existingValue + "', can't set owning repository to " + repositoryName); } tableDescriptor.setValue(OWNING_REPOSITORY_KEY, repositoryName); }  static final boolean belongsToRepository(String hbaseTableName, String repositoryName); static String getHBaseTableName(String repositoryName, String tableName); static boolean isValidTableName(String name); static String extractLilyTableName(String repositoryName, String hbaseTableName); static String[] getRepositoryAndTable(String hbaseTableName); static void setRepositoryOwnership(HTableDescriptor tableDescriptor, String repositoryName); static String getOwningRepository(HTableDescriptor tableDescriptor); static final String DEFAULT_REPOSITORY; static final String REPOSITORY_TABLE_SEPARATOR; static final String VALID_NAME_EXPLANATION; }