Project

General

Profile

1
package eu.dnetlib.msro.workflows.nodes.hadoop;
2

    
3
import eu.dnetlib.msro.workflows.procs.Env;
4
import eu.dnetlib.rmi.data.hadoop.HadoopService;
5
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
	@Override
13
	protected String execute(final Env env) throws Exception {
14

    
15
		log.info("checking table existance: '" + getTableName() + "' on cluster: '" + getCluster() + "'");
16

    
17
		final HadoopService hadoopService = getServiceLocator().getService(HadoopService.class);
18
		boolean exists = hadoopService.existHbaseTable(getCluster(), getTableName());
19

    
20
		log.info("table '" + getTableName() + "' exists: " + exists);
21

    
22
		if (exists) {
23
			final String tableDesc = hadoopService.describeHBaseTableConfiguration(getCluster(), getTableName());
24
			env.setAttribute(getTableConfigurationParamName(), tableDesc);
25
		}
26

    
27
		return exists ? "drop" : "define";
28
	}
29

    
30
}
(9-9/13)