Oracle® Business Intelligence Scheduler Guide > Configuring Java Job Properties for Oracle BI Scheduler >

Oracle BI Scheduler Java Extension Example


The following example illustrates how to use the previously described interfaces and class to create a custom implementation.

NOTE:  When the compiled class is run as part of an iBot, it collects the user who ran the iBot, job ID of the iBot, instance ID of the iBot, as well as all possible parameters into an output file.

package sample;

import java.io.*;
import java.lang.Thread;

import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJavaExtension;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobException;
import com.siebel.analytics.scheduler.javahostrpccalls.SchedulerJobInfo;

/**

*

* @author

*/public class SimpleTest implements SchedulerJavaExtension
{
public void run(SchedulerJobInfo jobInfo) throws SchedulerJobException
{
System.out.println("JobID is:" + jobInfo.jobID());
System.out.println("Instance ID is:" + jobInfo.instanceID());

System.out.println("JobInfo to string is:" + jobInfo.toString());
try
{
File outputFile = new File("D:\\temp\\JavaJob.txt");
FileWriter out = new FileWriter(outputFile);
out.write("User ID:\t\t" + jobInfo.userID() + "\r\n");
out.write("Job ID:\t\t" + jobInfo.jobID() + "\r\n");
out.write("Instance ID:\t\t" + jobInfo.instanceID() + "\r\n");
out.write("Parameter Count:\t\t" + jobInfo.parameterCount() + "\r\n");
for(int i = 0; i < jobInfo.parameterCount(); ++i)
{
out.write("\tParameter ");
out.write(new Integer(i).toString());
out.write(":\t" + jobInfo.parameter(i) + "\r\n");
}
out.close();
}
catch(Exception ex)
{
throw new SchedulerJobException(1, 1, ex.getMessage());
}
}
public void cancel()
{

}
}

Oracle® Business Intelligence Scheduler Guide Copyright © 2007, Oracle. All rights reserved.