001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.timer.ejb;
023:
024: import java.io.Serializable;
025: import java.util.Date;
026: import javax.ejb.EJBException;
027: import javax.ejb.SessionBean;
028: import javax.ejb.SessionContext;
029: import javax.ejb.Timer;
030: import javax.ejb.TimerService;
031:
032: /**
033: * A session bean that does not implement the required TimedObject interface
034: * to test that calling getTimerService fails.
035: *
036: * @author Scott.Stark@jboss.org
037: * @version $Revision: 57211 $
038: **/
039: public class NoTimedObjectBean implements SessionBean {
040: private SessionContext context;
041:
042: public byte[] startSingleTimer(long pPeriod) {
043: return startSingleTimer(pPeriod,
044: "TimerSLSBean.startSingleTimer");
045: }
046:
047: public byte[] startSingleTimer(long pPeriod, Serializable info) {
048: TimerService ts = context.getTimerService();
049: throw new EJBException(
050: "startSingleTimer.getTimerService should have failed");
051: }
052:
053: public byte[] startTimer(long pPeriod) {
054: TimerService ts = context.getTimerService();
055: throw new EJBException(
056: "startSingleTimer.getTimerService should have failed");
057: }
058:
059: public byte[] startTimer(long pPeriod, Serializable info) {
060: TimerService ts = context.getTimerService();
061: throw new EJBException(
062: "startSingleTimer.getTimerService should have failed");
063: }
064:
065: public void stopTimer(byte[] handle) {
066: TimerService ts = context.getTimerService();
067: throw new EJBException(
068: "startSingleTimer.getTimerService should have failed");
069: }
070:
071: public int getTimeoutCount(byte[] handle) {
072: return 0;
073: }
074:
075: public Date getNextTimeout(byte[] handle) {
076: return null;
077: }
078:
079: public long getTimeRemaining(byte[] handle) {
080: return 0;
081: }
082:
083: public Object getInfo(byte[] handle) {
084: return null;
085: }
086:
087: public long getRetryTimeoutPeriod() {
088: return 0;
089: }
090:
091: public void ejbCreate() {
092: }
093:
094: public void ejbTimeout(Timer timer) {
095: }
096:
097: public void setSessionContext(SessionContext context) {
098: this .context = context;
099: }
100:
101: public void ejbActivate() {
102: }
103:
104: public void ejbPassivate() {
105: }
106:
107: public void ejbRemove() {
108: }
109:
110: }
|