Created
March 8, 2014 11:12
-
-
Save fahrinh/9428928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.joda.time.DateTime; | |
import org.pentaho.di.core.KettleEnvironment; | |
import org.pentaho.di.core.util.EnvUtil; | |
import org.pentaho.di.trans.Trans; | |
import org.pentaho.di.trans.TransMeta; | |
public class App { | |
public static void main(String[] args) throws Exception { | |
KettleEnvironment.init(); | |
EnvUtil.environmentInit(); | |
JobMeta jobMeta = new JobMeta("file.kjb", null, null); | |
// Create the Job Instance | |
Job job = new Job(null, jobMeta); | |
job.getJobMeta().setInternalKettleVariables(job); | |
job.setLogLevel(LogLevel.BASIC); | |
job.setName(Thread.currentThread().getName()); | |
// Start the Job, as it is a Thread itself by Kettle. | |
job.start(); | |
job.waitUntilFinished(); | |
if (job.getResult() != null && job.getResult().getNrErrors() != 0) { | |
throw new RuntimeException("Gagal eksekusi file kjb."); | |
} | |
// Now the job task is finished, mark it as finished. | |
job.setFinished(true); | |
// Cleanup the parameters used by the job. Post that invoke GC. | |
jobMeta.eraseParameters(); | |
job.eraseParameters(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment