You need a class to be executed as Job

public final class BerechnungsJob implements Job
{
     /* (Kein Javadoc)
      * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
      */
     public void execute(JobExecutionContext context) throws
JobExecutionException
     {
        ...
     }
}

and you need a servlet that looks like this to init the Job Trigger

32  /***
33   * Die Klasse dient als Listener für den Servlet Container um den Timer
im Hintergrund laufen zu lassen.
34   *
36   * @version Version 1.0 27.08.2004
37   */
38  
39  public class TimerServlet implements Servlet
40  {
41  
42      /***
43       * @see javax.servlet.Servlet#init(ServletConfig)
44       */
45      public void init(ServletConfig arg0) throws ServletException
46      {
47          SchedulerFactory schedFact = new
org.quartz.impl.StdSchedulerFactory();
48          JobDetail jobDetail = new JobDetail("Calculation Timer",
"Calculation Timer", BerechnungsJob.class);
49          CronTrigger trigger = new CronTrigger("Calculation Timer",
"Calculation Timer");
50  
51          try
52          {
53              trigger.setCronExpression("0 0/5 * * * ?");
54              Scheduler sched = schedFact.getScheduler();
55              sched.start();
56              sched.scheduleJob(jobDetail, trigger);
57          }
58          catch (Exception e)
59          {
60              e.printStackTrace();
61          }
62      }
63  
64      /***
65       * @see javax.servlet.Servlet#getServletConfig()
66       */
67      public ServletConfig getServletConfig()
68      {
69          return null;
70      }
71  
72      /***
73       * @see javax.servlet.Servlet#service(ServletRequest,
ServletResponse)
74       */
75      public void service(ServletRequest arg0, ServletResponse arg1)
throws ServletException, IOException
76      {
77      }
78  
79      /***
80       * @see javax.servlet.Servlet#getServletInfo()
81       */
82      public String getServletInfo()
83      {
84          return null;
85      }
86  
87      /***
88       * @see javax.servlet.Servlet#destroy()
89       */
90      public void destroy()
91      {
92      }
93  
94  }

which is to be made public and started in web.xml so it is started on
deployment.

Hope this helps

Thomas



--------- Original-Nachricht --------
Von: Struts Users Mailing List <[EMAIL PROTECTED]>
An: 'Struts Users Mailing List ' <[EMAIL PROTECTED]>
Betreff: Struts and Quartz Scheduler
Datum: 30/09/04 06:06

> Has anyone here integrated Quartz with Struts? I'm having a hard time
> finding examples on this combination.
> 
> I'm using the latest version of Quartz, 1.4.2, and I'm initializing it in
> web.xml like this:
> 
>       &lt;servlet&gt;
>               &lt;servlet-name&gt;
>                       QuartzInitializer
>               &lt;/servlet-name&gt; 
>               &lt;display-name&gt;
>                       Quartz Initializer Servlet
>               &lt;/display-name&gt; 
>               &lt;servlet-class&gt;
>                       org.quartz.ee.servlet.QuartzInitializerServlet
>               &lt;/servlet-class&gt; 
>               &lt;load-on-startup&gt;
>                       1
>               &lt;/load-on-startup&gt;
>               &lt;init-param&gt;
>                       &lt;param-name&gt;shutdown-on-unload&lt;/param-name&gt;
>                       &lt;param-value&gt;true&lt;/param-value&gt;
>               &lt;/init-param&gt;
>       &lt;/servlet&gt;        
> 
> Anything you could share with me would be greatly appreciated. If you have
a
> quartz.properties file you could share, info on how you access the
> QuartInitializerServlet, submit jobs, etc., I'd love to see them. Sample
> code would be great.
> 
> If you know of a good document that explains it, please let me know about
> it.
> 
> Thanks a bunch,
> Brian Barnett
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

________________________________________________
Message sent using UebiMiau 2.7.8



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to