[xwiki-users] Accessing doc from Scheduler job
Hello, I've got a very simple use-case not working with the Scheduler plugin (XE 4.5.2) If I schedule a job containing merely: System.out.println doc.name ... I get the following when I trigger it: No such property: doc for class: Script1 Is it expected, not to be able to access current document from a Scheduler script ? Thanks, Jeremie
Note: job is executed as XWiki.Admin ... 2013/7/18 Jeremie BOUSQUET <[email protected]>
Hello,
I've got a very simple use-case not working with the Scheduler plugin (XE 4.5.2)
If I schedule a job containing merely:
System.out.println doc.name
... I get the following when I trigger it:
No such property: doc for class: Script1
Is it expected, not to be able to access current document from a Scheduler script ?
Thanks, Jeremie
On 07/18/2013 04:42 PM, Jeremie BOUSQUET wrote:
Hello,
I've got a very simple use-case not working with the Scheduler plugin (XE 4.5.2)
If I schedule a job containing merely:
System.out.println doc.name
... I get the following when I trigger it:
No such property: doc for class: Script1
Is it expected, not to be able to access current document from a Scheduler script ?
And what is the "current" document for a background job executed automatically, periodically? -- Sergiu Dumitriu http://purl.org/net/sergiu
Right, So let's say I'd want to access the document containing the job script being executed ... ? I'm trying to create jobs from a template job doc, and have their execution parameterized by some other object attached to the job page ... But maybe I'm not taking it the right way 2013/7/18 Sergiu Dumitriu <[email protected]>
On 07/18/2013 04:42 PM, Jeremie BOUSQUET wrote:
Hello,
I've got a very simple use-case not working with the Scheduler plugin (XE 4.5.2)
If I schedule a job containing merely:
System.out.println doc.name
... I get the following when I trigger it:
No such property: doc for class: Script1
Is it expected, not to be able to access current document from a Scheduler script ?
And what is the "current" document for a background job executed automatically, periodically?
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Let me explain more my use-case: My purpose is to allow users to create jobs in charge of loading emails from various configured sources to feed a mail archive. A LoadingSession defines some loading configuration (number of emails to load in a row, simulation mode, etc), and a list of sources from which to load emails. The idea is that user can then schedule these sessions in different jobs, to adapt to any need (for example, define some nightly job to dump emails from a large PST archive, and another job every quarter-hour to dump emails from a live account, etc). So the idea was to have some template of Scheduler job, the groovy script being in charge of triggering this email loading, and the LoadingSession to be used being stored in another object in the job page. That's why I wanted to retrieve this loading session object from the job script ... I could just generate the groovy script from the template, at job creation time (from template), by putting inside it the concerned loading session(s) (so, hard-coded). But doing that, I have no clean way of letting the user know which loading sessions have a related Scheduler job ... Thanks, Jeremie 2013/7/19 Jeremie BOUSQUET <[email protected]>
Right, So let's say I'd want to access the document containing the job script being executed ... ? I'm trying to create jobs from a template job doc, and have their execution parameterized by some other object attached to the job page ... But maybe I'm not taking it the right way
2013/7/18 Sergiu Dumitriu <[email protected]>
On 07/18/2013 04:42 PM, Jeremie BOUSQUET wrote:
Hello,
I've got a very simple use-case not working with the Scheduler plugin (XE 4.5.2)
If I schedule a job containing merely:
System.out.println doc.name
... I get the following when I trigger it:
No such property: doc for class: Script1
Is it expected, not to be able to access current document from a Scheduler script ?
And what is the "current" document for a background job executed automatically, periodically?
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Jeremie BOUSQUET -
Sergiu Dumitriu