org.rhq.enterprise.server.scheduler.jobs
Class ContentSourceSyncJob

java.lang.Object
  extended by org.rhq.enterprise.server.scheduler.jobs.ContentSourceSyncJob
All Implemented Interfaces:
org.quartz.Job, org.quartz.StatefulJob

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

This is a Quartz scheduler job whose job is to synchronize one particular ContentSource. After synchronizing the metadata, this will also attempt to load the content if the content source is not configured for lazy loading.

This implements StatefulJob (as opposed to Job) because we do not need nor want this job triggered concurrently. That is, we don't need multiple instances of this job running at the same time.

Author:
John Mazzitelli

Constructor Summary
ContentSourceSyncJob()
           
 
Method Summary
static org.quartz.JobDataMap createJobDataMap(ContentSource contentSource, org.quartz.JobDetail details)
          All content source sync jobs must have specified data prepared in their job details data map.
static java.lang.String createJobName(ContentSource cs)
          Creates the name for the scheduled content source's sync job.
static java.lang.String createUniqueJobName(ContentSource cs)
          Creates a unique name for a new content source sync job.
 void execute(org.quartz.JobExecutionContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentSourceSyncJob

public ContentSourceSyncJob()
Method Detail

execute

public void execute(org.quartz.JobExecutionContext context)
             throws org.quartz.JobExecutionException
Specified by:
execute in interface org.quartz.Job
Throws:
org.quartz.JobExecutionException

createJobDataMap

public static org.quartz.JobDataMap createJobDataMap(ContentSource contentSource,
                                                     org.quartz.JobDetail details)
All content source sync jobs must have specified data prepared in their job details data map. This creates that data map. You must call this method everytime you schedule a content source sync job. If the given details is not null, this will place the created data map in the details for you. Otherwise, you must ensure the returned data map gets associated with the job when it is created.

Parameters:
contentSource - the content source whose sync job's details is being prepared
details - where the job's data map will be stored (may be null)
Returns:
the data map with the data necessary to execute a content sync job

createJobName

public static java.lang.String createJobName(ContentSource cs)
Creates the name for the scheduled content source's sync job. Calling this method multiple times with the same content source always produces the same name.

Parameters:
cs - the content source whose scheduled job name is to be returned
Returns:
the scheduled job name for the given content source

createUniqueJobName

public static java.lang.String createUniqueJobName(ContentSource cs)
Creates a unique name for a new content source sync job. Calling this method multiple times with the same content source always produces a different name which is useful if you want to schedule an new job that is separate and distinct from any other job in the system.

Parameters:
cs - the content source
Returns:
a unique job name that can be used for a new job to sync a given content source


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