1
|
package eu.dnetlib.data.hadoop.hbase;
|
2
|
|
3
|
import org.apache.commons.logging.Log;
|
4
|
import org.apache.commons.logging.LogFactory;
|
5
|
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
6
|
import org.springframework.beans.factory.annotation.Autowired;
|
7
|
|
8
|
import eu.dnetlib.data.hadoop.config.ClusterName;
|
9
|
import eu.dnetlib.data.hadoop.config.ConfigurationEnumerator;
|
10
|
import eu.dnetlib.rmi.data.hadoop.HadoopServiceException;
|
11
|
|
12
|
public class HBaseAdminFactory {
|
13
|
|
14
|
private static final Log log = LogFactory.getLog(HBaseAdminFactory.class); // NOPMD by marko on 11/24/08 5:02 PM
|
15
|
|
16
|
@Autowired
|
17
|
private ConfigurationEnumerator configurationEnumerator;
|
18
|
|
19
|
public HBaseAdmin newInstance(final ClusterName clusterName) throws HadoopServiceException {
|
20
|
try {
|
21
|
log.info("init hbaseAdmin, cluster: " + clusterName.toString());
|
22
|
return new HBaseAdmin(configurationEnumerator.get(clusterName));
|
23
|
} catch (final Throwable e) {
|
24
|
log.warn("unable to initialize hbase client for cluster: " + clusterName.toString(), e);
|
25
|
return null;
|
26
|
}
|
27
|
}
|
28
|
}
|