Project

General

Profile

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