org.rhq.enterprise.server.plugin.pc
Class StatefulJobWrapper

java.lang.Object
  extended by org.rhq.enterprise.server.plugin.pc.StatefulJobWrapper
All Implemented Interfaces:
org.quartz.Job, org.quartz.StatefulJob

public class StatefulJobWrapper
extends java.lang.Object
implements org.quartz.StatefulJob

The actual quartz job that the plugin container will submit when it needs to invoke a scheduled job on behalf of a plugin. This is a "stateful job" which tells quartz that only one job should be invoked at any one time on any server. Note that server plugin developers do not extend this class. Instead, developers need to have their plugin components implement ScheduledJob.

Author:
John Mazzitelli

Field Summary
static java.lang.String DATAMAP_IS_CONCURRENT
          Key to the job data map that indicates if the job is concurrent or not.
static java.lang.String DATAMAP_JOB_CLASS
          Key to the job data map that indicates which plugin component class should be instantiated in order to process the job.
static java.lang.String DATAMAP_JOB_ID
          Key to the job data map that indicates the ID of the job.
static java.lang.String DATAMAP_JOB_METHOD_NAME
          Key to the job data map that indicates which method on the job class should be invoked to run the job.
static java.lang.String DATAMAP_PLUGIN_NAME
          Key to the job data map that indicates the plugin that scheduled the job.
static java.lang.String DATAMAP_PLUGIN_TYPE
          Key to the job data map that indicates the type of plugin that scheduled the job.
static java.lang.String DATAMAP_SCHEDULE_TRIGGER
          Key to the job data map that indicates how the schedule is triggered.
static java.lang.String DATAMAP_SCHEDULE_TYPE
          Key to the job data map that indicates what kind of schedule triggered the job
 
Constructor Summary
StatefulJobWrapper()
           
 
Method Summary
 void execute(org.quartz.JobExecutionContext context)
          This is the method that quartz calls when the schedule has triggered.
protected  java.lang.String logMsg(java.lang.String pluginName, java.lang.Object pluginType, java.lang.String jobId, java.lang.String msg, java.lang.Throwable t)
           
protected  void throwJobExecutionException(java.lang.String pluginName, java.lang.Object pluginType, java.lang.String jobId, java.lang.String errorMsg, java.lang.Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.quartz.Job
execute
 

Field Detail

DATAMAP_PLUGIN_NAME

public static final java.lang.String DATAMAP_PLUGIN_NAME
Key to the job data map that indicates the plugin that scheduled the job.

See Also:
Constant Field Values

DATAMAP_PLUGIN_TYPE

public static final java.lang.String DATAMAP_PLUGIN_TYPE
Key to the job data map that indicates the type of plugin that scheduled the job.

See Also:
Constant Field Values

DATAMAP_JOB_ID

public static final java.lang.String DATAMAP_JOB_ID
Key to the job data map that indicates the ID of the job. This ID is passed to the plugin container when the job was scheduled, see: AbstractTypeServerPluginContainer#scheduleJob(ScheduledJobDefinition, String)

See Also:
Constant Field Values

DATAMAP_JOB_CLASS

public static final java.lang.String DATAMAP_JOB_CLASS
Key to the job data map that indicates which plugin component class should be instantiated in order to process the job. If not specified, the main plugin component instance is used.

See Also:
Constant Field Values

DATAMAP_JOB_METHOD_NAME

public static final java.lang.String DATAMAP_JOB_METHOD_NAME
Key to the job data map that indicates which method on the job class should be invoked to run the job.

See Also:
Constant Field Values

DATAMAP_SCHEDULE_TYPE

public static final java.lang.String DATAMAP_SCHEDULE_TYPE
Key to the job data map that indicates what kind of schedule triggered the job

See Also:
Constant Field Values

DATAMAP_SCHEDULE_TRIGGER

public static final java.lang.String DATAMAP_SCHEDULE_TRIGGER
Key to the job data map that indicates how the schedule is triggered. The value of the trigger datamap entry depends on the type of schedule. For example, a cron schedule type has a schedule trigger that is a cron expression. A periodic schedule type has a schedule trigger that is a time period, in milliseconds.

See Also:
Constant Field Values

DATAMAP_IS_CONCURRENT

public static final java.lang.String DATAMAP_IS_CONCURRENT
Key to the job data map that indicates if the job is concurrent or not. The value does not necessarily mean any currently executing job is concurrently running with another; this just indicates if the job is allowed to run concurrently with another.

See Also:
Constant Field Values
Constructor Detail

StatefulJobWrapper

public StatefulJobWrapper()
Method Detail

execute

public void execute(org.quartz.JobExecutionContext context)
             throws org.quartz.JobExecutionException
This is the method that quartz calls when the schedule has triggered. This method will delegate to the plugin component that is responsible to do work for the plugin.

Specified by:
execute in interface org.quartz.Job
Throws:
org.quartz.JobExecutionException
See Also:
ScheduledJob#execute(String, Properties)

throwJobExecutionException

protected void throwJobExecutionException(java.lang.String pluginName,
                                          java.lang.Object pluginType,
                                          java.lang.String jobId,
                                          java.lang.String errorMsg,
                                          java.lang.Throwable t)
                                   throws org.quartz.JobExecutionException
Throws:
org.quartz.JobExecutionException

logMsg

protected java.lang.String logMsg(java.lang.String pluginName,
                                  java.lang.Object pluginType,
                                  java.lang.String jobId,
                                  java.lang.String msg,
                                  java.lang.Throwable t)


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.