jvdrean (SVN) wrote:
Author: jvdrean
Date: 2009-08-21 22:46:51 +0200 (Fri, 21 Aug 2009)
New Revision: 22829
Modified:
platform/core/trunk/xwiki-core/src/main/resources/ApplicationResources.properties
platform/xwiki-applications/trunk/scheduler/src/main/resources/Scheduler/WebHome.xml
platform/xwiki-plugins/trunk/scheduler/src/main/java/com/xpn/xwiki/plugin/scheduler/SchedulerPlugin.java
platform/xwiki-plugins/trunk/scheduler/src/main/java/com/xpn/xwiki/plugin/scheduler/SchedulerPluginApi.java
platform/xwiki-plugins/trunk/scheduler/src/main/java/com/xpn/xwiki/plugin/scheduler/SchedulerPluginException.java
Log:
XASCH-35 : Allow to manually trigger a job (execute it once)
XASCH-36 : Provide a getPreviousFireTime method in the API
Modified:
platform/xwiki-applications/trunk/scheduler/src/main/resources/Scheduler/WebHome.xml
===================================================================
---
platform/xwiki-applications/trunk/scheduler/src/main/resources/Scheduler/WebHome.xml 2009-08-21
20:34:10 UTC (rev 22828)
+++
platform/xwiki-applications/trunk/scheduler/src/main/resources/Scheduler/WebHome.xml 2009-08-21
20:46:51 UTC (rev 22829)
@@ -205,6 +205,16 @@
#set($deleteRedirect = $xwiki.getURL($jobObj.getName(),"delete"))
$response.sendRedirect($deleteRedirect))
#end
+ #elseif($request.do=="trigger")
+ ##
+ ## Trigger a job (execute it now)
+ ##
+ #set($ok=$scheduler.triggerJob($jobObj))
+ #if($ok==false)
+ #error("$context.get('error')")
+ #else
+ #info("Job ~~$jobObj.get('jobName')~~
*$msg.get('xe.scheduler.triggered')*")
+ #end
#end
#end
1 $msg.get('xe.scheduler')
@@ -235,6 +245,7 @@
#set( $ok =
$!actions.put("unschedule",$doc.getURL("view","do=unschedule&which=${jobHolder.fullName}"))
)
#end
#set($ok =
$!actions.put("delete",$doc.getURL("view","do=delete&which=${jobHolder.fullName}"))
)
+ #set($ok =
$!actions.put("trigger",$doc.getURL("view","do=trigger&which=${jobHolder.fullName}"))
)
$job.get("jobName")|$status|$firetime|
*$msg.get('xe.scheduler.jobs.infos')* : [view>$jobHolder.fullName]
#if($jobHolder.hasAccessLevel("programming")) <a
href="${jobHolder.getURL('inline')}">$msg.get("edit")</a>
#end *$msg.get("job")* : #foreach($action in $actions.keySet()) <a
href="${actions.get($action)}">$action</a> #end
#end
Some quick velocity performance tests:
#set($y = "abc")
#foreach($i in [0..4000000])
#set($x = "$y")
#end
~~2.7s
#set($y = "abc")
#foreach($i in [0..4000000])
#set($x = $y)
#end
~~1.8s
Here, the quotes around "$y" are completely unneeded. Similarly, "abc"
is more costly than 'abc'. Please think of the penguins before using so
many double quotes...
--
Sergiu Dumitriu
http://purl.org/net/sergiu/