Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-25 Thread Eugen Colesnicov


Paul Libbrecht wrote:
 
 what I was telling is that you should be able to get its execution from
 groovy with
   new URL(http://server/xwiki/bin/iview/MyScheduler/Velo;).getContent()
 
 and, if you needed secure access for that execution you could request
   new
 URL(http://admin:p...@server/xwiki/bin/iview/MyScheduler/Velo;).getContent()
 provided the user admin has password psps.
 

Great! All is working! Without pass - is working too.
Big thanks Paul, and thanks for all participants!

--
Best regards
Eugen Colesnicov

-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5669544.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-25 Thread Jean-Vincent Drean
Hi,

have you tried something like
xwiki.getDocument('Space.YourScript').getRenderedContent() ?

JV.

On Sat, Oct 23, 2010 at 11:26 PM, Eugen Colesnicov
ecolesni...@gmail.com wrote:

 Hi colleagues!

 I need some help for the Scheduler.
 I already have some not small script in a velocity. This script select some
 pages with complex conditions (hql),  make some calculations and sending
 emails. Now this script is working when I simply open it page (where script
 is placed).

 I need to make automatic schedule for this script (for example - every day).
 Unfortunately, scheduler scripts permit only groovy scripts ... Also,
 problem for me - I dont't now groovy at all (velocity - so-so) and I am not
 a programmer. For me - groovy learning is difficult (in any case - not
 quickly).

 My question - is any possibility to use my velocity script without total
 rewriting for groovy? Maybe I can write groovy script with redirection for
 my page with velocity script? Maybe is it possible to include code of one
 scripting language in another?

 If is not (only need to totally rewrite script to grovvy) can somebody can
 help me in this operation? I attached my original velocity script (it's
 working fine).

 http://xwiki.475771.n2.nabble.com/file/n5666438/velocity_script.txt
 velocity_script.txt

 --
 Thanks beforehand
 Eugen Colesnicov
 --
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5666438.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Sergiu Dumitriu
On 10/24/2010 12:46 AM, Eugen Colesnicov wrote:

 I tried redirecting in a scheduler script. I wrote:
 {{groovy}}
 response.sendRedirect(xwiki.getURL(ETVCCorrespondenceCode.CronJobProgrammingCode));
 {{/groovy}}

You can't redirect a scheduled job. Redirects affect HTTP responses 
only, and a job executes without a valid request/response pair.

 After this I started to using scheduler. First, I tried to trigger my job
 (as I understand - this button starts execution of script immediately). This
 give me error:
 Error number 90012 in 5: com.xpn.xwiki.plugin.scheduler.SchedulerPlugin:
 Error occured while trying to trigger job ETVCCorrespondenceJob
 Wrapped Exception: The job (DEFAULT.xwiki:Scheduler.ETVCCorrespondenceJob_0)
 referenced by the trigger does not exist.
 Looks like program cannot find job ETVCCorrespondenceJob_0 - but my job
 named ETVCCorrespondenceJob without _0. what is _0 - I don't know. I
 tried to rename my job to ETVCCorrespondenceJob_0 - but also give me error
 but with ETVCCorrespondenceJob_0_0 ...
 I cannot understand this error. This error exists also, if I write ANY
 script (also empty script field).

 Ok ... I tried to schedule my job. I putted small interval (30 seconds) - I
 don't see any results (no emails in my mailbox) - but computer processor
 gets high CPU (100%). I saw - java process giving this. I restarted my
 ApplicationServer (Glassfish) - all is ok for the next time, when I tried to
 schedule my job for 30 seconds interval. No any errors or special message in
 a logs ...

 I am not a professional in these and I cannot understand - this is my
 problem (maybe I doing something wrong) or is it bugs?


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Eugen Colesnicov

Thanks Sergiu!

But can I use Paul Libbrecht advise?
call the web page from groovy 
new java.net.URL(blablalba).getContent()

Thanks beforehand!
Eugen 
 
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5667271.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread [Ricardo Rodriguez] eBioTIC.
Hi,

Paul Libbrecht wrote:
 On 24 oct. 2010, at 13:54, Sergiu Dumitriu wrote:

   
 call the web page from groovy
 new java.net.URL(blablalba).getContent()
 
 Thanks beforehand!
 Eugen

   
 Yes, but note that the URL will be fetched without any session 
 information, so if the requested page is private (not visible for 
 guests), it won't work.
 

 or call http://user:passw...@host:port/xwiki/bin/view/Space/Name

 paul
 _

It doesn't work for me here. Please, any particular requirement/setting 
on the server side?

Is it not related with this unresolved issue 
http://jira.xwiki.org/jira/browse/XWIKI-2018?

Thanks!

Ricardo

-- 
Ricardo Rodríguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Eugen Colesnicov


Paul Libbrecht wrote:
 
 
 On 24 oct. 2010, at 13:54, Sergiu Dumitriu wrote:
 
 call the web page from groovy
 new java.net.URL(blablalba).getContent()
 
 Thanks beforehand!
 Eugen
 
 
 Yes, but note that the URL will be fetched without any session 
 information, so if the requested page is private (not visible for 
 guests), it won't work.
 
 or call http://user:passw...@host:port/xwiki/bin/view/Space/Name
 

Paul, can you give exactly example? What I should write in a scheduler field
- Job script?
Because of I tried different variants - but without results.

Also, I rewrited my original code from velocity to groovy. I tested my
groovy rewrited code in a another xwiki page - all is working fine. But when
I putted this groovy code to the scheduler - no any actions. Looks like,
that scheduler don't work at all, but standart xwiki watchlists - working
... I cannot understand nothing. Maybe somebody can help me. I attached my
groovy code (as I said - from another xwiki page - this code working fine).
http://xwiki.475771.n2.nabble.com/file/n5667864/groovy_code.txt
groovy_code.txt
Also, my original question (how need to call velocity code from groovy code
in a scheduler) also is interesting for me.

Thanks beforehand
Eugen Colesnicov
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5667864.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Thomas Höschele
Could be not a script problem at all.
If you test the scheduler via triggering, you need to unschedule, then
reschedule, then trigger the job. Don't ask me why but it worked for me.

-Ursprüngliche Nachricht-
Von: users-boun...@xwiki.org [mailto:users-boun...@xwiki.org] Im Auftrag von
Eugen Colesnicov
Gesendet: Sonntag, 24. Oktober 2010 17:14
An: users@xwiki.org
Betreff: Re: [xwiki-users] Using Scheduler issues (groovy questions)



Paul Libbrecht wrote:
 
 
 On 24 oct. 2010, at 13:54, Sergiu Dumitriu wrote:
 
 call the web page from groovy
 new java.net.URL(blablalba).getContent()
 
 Thanks beforehand!
 Eugen
 
 
 Yes, but note that the URL will be fetched without any session 
 information, so if the requested page is private (not visible for 
 guests), it won't work.
 
 or call http://user:passw...@host:port/xwiki/bin/view/Space/Name
 

Paul, can you give exactly example? What I should write in a scheduler field
- Job script?
Because of I tried different variants - but without results.

Also, I rewrited my original code from velocity to groovy. I tested my
groovy rewrited code in a another xwiki page - all is working fine. But when
I putted this groovy code to the scheduler - no any actions. Looks like,
that scheduler don't work at all, but standart xwiki watchlists - working
... I cannot understand nothing. Maybe somebody can help me. I attached my
groovy code (as I said - from another xwiki page - this code working fine).
http://xwiki.475771.n2.nabble.com/file/n5667864/groovy_code.txt
groovy_code.txt
Also, my original question (how need to call velocity code from groovy code
in a scheduler) also is interesting for me.

Thanks beforehand
Eugen Colesnicov
-- 
View this message in context:
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp
5666438p5667864.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Eugen Colesnicov


Thomas Höschele wrote:
 
 Could be not a script problem at all.
 If you test the scheduler via triggering, you need to unschedule, then
 reschedule, then trigger the job. Don't ask me why but it worked for me.
 

I made like you said - no result. Also I really waiting for scheduled time -
also no result. But another bad thing - after this (manually triggered or
automatically triggered the job) the CPU for the JAVA process goes to 100%.
No any logs in a jvm or application logs ... - all look like as normal.

My config - Windows, Oracle10G, Glassfish 3.01, XWiki Enterprise 2.4.

What it can be?

Best regards
Eugen Colesnicov
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5668148.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Eugen Colesnicov


Eugen Colesnicov wrote:
 
 ... another bad thing - after this (manually triggered or automatically
 triggered the job) the CPU for the JAVA process goes to 100%. No any logs
 in a jvm or application logs ... - all look like as normal.
 

I found what is it!!! I am writing groovy code in a job page with {{groovy}}
at the beginning and {{/groovy}} at the end of script. If I do like this -
process JAVA.EXE goes to 100%. I simply deleted {{groovy}} and {{/groovy}}
and my full groovy script, which I rewritted from my original velocity and
pasted in a scheduler job page - started to work.

Also I checked this 100% processor using variant at another machine, with
another configuration - same situation. Very strange, but I think need to
make some notes in a scheduler - that users shouldn't use {{groovy}} at the
beginning and {{/groovy}} at the end of script.

But, calling velocity or groovy script from scheduler script doesn't work
... I think, I wrote something wrong. Can somebody give me exactly example?

Thanks beforehand
Eugen Colesnicov
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5668598.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Paul Libbrecht

On 24 oct. 2010, at 16:29, [Ricardo Rodriguez] eBioTIC. wrote:

 or call http://user:passw...@host:port/xwiki/bin/view/Space/Name
 
 paul
 _
 
 It doesn't work for me here. Please, any particular requirement/setting 
 on the server side?

I don't think so.
But I note that I'm using an older xwiki.
Could be that they disabled that in more modern ones because it's not a good 
practice

 Is it not related with this unresolved issue 
 http://jira.xwiki.org/jira/browse/XWIKI-2018?

the scheme there isn't the same.

paul
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-24 Thread Paul Libbrecht
Eugen,

you said you have a velocity page, say accessible at 
http://server/xwiki/bin/iview/MyScheduler/Velo

what I was telling is that you should be able to get its execution from groovy 
with

  new URL(http://server/xwiki/bin/iview/MyScheduler/Velo;).getContent()

and, if you needed secure access for that execution you could request

  new 
URL(http://admin:p...@server/xwiki/bin/iview/MyScheduler/Velo;).getContent()

provided the user admin has password psps.

paul

On 24 oct. 2010, at 17:13, Eugen Colesnicov wrote:

 or call http://user:passw...@host:port/xwiki/bin/view/Space/Name
 
 
 Paul, can you give exactly example? What I should write in a scheduler field
 - Job script?

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-23 Thread Paul Libbrecht
My first hint would be to consider groovy as java.
It's not exactly the same but it shares most.

The other idea is to simply call the web page from groovy?

new java.net.URL(blablalba).getContent()

paul




On 23 oct. 2010, at 23:26, Eugen Colesnicov wrote:

 
 Hi colleagues!
 
 I need some help for the Scheduler.
 I already have some not small script in a velocity. This script select some
 pages with complex conditions (hql),  make some calculations and sending
 emails. Now this script is working when I simply open it page (where script
 is placed).
 
 I need to make automatic schedule for this script (for example - every day).
 Unfortunately, scheduler scripts permit only groovy scripts ... Also,
 problem for me - I dont't now groovy at all (velocity - so-so) and I am not
 a programmer. For me - groovy learning is difficult (in any case - not
 quickly).
 
 My question - is any possibility to use my velocity script without total
 rewriting for groovy? Maybe I can write groovy script with redirection for
 my page with velocity script? Maybe is it possible to include code of one
 scripting language in another?
 
 If is not (only need to totally rewrite script to grovvy) can somebody can
 help me in this operation? I attached my original velocity script (it's
 working fine).
 
 http://xwiki.475771.n2.nabble.com/file/n5666438/velocity_script.txt
 velocity_script.txt 
 
 --
 Thanks beforehand
 Eugen Colesnicov
 -- 
 View this message in context: 
 http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5666438.html
 Sent from the XWiki- Users mailing list archive at Nabble.com.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Using Scheduler issues (groovy questions)

2010-10-23 Thread Eugen Colesnicov

I tried redirecting in a scheduler script. I wrote:
{{groovy}}
response.sendRedirect(xwiki.getURL(ETVCCorrespondenceCode.CronJobProgrammingCode));
{{/groovy}}

After this I started to using scheduler. First, I tried to trigger my job
(as I understand - this button starts execution of script immediately). This
give me error:
Error number 90012 in 5: com.xpn.xwiki.plugin.scheduler.SchedulerPlugin:
Error occured while trying to trigger job ETVCCorrespondenceJob
Wrapped Exception: The job (DEFAULT.xwiki:Scheduler.ETVCCorrespondenceJob_0)
referenced by the trigger does not exist.
Looks like program cannot find job ETVCCorrespondenceJob_0 - but my job
named ETVCCorrespondenceJob without _0. what is _0 - I don't know. I
tried to rename my job to ETVCCorrespondenceJob_0 - but also give me error
but with ETVCCorrespondenceJob_0_0 ... 
I cannot understand this error. This error exists also, if I write ANY
script (also empty script field).

Ok ... I tried to schedule my job. I putted small interval (30 seconds) - I
don't see any results (no emails in my mailbox) - but computer processor
gets high CPU (100%). I saw - java process giving this. I restarted my
ApplicationServer (Glassfish) - all is ok for the next time, when I tried to
schedule my job for 30 seconds interval. No any errors or special message in
a logs ...

I am not a professional in these and I cannot understand - this is my
problem (maybe I doing something wrong) or is it bugs?
-- 
View this message in context: 
http://xwiki.475771.n2.nabble.com/Using-Scheduler-issues-groovy-questions-tp5666438p5666573.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users