org.backsource.qcron
Class MBeanJob

java.lang.Object
  extended byorg.backsource.qcron.MBeanJob
All Implemented Interfaces:
org.quartz.Job, java.io.Serializable

public class MBeanJob
extends java.lang.Object
implements org.quartz.Job, java.io.Serializable

A Quartz job that will delegate to an MBean.

Delegation is enforced by saving a the MBeanJob in the JobDataMap of the JJobDetail this is connected to. Since MBeanJobb is a serializable class this wil work even if JobDataMap is saved to peristent store. To make this work one have to create an MBeanJob and set it in the JobDataMap of the JobDetail that should have this job as its executor, eg:

      jobDetail = new JobDetail(name,
                                group,
                                MBeanJob.class
                                );
      MBeanJob job = new MBeanJob( jobDetail.getJobDataMap(),
                                   jobObjectName);

This will the work automagically.

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman
See Also:
Serialized Form

Field Summary
protected  javax.management.ObjectName mbean
           
protected  java.lang.String methodName
           
 
Constructor Summary
MBeanJob()
          Empty constructor when created through Quartz.
MBeanJob(org.quartz.JobDataMap map, javax.management.ObjectName mbean)
          Object name of an MBean implementing the job interface to delegate calls to job to.
MBeanJob(org.quartz.JobDataMap map, javax.management.ObjectName mbean, java.lang.String methodName)
          Delegate to MBean, but invoke method methodName, wich must be a non param method.
 
Method Summary
 void execute(org.quartz.JobExecutionContext context)
          impl of job.
static MBeanJob getMBeanJob(org.quartz.JobDataMap map)
          Get the job from the map.
 javax.management.ObjectName getObjectName()
           
static void setMBeanJob(org.quartz.JobDataMap map, MBeanJob job)
          Set the job in the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mbean

protected javax.management.ObjectName mbean

methodName

protected java.lang.String methodName
Constructor Detail

MBeanJob

public MBeanJob()
Empty constructor when created through Quartz.


MBeanJob

public MBeanJob(org.quartz.JobDataMap map,
                javax.management.ObjectName mbean)
Object name of an MBean implementing the job interface to delegate calls to job to.


MBeanJob

public MBeanJob(org.quartz.JobDataMap map,
                javax.management.ObjectName mbean,
                java.lang.String methodName)
Delegate to MBean, but invoke method methodName, wich must be a non param method.

Method Detail

setMBeanJob

public static void setMBeanJob(org.quartz.JobDataMap map,
                               MBeanJob job)
Set the job in the map.


getMBeanJob

public static MBeanJob getMBeanJob(org.quartz.JobDataMap map)
Get the job from the map.


getObjectName

public javax.management.ObjectName getObjectName()

execute

public void execute(org.quartz.JobExecutionContext context)
             throws org.quartz.JobExecutionException
impl of job.

When Quartz triggers a job a new instance of this class will be created and this method gets called.

Specified by:
execute in interface org.quartz.Job
Throws:
org.quartz.JobExecutionException


Copyright © 2003-2004 Backsource. All Rights Reserved.