Integrating Quartz

Fortunately, two things make it easy to integrate Quartz into a Web application. First, the list of third-party libraries the Quartz framework requires is pretty straightforward. Most of the third-party dependencies already are included in any Java Web application, especially ones built with open source frameworks such as Apache Struts. When deploying Quartz within a Web application, Quartz requires the following third-party libraries:

  • Commons BeanUtils
  • Commons Collections
  • Commons Logging
  • Commons Digester

If you've built Java Web applications before, you've seen all these listed here. A few other JARs might be necessary, depending on your exact deployment of Quartz. For example, if Quartz stores its job information in a database, the Standard JDBC APIs library (jdbc2_0-stdext.jar) is required, along with possibly the Java Transaction API (jta.jar).

You might also need some optional libraries, depending on the totality of your requirements. For example, if your application needs to send e-mails, you'll need the activation and JavaMail libraries. But this is true whether you are deploying Quartz within a Web application or just as a stand-alone application.

Structure of a Web Application

Over the past several years, the Servlet and JSP specifications have improved and allowed for better portability between tool vendors. This has had a calming effect on the Java development community and allows Web developers to focus on the "real" business needs and not on what has to be done to get the application to deploy and run.

Installing the Quartz Libraries

As in any other Java Web application, the Servlet specification instructs that all JARs (third-party or otherwise) must be placed into WEB-INF/lib. Therefore, one of the first steps is to put the quartz.jar file and its dependent JARs into the WEB-INF/lib directory.

JAR Version and Location Do Matter

You must be careful about not only which JAR files you put in a Web application, but also which version of the JAR you are using and exactly where you put it. As the development community continues to mature, more continuous integration is occurring across independent projects. So issues such as one project depending on an out-of-date version of another project are becoming less frequent. Be sure to check the dependencies before upgrading to newer versions of libraries.

The other thing to keep in mind is that it's extremely important (and sometimes confusing) where you install libraries. Fortunately, Web container vendors are starting to adhere to specifications more closely, and developers are becoming more educated. For Web applications, you almost always want to install any third-party library (specific to your application) into the WEB-INF/lib directory. Issues with XML parsers and encryption packages such as Sun Java Secure Socket Extensions (JSSE) still pop up, but these are becoming rare as commercial and open source vendors update their releases.

 

Choosing a Web Application Framework

It's entirely up to you which Java Web application framework you choose to integrate with Quartz. So many frameworks are available that it can be quite overwhelming. To say that one particular framework is better than another is very subjective because a lot has to do with your requirements and skill set. However, a few Web frameworks have proven themselves over time. One example is the Apache Struts framework (formerly known as Jakarta Struts). For the purpose of this section, we will use the Struts framework to demonstrate how to integrate with Quartz.


Scheduling in the Enterprise

Getting Started with Quartz

Hello, Quartz

Scheduling Jobs

Cron Triggers and More

JobStores and Persistence

Implementing Quartz Listeners

Using Quartz Plug-Ins

Using Quartz Remotely

Using Quartz with J2EE

Clustering Quartz

Quartz Cookbook

Quartz and Web Applications

Using Quartz with Workflow

Appendix A. Quartz Configuration Reference



Quartz Job Scheduling Framework(c) Building Open Source Enterprise Applications
Quartz Job Scheduling Framework: Building Open Source Enterprise Applications
ISBN: 0131886703
EAN: 2147483647
Year: N/A
Pages: 148

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net