1 |
35869
|
claudio.at
|
package eu.dnetlib.msro.workflows.hadoop.hbase;
|
2 |
35797
|
claudio.at
|
|
3 |
39862
|
claudio.at
|
import com.googlecode.sarasvati.NodeToken;
|
4 |
|
|
import eu.dnetlib.data.hadoop.rmi.HadoopService;
|
5 |
35797
|
claudio.at
|
import org.apache.commons.logging.Log;
|
6 |
|
|
import org.apache.commons.logging.LogFactory;
|
7 |
|
|
|
8 |
|
|
public class ExistHBaseTableJobNode extends AbstractHBaseAdminJobNode {
|
9 |
|
|
|
10 |
|
|
private static final Log log = LogFactory.getLog(ExistHBaseTableJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
11 |
|
|
|
12 |
|
|
private String existOutNode;
|
13 |
|
|
|
14 |
|
|
private String dontExistOutNode;
|
15 |
|
|
|
16 |
|
|
@Override
|
17 |
|
|
protected String execute(final NodeToken token) throws Exception {
|
18 |
|
|
final String tableName = tableName(token);
|
19 |
|
|
final String cluster = cluster(token);
|
20 |
|
|
|
21 |
|
|
log.info("checking table existance: '" + tableName + "' on cluster: '" + cluster + "'");
|
22 |
|
|
|
23 |
40333
|
claudio.at
|
final HadoopService hadoopService = getServiceLocator().getService(HadoopService.class);
|
24 |
|
|
boolean exists = hadoopService.existHbaseTable(cluster, tableName);
|
25 |
35797
|
claudio.at
|
|
26 |
|
|
log.info("table '" + tableName + "' exists: " + exists);
|
27 |
|
|
|
28 |
39862
|
claudio.at
|
if (exists) {
|
29 |
40333
|
claudio.at
|
final String tableDesc = hadoopService.describeHBaseTableConfiguration(cluster, tableName);
|
30 |
39862
|
claudio.at
|
token.getEnv().setAttribute(getTableConfigurationParamName(), tableDesc);
|
31 |
|
|
}
|
32 |
|
|
|
33 |
35797
|
claudio.at
|
return exists ? getExistOutNode() : getDontExistOutNode();
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
public String getExistOutNode() {
|
37 |
|
|
return existOutNode;
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
public void setExistOutNode(final String existOutNode) {
|
41 |
|
|
this.existOutNode = existOutNode;
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
public String getDontExistOutNode() {
|
45 |
|
|
return dontExistOutNode;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
public void setDontExistOutNode(final String dontExistOutNode) {
|
49 |
|
|
this.dontExistOutNode = dontExistOutNode;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
}
|