org.apache.camel.component.quartz
Class QuartzComponent

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.impl.DefaultComponent
          extended by org.apache.camel.component.quartz.QuartzComponent
All Implemented Interfaces:
CamelContextAware, Component, Service, ShutdownableService, StartupListener

public class QuartzComponent
extends DefaultComponent
implements StartupListener

A Quartz Component

For a brief tutorial on setting cron expression see Quartz cron tutorial.

Version:

Constructor Summary
QuartzComponent()
           
QuartzComponent(CamelContext context)
           
 
Method Summary
 void addJob(org.quartz.JobDetail job, org.quartz.Trigger trigger)
           
protected  org.quartz.CronTrigger createCronTrigger(String path)
           
protected  QuartzEndpoint createEndpoint(String uri, String remaining, Map<String,Object> parameters)
          A factory method allowing derived components to create a new endpoint from the given URI, remaining path and optional parameters
protected  org.quartz.Scheduler createScheduler()
           
protected  org.quartz.SchedulerFactory createSchedulerFactory()
           
 void deleteJob(String name, String group)
           
protected  void doStart()
           
protected  void doStop()
           
 org.quartz.SchedulerFactory getFactory()
           
 Properties getProperties()
           
 String getPropertiesFile()
           
 org.quartz.Scheduler getScheduler()
           
 int getStartDelayedSeconds()
           
 boolean isAutoStartScheduler()
           
 boolean isClustered()
          Is the quartz scheduler clustered?
protected  Properties loadProperties()
           
 void onCamelContextStarted(CamelContext camelContext, boolean alreadyStarted)
          Callback invoked when the CamelContext has just been started.
 void pauseJob(org.quartz.Trigger trigger)
           
 void setAutoStartScheduler(boolean autoStartScheduler)
           
 void setFactory(org.quartz.SchedulerFactory factory)
           
 void setProperties(Properties properties)
           
 void setPropertiesFile(String propertiesFile)
           
 void setScheduler(org.quartz.Scheduler scheduler)
           
 void setStartDelayedSeconds(int startDelayedSeconds)
           
 void shutdownScheduler()
          To force shutdown the quartz scheduler
 void startScheduler()
          To force starting the quartz scheduler
 
Methods inherited from class org.apache.camel.impl.DefaultComponent
afterConfiguration, createEndpoint, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, ifStartsWithReturnRemainder, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, setCamelContext, setProperties, useIntrospectionOnEndpoint, validateParameters, validateURI
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuartzComponent

public QuartzComponent()

QuartzComponent

public QuartzComponent(CamelContext context)
Method Detail

createEndpoint

protected QuartzEndpoint createEndpoint(String uri,
                                        String remaining,
                                        Map<String,Object> parameters)
                                 throws Exception
Description copied from class: DefaultComponent
A factory method allowing derived components to create a new endpoint from the given URI, remaining path and optional parameters

Specified by:
createEndpoint in class DefaultComponent
Parameters:
uri - the full URI of the endpoint
remaining - the remaining part of the URI without the query parameters or component prefix
parameters - the optional parameters passed in
Returns:
a newly created endpoint or null if the endpoint cannot be created based on the inputs
Throws:
Exception

createCronTrigger

protected org.quartz.CronTrigger createCronTrigger(String path)
                                            throws ParseException
Throws:
ParseException

onCamelContextStarted

public void onCamelContextStarted(CamelContext camelContext,
                                  boolean alreadyStarted)
                           throws Exception
Description copied from interface: StartupListener
Callback invoked when the CamelContext has just been started.

Specified by:
onCamelContextStarted in interface StartupListener
Parameters:
camelContext - the Camel context
alreadyStarted - whether or not the CamelContext already has been started. For example the context could already have been started, and then a service is added/started later which still triggers this callback to be invoked.
Throws:
Exception - can be thrown in case of errors to fail the startup process and have the application fail on startup.

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class DefaultComponent
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class DefaultComponent
Throws:
Exception

addJob

public void addJob(org.quartz.JobDetail job,
                   org.quartz.Trigger trigger)
            throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

pauseJob

public void pauseJob(org.quartz.Trigger trigger)
              throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

deleteJob

public void deleteJob(String name,
                      String group)
               throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

shutdownScheduler

public void shutdownScheduler()
                       throws org.quartz.SchedulerException
To force shutdown the quartz scheduler

Throws:
org.quartz.SchedulerException - can be thrown if error shutting down

isClustered

public boolean isClustered()
                    throws org.quartz.SchedulerException
Is the quartz scheduler clustered?

Throws:
org.quartz.SchedulerException

startScheduler

public void startScheduler()
                    throws org.quartz.SchedulerException
To force starting the quartz scheduler

Throws:
org.quartz.SchedulerException - can be thrown if error starting

getFactory

public org.quartz.SchedulerFactory getFactory()
                                       throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

setFactory

public void setFactory(org.quartz.SchedulerFactory factory)

getScheduler

public org.quartz.Scheduler getScheduler()
                                  throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

setScheduler

public void setScheduler(org.quartz.Scheduler scheduler)

getProperties

public Properties getProperties()

setProperties

public void setProperties(Properties properties)

getPropertiesFile

public String getPropertiesFile()

setPropertiesFile

public void setPropertiesFile(String propertiesFile)

getStartDelayedSeconds

public int getStartDelayedSeconds()

setStartDelayedSeconds

public void setStartDelayedSeconds(int startDelayedSeconds)

isAutoStartScheduler

public boolean isAutoStartScheduler()

setAutoStartScheduler

public void setAutoStartScheduler(boolean autoStartScheduler)

loadProperties

protected Properties loadProperties()
                             throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

createSchedulerFactory

protected org.quartz.SchedulerFactory createSchedulerFactory()
                                                      throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException

createScheduler

protected org.quartz.Scheduler createScheduler()
                                        throws org.quartz.SchedulerException
Throws:
org.quartz.SchedulerException


Apache CAMEL