KickJava   Java API By Example, From Geeks To Geeks.

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


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
23 package org.jboss.test.timer.ejb;
24
25 import java.io.Serializable JavaDoc;
26 import java.util.Date JavaDoc;
27 import javax.ejb.EJBException JavaDoc;
28 import javax.ejb.SessionBean JavaDoc;
29 import javax.ejb.SessionContext JavaDoc;
30 import javax.ejb.Timer JavaDoc;
31 import javax.ejb.TimerService JavaDoc;
32
33 /**
34  * A session bean that does not implement the required TimedObject interface
35  * to test that calling getTimerService fails.
36  *
37  * @author Scott.Stark@jboss.org
38  * @version $Revision: 41239 $
39  **/

40 public class NoTimedObjectBean
41    implements SessionBean JavaDoc
42 {
43    private SessionContext JavaDoc context;
44
45    public byte[] startSingleTimer(long pPeriod)
46    {
47       return startSingleTimer(pPeriod,"TimerSLSBean.startSingleTimer");
48    }
49
50    public byte[] startSingleTimer(long pPeriod, Serializable JavaDoc info)
51    {
52       TimerService JavaDoc ts = context.getTimerService();
53       throw new EJBException JavaDoc("startSingleTimer.getTimerService should have failed");
54    }
55
56    public byte[] startTimer(long pPeriod)
57    {
58       TimerService JavaDoc ts = context.getTimerService();
59       throw new EJBException JavaDoc("startSingleTimer.getTimerService should have failed");
60    }
61
62    public byte[] startTimer(long pPeriod, Serializable JavaDoc info)
63    {
64       TimerService JavaDoc ts = context.getTimerService();
65       throw new EJBException JavaDoc("startSingleTimer.getTimerService should have failed");
66    }
67
68    public void stopTimer(byte[] handle)
69    {
70       TimerService JavaDoc ts = context.getTimerService();
71       throw new EJBException JavaDoc("startSingleTimer.getTimerService should have failed");
72    }
73
74    public int getTimeoutCount(byte[] handle)
75    {
76       return 0;
77    }
78
79    public Date JavaDoc getNextTimeout(byte[] handle)
80    {
81       return null;
82    }
83
84    public long getTimeRemaining(byte[] handle)
85    {
86       return 0;
87    }
88
89    public Object JavaDoc getInfo(byte[] handle)
90    {
91       return null;
92    }
93
94    public long getRetryTimeoutPeriod()
95    {
96       return 0;
97    }
98
99    public void ejbCreate()
100    {
101    }
102
103    public void ejbTimeout(Timer JavaDoc timer)
104    {
105    }
106
107    public void setSessionContext(SessionContext JavaDoc context)
108    {
109       this.context = context;
110    }
111
112    public void ejbActivate()
113    {
114    }
115
116    public void ejbPassivate()
117    {
118    }
119
120    public void ejbRemove()
121    {
122    }
123
124 }
125
Popular Tags