Book Image

Java EE 5 Development using GlassFish Application Server

By : David R Heffelfinger
Book Image

Java EE 5 Development using GlassFish Application Server

By: David R Heffelfinger

Overview of this book

<p>GlassFish is a free, open-source Java EE 5-compliant application server that is quickly gaining massive popularity.<br /><br />This book explains GlassFish installation and configuration, and then moves on to Java EE 5 application development, covering all major Java EE 5 APIs.<br /><br /><span style="font-weight: bold;">Chapter 1</span> provides an overview of Glassfish, including how to install it, configure it, and verify the installation.<br /><br /><span style="font-weight: bold;">Chapter 2</span> covers how to develop server-side web applications using the Servlet API. &nbsp;<br /><br /><span style="font-weight: bold;">Chapter 3</span> explains how to develop web applications using JavaServer Pages (JSPs), including how to develop and use JSP custom tags.<br /><br /><span style="font-weight: bold;">Chapter 4</span> discusses how to develop Java EE applications that interact with a relational database system through the Java Persistence API (JPA) and through the Java Database Connectivity API (JDBC).<br /><br style="font-weight: bold;" /><span style="font-weight: bold;">Chapter 5</span> explains how to use the JSP Standard Tag Library (JSTL) when developing JavaServer Pages.<br /><br /><span style="font-weight: bold;">Chapter 6</span> covers how to develop applications using the JavaServer Faces (JSF) component framework to build web applications.<br /><br /><span style="font-weight: bold;">Chapter 7</span> explains how to develop messaging applications though the Java Messaging Service (JMS) API.<br /><br /><span style="font-weight: bold;">Chapter 8</span> covers securing J2EE applications through the Java Authentication and Authorization Service (JAAS).<br /><br /><span style="font-weight: bold;">Chapter 9</span> discusses how to develop Enterprise Java Beans that adhere to the EJB 3 specification.<br /><br /><span style="font-weight: bold;">Chapter 10</span> explains how to develop and deploy web services that conform to the JAX-WS 2.1 specification.<br /><br /><span style="font-weight: bold;">Chapter 11</span> covers frameworks that build on top of the Java EE 5 specification, including Seam, Facelets, and Ajax4Jsf.<br /><br /><span style="font-weight: bold;">The appendices</span> cover some of the advanced features of the GlassFish server.</p>
Table of Contents (18 chapters)
Java EE 5 Development using GlassFish Application Server
Credits
About the Author
About the Reviewers
Preface
IDE Integration

EJB Timer Service


Stateless session beans and message-driven beans can have a method that is executed periodically at regular intervals of time. This can be accomplished by using the EJB Timer Service. The following example illustrates how to take advantage of this service.

package net.ensode.glassfishbook;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.ejb.EJBContext;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
@Stateless
public class EjbTimerExampleBean implements EjbTimerExample
{
private static Logger logger = Logger.getLogger(EjbTimerExampleBean. class.getName());
@Resource
TimerService timerService;
public void startTimer(Serializable info)
{
Timer timer = timerService.createTimer
(new Date(), 5000, info);
}
public void stopTimer(Serializable info)
{
Timer timer;
Collection timers = timerService.getTimers...