1
|
package eu.dnetlib.msro.workflows.nodes.hadoop;
|
2
|
|
3
|
import java.util.Set;
|
4
|
import javax.annotation.Resource;
|
5
|
|
6
|
import com.google.common.base.Joiner;
|
7
|
import com.google.common.base.Splitter;
|
8
|
import com.google.common.collect.Sets;
|
9
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
10
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
11
|
import eu.dnetlib.msro.workflows.procs.Env;
|
12
|
import eu.dnetlib.rmi.manager.MSROException;
|
13
|
import org.apache.commons.lang3.StringUtils;
|
14
|
import org.apache.commons.logging.Log;
|
15
|
import org.apache.commons.logging.LogFactory;
|
16
|
|
17
|
public abstract class AbstractHBaseAdminJobNode extends SimpleJobNode {
|
18
|
|
19
|
/**
|
20
|
* The Constant log.
|
21
|
*/
|
22
|
private static final Log log = LogFactory.getLog(AbstractHBaseAdminJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
23
|
|
24
|
private String tableColumnsParamName = "columns";
|
25
|
private String tableConfigurationParamName = "tableConf";
|
26
|
private String tableName;
|
27
|
private String cluster;
|
28
|
|
29
|
@Resource
|
30
|
private UniqueServiceLocator serviceLocator;
|
31
|
|
32
|
protected Set<String> getColumns(final Env env) throws MSROException {
|
33
|
String envCols = env.getAttribute(getTableColumnsParamName(), String.class);
|
34
|
if (StringUtils.isBlank(envCols)) { throw new MSROException("cannot find table description"); }
|
35
|
log.debug("using columns from env: " + envCols);
|
36
|
return Sets.newHashSet(Splitter.on(",").omitEmptyStrings().split(envCols));
|
37
|
}
|
38
|
|
39
|
protected String asCSV(final Iterable<String> columns) {
|
40
|
return Joiner.on(",").skipNulls().join(columns);
|
41
|
}
|
42
|
|
43
|
public String getCluster() {
|
44
|
return cluster;
|
45
|
}
|
46
|
|
47
|
public void setCluster(final String cluster) {
|
48
|
this.cluster = cluster;
|
49
|
}
|
50
|
|
51
|
public String getTableColumnsParamName() {
|
52
|
return tableColumnsParamName;
|
53
|
}
|
54
|
|
55
|
public void setTableColumnsParamName(final String tableColumnsParamName) {
|
56
|
this.tableColumnsParamName = tableColumnsParamName;
|
57
|
}
|
58
|
|
59
|
public UniqueServiceLocator getServiceLocator() {
|
60
|
return serviceLocator;
|
61
|
}
|
62
|
|
63
|
public String getTableConfigurationParamName() {
|
64
|
return tableConfigurationParamName;
|
65
|
}
|
66
|
|
67
|
public void setTableConfigurationParamName(final String tableConfigurationParamName) {
|
68
|
this.tableConfigurationParamName = tableConfigurationParamName;
|
69
|
}
|
70
|
|
71
|
public String getTableName() {
|
72
|
return tableName;
|
73
|
}
|
74
|
|
75
|
public void setTableName(final String tableName) {
|
76
|
this.tableName = tableName;
|
77
|
}
|
78
|
}
|