public class EJBInvokerJob extends Object implements Job
A Job
that invokes a method on an EJB.
Expects the properties corresponding to the following keys to be in the
JobDataMap
when it executes:
EJB_JNDI_NAME_KEY
- the JNDI name (location) of the
EJB's home interface.EJB_METHOD_KEY
- the name of the method to invoke on the
EJB.EJB_ARGS_KEY
- an Object[] of the args to pass to the
method (optional, if left out, there are no arguments).EJB_ARG_TYPES_KEY
- an Class[] of the types of the args to
pass to the method (optional, if left out, the types will be derived by
calling getClass() on each of the arguments).INITIAL_CONTEXT_FACTORY
- the context factory used to
build the context.PROVIDER_URL
- the name of the environment property
for specifying configuration information for the service provider to use.
The result of the EJB method invocation will be available to
Job/TriggerListener
s via
.
JobExecutionContext.getResult()
Modifier and Type | Field and Description |
---|---|
static String |
CREDENTIALS |
static String |
EJB_ARG_TYPES_KEY |
static String |
EJB_ARGS_KEY |
static String |
EJB_JNDI_NAME_KEY |
static String |
EJB_METHOD_KEY |
static String |
INITIAL_CONTEXT_FACTORY |
static String |
PRINCIPAL |
static String |
PROVIDER_URL |
Constructor and Description |
---|
EJBInvokerJob() |
Modifier and Type | Method and Description |
---|---|
void |
execute(JobExecutionContext context)
|
protected InitialContext |
getInitialContext(JobDataMap jobDataMap) |
public static final String EJB_JNDI_NAME_KEY
public static final String EJB_METHOD_KEY
public static final String EJB_ARG_TYPES_KEY
public static final String EJB_ARGS_KEY
public static final String INITIAL_CONTEXT_FACTORY
public static final String PROVIDER_URL
public static final String PRINCIPAL
public static final String CREDENTIALS
public void execute(JobExecutionContext context) throws JobExecutionException
Job
Called by the
when a Scheduler
fires that is associated with the Trigger
Job
.
The implementation may wish to set a
result
object on the
JobExecutionContext
before this method exits. The result itself
is meaningless to Quartz, but may be informative to
or
JobListener
s
that are watching the job's
execution.
TriggerListener
s
execute
in interface Job
JobExecutionException
- if there is an exception while executing the job.protected InitialContext getInitialContext(JobDataMap jobDataMap) throws NamingException
NamingException
Copyright 2001-2019, Terracotta, Inc.