net.sf.xworkquartz.dispatcher
Class QuartzDispatcher

java.lang.Object
  extended bynet.sf.xworkquartz.dispatcher.QuartzDispatcher
All Implemented Interfaces:
Job, QuartzStatics
Direct Known Subclasses:
DataMapQuartzDispatcher, NameQuartzDispatcher

public abstract class QuartzDispatcher
extends java.lang.Object
implements Job, QuartzStatics

This class holds the main dispatcher routines used to run XWork actions within Quartz. There are several subclasses of QuartzDispatcher which come with this package and implement different action name/namespace lookup strategies:

In order to implement your own lookup strategy simply subclass QuartzDispatcher and implement the missing methods.

Version:
$Id: QuartzDispatcher.java,v 1.3 2004/07/02 19:42:54 stephanmueller Exp $
Author:
Stephan Mueller
See Also:
ASMJobClassGenerator, NameQuartzDispatcher, DataMapQuartzDispatcher

Field Summary
static java.lang.String COMPONENT_MANAGER
          Constant for the XWork component manager.
protected static org.apache.commons.logging.Log log
          Logger for this class.
 
Fields inherited from interface net.sf.xworkquartz.QuartzStatics
JOB_CONTEXT
 
Constructor Summary
QuartzDispatcher()
           
 
Method Summary
 java.util.Map createContextMap(java.util.Map executionMap, java.util.Map parameterMap, java.util.Map schedulerMap, JobExecutionContext context)
          Merges all scheduler and job attributes into a single Map to represent the entire Action context.
 void execute(JobExecutionContext jobCtx)
           
 void executeAction(java.lang.String namespace, java.lang.String actionName, JobExecutionContext ctx)
          Executes the XWork action specified by namespace and name.
abstract  java.lang.String getActionName(JobExecutionContext ctx)
          Implement this method in order to provide your own action name lookup strategy.
abstract  java.lang.String getActionNamespace(JobExecutionContext ctx)
          Implement this method in order to provide your own action namespace lookup strategy.
protected  java.util.Map getExecutionMap(JobExecutionContext context)
          Returns a Map of all execution attributes.
protected  java.util.Map getParameters(JobExecutionContext context)
          Returns a Map of all execution parameters.
protected  java.util.Map getSchedulerMap(JobExecutionContext context)
          Returns a Map of all scheduler attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Logger for this class.


COMPONENT_MANAGER

public static final java.lang.String COMPONENT_MANAGER
Constant for the XWork component manager. TODO: see XW-195

See Also:
Constant Field Values
Constructor Detail

QuartzDispatcher

public QuartzDispatcher()
Method Detail

execute

public final void execute(JobExecutionContext jobCtx)
                   throws JobExecutionException
Specified by:
execute in interface Job
Throws:
JobExecutionException
See Also:
Job.execute(org.quartz.JobExecutionContext)

getActionName

public abstract java.lang.String getActionName(JobExecutionContext ctx)
Implement this method in order to provide your own action name lookup strategy.

Parameters:
ctx - a JobExecutionContext
Returns:
an action namespace

getActionNamespace

public abstract java.lang.String getActionNamespace(JobExecutionContext ctx)
Implement this method in order to provide your own action namespace lookup strategy.

Parameters:
ctx - a JobExecutionContext
Returns:
an action namespace

createContextMap

public java.util.Map createContextMap(java.util.Map executionMap,
                                      java.util.Map parameterMap,
                                      java.util.Map schedulerMap,
                                      JobExecutionContext context)
Merges all scheduler and job attributes into a single Map to represent the entire Action context.

Parameters:
executionMap - a Map of all execution attributes.
parameterMap - a Map of all execution parameters.
schedulerMap - a Map of all scheduler attributes.
context - a JobExecutionContext object.
Returns:
a Map representing the Action context.

executeAction

public void executeAction(java.lang.String namespace,
                          java.lang.String actionName,
                          JobExecutionContext ctx)
Executes the XWork action specified by namespace and name.

Parameters:
namespace - the namespace of an action
actionName - the name of the action
ctx - a JobExecutionContext

getParameters

protected java.util.Map getParameters(JobExecutionContext context)
Returns a Map of all execution parameters. The default implementation just calls JobDetail.getJobDataMap(). Override this method to customize how execution parameters are mapped.

Parameters:
context - a JobExecutionContext object.
Returns:
a Map of all execution parameters.

getSchedulerMap

protected java.util.Map getSchedulerMap(JobExecutionContext context)
Returns a Map of all scheduler attributes. The default implementation just calls Scheduler.getContext(). Override this method to customize how scheduler attributes are mapped.

Parameters:
context - a JobExecutionContext object.
Returns:
a Map of all scheduler attributes.

getExecutionMap

protected java.util.Map getExecutionMap(JobExecutionContext context)
Returns a Map of all execution attributes. Override this method to customize how execution attributes are mapped.

Parameters:
context - a JobExecutionContext object.
Returns:
a Map of all execution attributes.

XWork-Quartz Project Page