1 |
26600
|
sandro.lab
|
package eu.dnetlib.data.hadoop.oozie;
|
2 |
|
|
|
3 |
49795
|
claudio.at
|
import eu.dnetlib.data.hadoop.AbstractHadoopClient;
|
4 |
|
|
import eu.dnetlib.data.hadoop.config.ClusterName;
|
5 |
|
|
import eu.dnetlib.data.hadoop.rmi.HadoopServiceException;
|
6 |
26600
|
sandro.lab
|
import org.apache.commons.logging.Log;
|
7 |
|
|
import org.apache.commons.logging.LogFactory;
|
8 |
|
|
import org.apache.oozie.client.OozieClient;
|
9 |
|
|
|
10 |
|
|
/**
|
11 |
|
|
* Factory bean for Oozie client instances.
|
12 |
|
|
*
|
13 |
|
|
* oozie server may not be available in every hadoop deployment, so every oozie specific operation should be defined as optional.
|
14 |
|
|
*
|
15 |
|
|
* @author claudio
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
49795
|
claudio.at
|
public class OozieClientFactory extends AbstractHadoopClient {
|
19 |
26600
|
sandro.lab
|
|
20 |
32295
|
claudio.at
|
private static final String ENV_ATTRIBUTE_OOZIE_SERVICE_LOC = "oozie.service.loc";
|
21 |
26600
|
sandro.lab
|
|
22 |
|
|
private static final Log log = LogFactory.getLog(OozieClientFactory.class); // NOPMD by marko on 11/24/08 5:02 PM
|
23 |
|
|
|
24 |
49795
|
claudio.at
|
public OozieClient newInstance(ClusterName clusterName) throws HadoopServiceException {
|
25 |
26600
|
sandro.lab
|
final String oozieServiceLocation = configurationEnumerator.get(clusterName).get(ENV_ATTRIBUTE_OOZIE_SERVICE_LOC);
|
26 |
|
|
log.info("init oozie client, cluster: " + clusterName.toString() + ", oozie server: " + oozieServiceLocation);
|
27 |
49795
|
claudio.at
|
setHadoopUser();
|
28 |
26600
|
sandro.lab
|
try {
|
29 |
|
|
return new OozieClient(oozieServiceLocation);
|
30 |
|
|
} catch (Throwable e) {
|
31 |
49795
|
claudio.at
|
throw new HadoopServiceException("unable to initialize oozie client for cluster: " + clusterName.toString(), e);
|
32 |
26600
|
sandro.lab
|
}
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
}
|