com.bm.utils.substitues
Class MockedTimerService

java.lang.Object
  extended by com.bm.utils.substitues.MockedTimerService
All Implemented Interfaces:
TimerService

public class MockedTimerService
extends java.lang.Object
implements TimerService

Author:
Daniel Wiese, Marcus Nilsson Date: May 16, 2007 Time: 9:50:53 AM

Constructor Summary
MockedTimerService()
           
 
Method Summary
 Timer createTimer(java.util.Date date, long l, java.io.Serializable serializable)
          Create an interval timer whose first expiration occurs at a given point in time and whose subsequent expirations occur after a specified interval.
 Timer createTimer(java.util.Date date, java.io.Serializable serializable)
          Create a single-action timer that expires at a given point in time.
 Timer createTimer(long l, long l1, java.io.Serializable serializable)
          Create an interval timer whose first expiration occurs after a specified duration, and whose subsequent expirations occur after a specified interval.
 Timer createTimer(long l, java.io.Serializable info)
          Create a single-action timer that expires after a specified duration.
 java.util.Collection getTimers()
          Get all the active timers associated with this bean.
 void injectedIn(java.lang.Object injectectedIn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockedTimerService

public MockedTimerService()
Method Detail

injectedIn

@InjectedIn
public void injectedIn(java.lang.Object injectectedIn)

createTimer

public Timer createTimer(long l,
                         java.io.Serializable info)
                  throws java.lang.IllegalArgumentException,
                         java.lang.IllegalStateException,
                         EJBException
Description copied from interface: TimerService
Create a single-action timer that expires after a specified duration.

Specified by:
createTimer in interface TimerService
Parameters:
l - The number of milliseconds that must elapse before the timer expires.
info - Application information to be delivered along with the timer expiration notification. This can be null.
Returns:
The newly created Timer.
Throws:
java.lang.IllegalArgumentException - If duration is negative
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
EJBException - If this method fails due to a system-level failure.

createTimer

public Timer createTimer(long l,
                         long l1,
                         java.io.Serializable serializable)
                  throws java.lang.IllegalArgumentException,
                         java.lang.IllegalStateException,
                         EJBException
Description copied from interface: TimerService
Create an interval timer whose first expiration occurs after a specified duration, and whose subsequent expirations occur after a specified interval.

Specified by:
createTimer in interface TimerService
Parameters:
l - The number of milliseconds that must elapse before the first timer expiration notification.
l1 - The number of milliseconds that must elapse between timer expiration notifications. Expiration notifications are scheduled relative to the time of the first expiration. If expiration is delayed(e.g. due to the interleaving of other method calls on the bean) two or more expiration notifications may occur in close succession to "catch up".
serializable - Application information to be delivered along with the timer expiration. This can be null.
Returns:
The newly created Timer.
Throws:
java.lang.IllegalArgumentException - If initialDuration is negative, or intervalDuration is negative.
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
EJBException - If this method could not complete due to a system-level failure.

createTimer

public Timer createTimer(java.util.Date date,
                         java.io.Serializable serializable)
                  throws java.lang.IllegalArgumentException,
                         java.lang.IllegalStateException,
                         EJBException
Description copied from interface: TimerService
Create a single-action timer that expires at a given point in time.

Specified by:
createTimer in interface TimerService
Parameters:
date - The point in time at which the timer must expire.
serializable - Application information to be delivered along with the timer expiration notification. This can be null.
Returns:
The newly created Timer.
Throws:
java.lang.IllegalArgumentException - If expiration is null, or expiration.getTime() is negative.
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
EJBException - If this method could not complete due to a system-level failure.

createTimer

public Timer createTimer(java.util.Date date,
                         long l,
                         java.io.Serializable serializable)
                  throws java.lang.IllegalArgumentException,
                         java.lang.IllegalStateException,
                         EJBException
Description copied from interface: TimerService
Create an interval timer whose first expiration occurs at a given point in time and whose subsequent expirations occur after a specified interval.

Specified by:
createTimer in interface TimerService
Parameters:
date - The point in time at which the first timer expiration must occur.
l - The number of milliseconds that must elapse between timer expiration notifications. Expiration notifications are scheduled relative to the time of the first expiration. If expiration is delayed(e.g. due to the interleaving of other method calls on the bean) two or more expiration notifications may occur in close succession to "catch up".
serializable - Application information to be delivered along with the timer expiration. This can be null.
Returns:
The newly created Timer.
Throws:
java.lang.IllegalArgumentException - If initialExpiration is null, or initialExpiration.getTime() is negative, or intervalDuration is negative.
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
EJBException - If this method could not complete due to a system-level failure.

getTimers

public java.util.Collection getTimers()
                               throws java.lang.IllegalStateException,
                                      EJBException
Description copied from interface: TimerService
Get all the active timers associated with this bean.

Specified by:
getTimers in interface TimerService
Returns:
A collection of javax.ejb.Timer objects.
Throws:
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
EJBException - If this method could not complete due to a system-level failure.


Copyright © 2008. All Rights Reserved.