org.jboss.seam.cron.spi.scheduling.trigger
Class ProviderContextTriggerSupport<T>

java.lang.Object
  extended by org.jboss.seam.cron.spi.scheduling.trigger.TriggerSupport
      extended by org.jboss.seam.cron.spi.scheduling.trigger.ProviderContextTriggerSupport<T>

public abstract class ProviderContextTriggerSupport<T>
extends TriggerSupport

Base class allowing scheduling providers to easily fire the appropriate CDI event when required. As opposed to {#@link TriggerSupport}, this class is useful when you cannot pass the objects necessary for firing the appropriate event (represented by #TriggerSupplies) directly into the worker when the schedule is first registered (see #CronSchedulingProvider). Instead some providers need to copy the #TriggerSupplies into some other context, and retrieve them back from that context when the worker is executed. This part is done inside the #fetchTriggerSupplies method.

See #TriggerJob in providers/scheduling/quartz for an example of this.

Author:
Peter Royle
See Also:
TriggerSupport

Field Summary
 
Fields inherited from class org.jboss.seam.cron.spi.scheduling.trigger.TriggerSupport
gc, supplies, value
 
Constructor Summary
ProviderContextTriggerSupport()
           
 
Method Summary
abstract  TriggerSupplies fetchTriggerSupplies(T providerContext)
          Since scheduled jobs are typically outside the CDI context, the scheduling provider will be responsible for stashing the objects required by $ProviderContextTriggerSupport to fire the appropriate event, and looking them up in this method's implementation using their own context.
 void fireTrigger(T providerContext)
          Fires the appropriate trigger payload with the appropriate qualifier (to in turn execute the application-specific code that observes those events).
 
Methods inherited from class org.jboss.seam.cron.spi.scheduling.trigger.TriggerSupport
createHourEventPayload, createMinuteEventPayload, createScheduledEventPayload, createSecondEventPayload, fireTrigger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProviderContextTriggerSupport

public ProviderContextTriggerSupport()
Method Detail

fetchTriggerSupplies

public abstract TriggerSupplies fetchTriggerSupplies(T providerContext)
Since scheduled jobs are typically outside the CDI context, the scheduling provider will be responsible for stashing the objects required by $ProviderContextTriggerSupport to fire the appropriate event, and looking them up in this method's implementation using their own context.

Parameters:
providerContext - Some context provided by the underlying scheduling engine.
Returns:
a new #TriggerSupplies instance.

fireTrigger

public void fireTrigger(T providerContext)
Fires the appropriate trigger payload with the appropriate qualifier (to in turn execute the application-specific code that observes those events).

Parameters:
providerContext - Some context provided by the underlying scheduling engine.


Copyright © 2011 Seam Framework. All Rights Reserved.