Uploaded image for project: 'Apache Roller'
  1. Apache Roller
  2. ROL-1877

Improvements to enable "script task"

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0
    • Component/s: None
    • Labels:
      None

      Description

      Roller has a scheduled-task subsystem so that it can run tasks every minute, hour or day. Currently, you must write a Java class to implement a task and it would be nice if we had a way to write a task in a scripting language so that the the script can be change/edited while Roller is running and changing the script does not require a compilation step.

      This is a proposal to change Roller's task system to enable the creation of script tasks, i.e. tasks that can be configured to run Groovy or other JVM language scripts. To enable script tasks, we have change Roller to allow you to use one Roller Task plugin multiple times in a Roller configuration, each time with a different configuration. For example, you could create a Groovy task that can be used multiple times – each time with a different "script name" parameter you might have a

      Specific changes:

      • Change RollerTask.init() to take a string argument like so: RollerTask.init(String name).
      • Change all classes that extend RollerTask to support the new method
      • Change ThreadManagerImpl to pass in a name for each task created

      So, for example if you have a GroovyTask class that can run a Groovy script specified by a property called scriptName you might have a Roller config like this to use to run post-to-Twitter and post-to-Buzz tasks:

      tasks.enabled=ScheduledEntriesTask,ResetHitCountsTask,TurnoverReferersTask,\
      PingQueueTask,RefreshRollerPlanetTask,SocialRollerTask,\
      TwitterTask,BuzzTask

      tasks.TwitterTask.class=org.example.tasks.GroovyTask
      tasks.TwitterTask.scriptName=PostToTwitter.groovy
      tasks.TwitterTask.startTime=immediate
      tasks.TwitterTask.interval=60

      tasks.BuzzTask.class=org.example.tasks.GroovyTask
      tasks.BuzzTask.scriptName=PostToBuzz.groovy
      tasks.BuzzTask.startTime=immediate
      tasks.BuzzTask.interval=60

        Attachments

          Activity

            People

            • Assignee:
              djohnson David Johnson
              Reporter:
              djohnson David Johnson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: