05-21-2012 09:08 AM
Hi,
Is it possible to set JobData inside schedulable method instead of in annotation?
@Schedulable
@JobData(
name = "trololo",
iconFileName = "hello_space-new_180x180-normal.png"
)
public JobInfoTO trololo(ApiContext apiCtx, ScheduleContext scheduleCtx) {
InternalScheduleContext iSctx = (InternalScheduleContext) scheduleCtx;
int jobInstanceId = iSctx.getJobInstanceId();
// something like this
iSctx.setJobInstanceName("New Name");
// also, setJobInstanceId method doesn't work
iSctx.setJobInstanceId(jobInstanceId);
jobMgr.setJobInstanceResult(jobInstanceId, "Success", JobStatus.SUCCESS, null);
return null;
}Also, it's impossible to set job id by setJobInstanceId method. Job id is generated automatically.
Where is Job icon file located? In Eclipse docs said that in <your_app>/web/preload, but there are four folders in project: AppName, AppNameEJB, AppNameWebSvc, AppNameWeb. Witch one should contain ./web/preload folder?
Thank you.
05-21-2012 11:52 PM
Hi,
I will check and get back on this.
Regards,
Vimala.
05-22-2012 11:25 PM
Hi,
We are still looking at the code to verify whether we can set the JobData inside the schduler. I will respond to your query by tommorrow EOD.
Thanks,
vimala.
05-23-2012 01:25 AM
Thank you.
One more question:
I couldn't found any docs about it. JobManager instance has method to shedule job: scheduleJob(JobTO arg0, ScheduleTO arg1). What is the first argument? how can I get?
05-30-2012 11:40 PM
Hi,
We don't normally call this jobMgr.scheduleJob directly. The recommended way is to restify the job interface, and then use REST API's to schedule the job. But here is how you would call it, directly:
public static void testJobManager() throws Exception {
InitialContext ctx = new InitialContext();
JobManager jobMgr = (JobManager)ctx.lookup("cems/cmp.JobManagerEJB/rem
String serviceJndiName = "ChangeRequestManagerBeanEJB";
String op = "commitChangeList";
int dataId = 1;
byte[] data = null;
try {
Object[] params = { dataId };
//TODO Should call InfoSender.serialize() instead. However, see note below
data = serialize(params, 1,2);
}
catch (Exception e) {}
JobTO jto = new JobTO(serviceJndiName, data, op);
ScheduleTO sto = new ScheduleTO();
jobMgr.scheduleJob(jto, sto);
}
You need to create this folder and Space will preload it for you:
/inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/devicefam
./inventoryManagerWeb/web/images/preload/rapidDepl
./inventoryManagerWeb/web/images/preload/rapidDepl
./inventoryManagerWeb/web/images/preload/rapidDepl
./inventoryManagerWeb/web/images/preload/rapidDepl
./inventoryManagerWeb/web/images/preload/rapidDepl
./inventoryManagerWeb/web/images/preload/rapidDepl
./inventoryManagerWeb/web/images/preload/rapidDepl
Then you can just refer to the image as srx3400.png, for example. Without any path. There is no documentation which details the arguments for all the methods.
I hope this clears.
Thanks,
Vimala.