Revision 28570
Added by Claudio Atzori almost 10 years ago
HadoopServiceCore.java | ||
---|---|---|
46 | 46 |
public void truncateTable(final ClusterName clusterName, final String table) throws IOException { |
47 | 47 |
HBaseAdmin admin = clients.getHbaseAdmin(clusterName); |
48 | 48 |
|
49 |
if (!admin.tableExists(table)) { throw new IllegalStateException("cannot truncate unexisting table"); }
|
|
49 |
if (!admin.tableExists(table)) throw new IllegalStateException("cannot truncate unexisting table");
|
|
50 | 50 |
|
51 | 51 |
final HTableDescriptor desc = admin.getTableDescriptor(table.getBytes()); |
52 | 52 |
|
... | ... | |
69 | 69 |
public void dropTable(final ClusterName clusterName, final String table) throws IOException { |
70 | 70 |
HBaseAdmin admin = clients.getHbaseAdmin(clusterName); |
71 | 71 |
|
72 |
if (!admin.tableExists(table)) { throw new IllegalStateException("cannot drop unexisting table: '" + table + "'"); }
|
|
72 |
if (!admin.tableExists(table)) throw new IllegalStateException("cannot drop unexisting table: '" + table + "'");
|
|
73 | 73 |
|
74 | 74 |
log.info("disabling table: " + table); |
75 | 75 |
admin.disableTable(table); |
... | ... | |
81 | 81 |
public void createTable(final ClusterName clusterName, final String table, final Set<String> columns) throws IOException { |
82 | 82 |
HBaseAdmin admin = clients.getHbaseAdmin(clusterName); |
83 | 83 |
|
84 |
if (admin.tableExists(table)) { throw new IllegalStateException("table already exists"); }
|
|
84 |
if (admin.tableExists(table)) throw new IllegalStateException("table already exists");
|
|
85 | 85 |
|
86 | 86 |
HTableDescriptor desc = new HTableDescriptor(table); |
87 | 87 |
for (String column : columns) { |
... | ... | |
170 | 170 |
} |
171 | 171 |
} |
172 | 172 |
|
173 |
public Configuration getClusterConiguration(final ClusterName clusterName) { |
|
174 |
return configurationEnumerator.get(clusterName); |
|
175 |
} |
|
176 |
|
|
173 | 177 |
} |
Also available in: Unified diff
added method to retrieve the hadoop configuration