Junos Space Developer
Junos Space Developer

Setting Job data

05.21.12   |  
‎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.

4 REPLIES
Junos Space Developer

Re: Setting Job data

05.21.12   |  
‎05-21-2012 11:52 PM

Hi,

 

    I will check and get back on this.

 

 

Regards,

 

Vimala.

Junos Space Developer

Re: Setting Job data

05.22.12   |  
‎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.

Junos Space Developer

Re: Setting Job data

05.23.12   |  
‎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?

Junos Space Developer

Re: Setting Job data

05.30.12   |  
‎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/remote");

            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/devicefamily/M320.png
./inventoryManagerWeb/web/images/preload/devicefamily/ex8208.png
./inventoryManagerWeb/web/images/preload/devicefamily/ex6200.png
./inventoryManagerWeb/web/images/preload/devicefamily/StateLsys.png
./inventoryManagerWeb/web/images/preload/devicefamily/ex3200-48c-48poe.png
./inventoryManagerWeb/web/images/preload/devicefamily/NS5200.png
./inventoryManagerWeb/web/images/preload/devicefamily/ISG.png
./inventoryManagerWeb/web/images/preload/devicefamily/srx220.png
./inventoryManagerWeb/web/images/preload/devicefamily/mx5.png
./inventoryManagerWeb/web/images/preload/devicefamily/ex4200-24.png
./inventoryManagerWeb/web/images/preload/devicefamily/StateOrangeConnecting.png
./inventoryManagerWeb/web/images/preload/devicefamily/srx3400.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/Clone_Device_Disabled_24x24.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/Connection_Profile_Add_Enabled_24x24.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/Configlet_Download_Enabled_24x24.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/Delete_24x24.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/Connection_Profile_Add_Disabled_24x24.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/View_Configlet_Enabled_24x24.png
./inventoryManagerWeb/web/images/preload/rapidDeployment/Delete_Disabled24x24.png

 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.