AnsweredAssumed Answered

Java JOB - Open a session

Question asked by fabricio.de.marchi on Aug 18, 2010
Latest reply on Aug 18, 2010 by Dave
Hi All,

I am trying to use a Java as a JOB in Clarity.

Checking the documentation I found out how to do this.

I am now trying to connect to Clarity using the information I can get from the "JobSchedulerContext" object:
String userName =
jobContext_.getSecurityIdentifier().getUsername();
//
// userName = "scheduler"
//
String sessionId =
jobContext_.getSecurityIdentifier().getSessionId();
//
// sessionId is the unique identifier for the job.
// Every time job is invoked, sessionId will be different.
Here is my source code:
import java.util.HashMap;
import com.niku.union.interfaces.JobSchedulerContext;
import com.niku.union.interfaces.SchedulerListener;

public class TestOne implements SchedulerListener {


public double getPercentComplete() throws Exception {


return 0;

}


public void scheduledEventFired(JobSchedulerContext arg0) throws Exception {


// Connect and do something

}

}
So, has anyone done that before?

I know I could have a user/password and open a JDBC connection to the database, but I was looking to try and use whatever information I can get from the "JobSchedulerContext" object to do this.
That way I avoid having that information hard coded or in a property file.

Thanks,

Outcomes