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

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

public class ContentProviderSyncJob
extends 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, Jason Dobies

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

Field Detail

DATAMAP_SYNC_IMPORTED_REPOS

public static final String DATAMAP_SYNC_IMPORTED_REPOS
See Also:
Constant Field Values
Constructor Detail

ContentProviderSyncJob

public ContentProviderSyncJob()
Method Detail

getPercentComplete

public int getPercentComplete()

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(org.rhq.core.domain.content.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 String createJobName(org.rhq.core.domain.content.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 String createUniqueJobName(org.rhq.core.domain.content.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-2012 Red Hat, Inc.. All Rights Reserved.