我正在尝试从job.properties获取3个属性,并在Java代码中使用它们。在上面的代码中,java通过调用oozie.action.conf.xml
文件来获取它们。
public class UploadHDFS {
public static void main(String[] args) throws Exception {
new UploadHDFS().execute();
}
public void execute() {
String configurationLocation = System.getProperty("oozie.action.conf.xml");
Path localConfigurationPath = new Path(configurationLocation);
Configuration configuration = new Configuration();
configuration.addResource(localConfigurationPath);
// .. continue here
}
}
是否可以从job.properties文件中仅调用3个值?是 nameNode , jobTracker 和 queueName 而不是孔文件?
可能类似于:
String value1 = System.getProperty("<name-node>");
String value1 = System.getProperty("<job-tracker>");
String value1 = System.getProperty("<queue-name>");
或者我应该直接通过oozie工作流程中的操作将这些元素作为参数传递:
<main-class>org.apache.oozie.example.Main</main-class>
<arg>${nameNode}</arg>
<arg>${jobTracker}</arg>
<arg>${queueName}</arg>