001: /*
002: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. U.S.
003: * Government Rights - Commercial software. Government users are subject
004: * to the Sun Microsystems, Inc. standard license agreement and
005: * applicable provisions of the FAR and its supplements. Use is subject
006: * to license terms.
007: *
008: * This distribution may include materials developed by third parties.
009: * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks
010: * or registered trademarks of Sun Microsystems, Inc. in the U.S. and
011: * other countries.
012: *
013: * Copyright (c) 2005 Sun Microsystems, Inc. Tous droits reserves.
014: *
015: * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel
016: * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de
017: * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions
018: * en vigueur de la FAR (Federal Acquisition Regulations) et des
019: * supplements a celles-ci. Distribue par des licences qui en
020: * restreignent l'utilisation.
021: *
022: * Cette distribution peut comprendre des composants developpes par des
023: * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE
024: * sont des marques de fabrique ou des marques deposees de Sun
025: * Microsystems, Inc. aux Etats-Unis et dans d'autres pays.
026: */
027:
028: package timer;
029:
030: import javax.ejb.*;
031:
032: /**
033: * This is the bean class for the TimerSessionBean enterprise bean.
034: * Created Apr 27, 2005 9:18:37 AM
035: * @author blaha
036: */
037: public class TimerSessionBean implements SessionBean,
038: TimerSessionRemoteBusiness, TimedObject {
039: private SessionContext context;
040:
041: // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
042: // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
043: // TODO Add business methods or web service operations
044: /**
045: * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
046: */
047: public void setSessionContext(SessionContext aContext) {
048: context = aContext;
049: }
050:
051: /**
052: * @see javax.ejb.SessionBean#ejbActivate()
053: */
054: public void ejbActivate() {
055:
056: }
057:
058: /**
059: * @see javax.ejb.SessionBean#ejbPassivate()
060: */
061: public void ejbPassivate() {
062:
063: }
064:
065: /**
066: * @see javax.ejb.SessionBean#ejbRemove()
067: */
068: public void ejbRemove() {
069:
070: }
071:
072: // </editor-fold>
073:
074: /**
075: * See section 7.10.3 of the EJB 2.0 specification
076: * See section 7.11.3 of the EJB 2.1 specification
077: */
078: public void ejbCreate() {
079: // TODO implement ejbCreate if necessary, acquire resources
080: // This method has access to the JNDI context so resource aquisition
081: // spanning all methods can be performed here such as home interfaces
082: // and data sources.
083: }
084:
085: public void ejbTimeout(Timer timer) {
086: System.out.println("TimerSessionBean: ejbTimeout ");
087: }
088:
089: // Add business logic below. (Right-click in editor and choose
090: // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
091:
092: public void myCreateTimer(long intervalDuration) {
093: System.out.println("TimerSessionBean: start createTimer ");
094:
095: TimerService timerService = context.getTimerService();
096: Timer timer = timerService.createTimer(intervalDuration,
097: "created timer");
098: }
099:
100: }
|