KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > timer > ejb > TimerSFSBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.timer.ejb;
23
24 import javax.ejb.SessionBean JavaDoc;
25 import javax.ejb.SessionContext JavaDoc;
26 import javax.ejb.TimedObject JavaDoc;
27 import javax.ejb.Timer JavaDoc;
28
29 import org.jboss.logging.Logger;
30
31 /**
32  * Stateful Session Bean Timer Test
33  * @author Thomas Diesler
34  * @author Scott.Stark@jboss.org
35  * @version $Revision: 58115 $
36  * @ejb:bean name="test/timer/TimerSFSB" display-name="Timer in Stateful Session
37  * Bean" type="Stateful" transaction-type="Container" view-type="remote"
38  * jndi-name="ejb/test/timer/TimerSFSB"
39  * @ejb:transaction type="Required"
40  */

41 public class TimerSFSBean
42    implements SessionBean JavaDoc, TimedObject JavaDoc
43 {
44    // -------------------------------------------------------------------------
45
// Static
46
// -------------------------------------------------------------------------
47
private static Logger log = Logger.getLogger(TimerSFSBean.class);
48    
49    // -------------------------------------------------------------------------
50
// Members
51
// -------------------------------------------------------------------------
52

53    private SessionContext JavaDoc mContext;
54    
55    // -------------------------------------------------------------------------
56
// Methods
57
// -------------------------------------------------------------------------
58

59    /**
60     * @ejb:interface-method view-type="both"
61     */

62    public void checkTimerService()
63    {
64       log.info("TimerSFSBean.checkTimerService(), try to get a Timer Service from the Session Context");
65       mContext.getTimerService();
66    }
67
68    /**
69     * Create the Session Bean
70     * @ejb:create-method view-type="both"
71     */

72    public void ejbCreate()
73    {
74       log.info("TimerSFSBean.ejbCreate()");
75    }
76
77    public void ejbTimeout(Timer JavaDoc pTimer)
78    {
79       log.info("ejbTimeout(), timer: " + pTimer);
80    }
81
82    /**
83     * Describes the instance and its content for debugging purpose
84     * @return Debugging information about the instance and its content
85     */

86    public String JavaDoc toString()
87    {
88       return "TimerSFSBean [ " + " ]";
89    }
90    
91    // -------------------------------------------------------------------------
92
// Framework Callbacks
93
// -------------------------------------------------------------------------
94

95    public void setSessionContext(SessionContext JavaDoc aContext)
96    {
97       mContext = aContext;
98    }
99
100    public void ejbActivate()
101    {
102    }
103
104    public void ejbPassivate()
105    {
106    }
107
108    public void ejbRemove()
109    {
110    }
111 }
112
Popular Tags