I am currently doing the following. But it requires existance of a repository.xml file, which is a hassle to maintain in all different configurations. How to improve?
public class KitchenRunner {
private static Logger LOG = Logger.getLogger(KitchenRunner.class.getName());
public static void main(String[] args) throws UnknownHostException, Exception {
new KitchenRunner().run(new File("./datasync/kettle-home").getAbsoluteFile(), args[0], args[1], args[2]);
}
public void run(File kettleHome, String repoName, String dirName, String jobName) throws UnknownHostException, Exception {
if(!kettleHome.isDirectory()) {
throw new IOException("Directory not found: " + kettleHome.getAbsolutePath());
}
File kProp = new File(kettleHome,
InetAddress.getLocalHost().getHostName() + "/.kettle/" + Const.KETTLE_PROPERTIES).getAbsoluteFile();
LOG.info(Const.KETTLE_PROPERTIES + " = " + kProp.toString() + " exists=" + kProp.exists());
String kh = kProp.getParentFile().getParent();
System.setProperty("KETTLE_HOME", kh);
System.setProperty(Const.PENTAHO_METASTORE_FOLDER, System.getProperty("java.io.tmpdir"));
String cli = "/rep:" + repoName + "/dir:/" + dirName + "/job:" + jobName + " -level=Basic /param:n_threads=1";
Kitchen.main(cli.split(" "));
}
}
public class KitchenRunner {
private static Logger LOG = Logger.getLogger(KitchenRunner.class.getName());
public static void main(String[] args) throws UnknownHostException, Exception {
new KitchenRunner().run(new File("./datasync/kettle-home").getAbsoluteFile(), args[0], args[1], args[2]);
}
public void run(File kettleHome, String repoName, String dirName, String jobName) throws UnknownHostException, Exception {
if(!kettleHome.isDirectory()) {
throw new IOException("Directory not found: " + kettleHome.getAbsolutePath());
}
File kProp = new File(kettleHome,
InetAddress.getLocalHost().getHostName() + "/.kettle/" + Const.KETTLE_PROPERTIES).getAbsoluteFile();
LOG.info(Const.KETTLE_PROPERTIES + " = " + kProp.toString() + " exists=" + kProp.exists());
String kh = kProp.getParentFile().getParent();
System.setProperty("KETTLE_HOME", kh);
System.setProperty(Const.PENTAHO_METASTORE_FOLDER, System.getProperty("java.io.tmpdir"));
String cli = "/rep:" + repoName + "/dir:/" + dirName + "/job:" + jobName + " -level=Basic /param:n_threads=1";
Kitchen.main(cli.split(" "));
}
}