org.quartz.simpl
Class SystemPropertyInstanceIdGenerator

java.lang.Object
  extended by org.quartz.simpl.SystemPropertyInstanceIdGenerator
All Implemented Interfaces:
org.quartz.spi.InstanceIdGenerator

public class SystemPropertyInstanceIdGenerator
extends Object
implements org.quartz.spi.InstanceIdGenerator

InstanceIdGenerator that will use a system property to configure the scheduler. The default system property name to use the value of SYSTEM_PROPERTY, but can be specified via the "systemPropertyName" property. You can also set the properties "postpend" and "prepend" to String values that will be added to the beginning or end (respectively) of the value found in the system property. If no value set for the property, a SchedulerException is thrown

Author:
Alex Snaps

Field Summary
static String SYSTEM_PROPERTY
          System property to read the instanceId from
 
Constructor Summary
SystemPropertyInstanceIdGenerator()
           
 
Method Summary
 String generateInstanceId()
          Returns the cluster wide value for this scheduler instance's id, based on a system property
 String getPostpend()
          A String of text to postpend (add to the end) to the instanceId found in the system property.
 String getPrepend()
          A String of text to prepend (add to the beginning) to the instanceId found in the system property.
 String getSystemPropertyName()
          The name of the system property from which to obtain the instanceId.
 void setPostpend(String postpend)
          A String of text to postpend (add to the end) to the instanceId found in the system property.
 void setPrepend(String prepend)
          A String of text to prepend (add to the beginning) to the instanceId found in the system property.
 void setSystemPropertyName(String systemPropertyName)
          The name of the system property from which to obtain the instanceId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_PROPERTY

public static final String SYSTEM_PROPERTY
System property to read the instanceId from

See Also:
Constant Field Values
Constructor Detail

SystemPropertyInstanceIdGenerator

public SystemPropertyInstanceIdGenerator()
Method Detail

generateInstanceId

public String generateInstanceId()
                          throws SchedulerException
Returns the cluster wide value for this scheduler instance's id, based on a system property

Specified by:
generateInstanceId in interface org.quartz.spi.InstanceIdGenerator
Returns:
the value of the system property named by the value of getSystemPropertyName() - which defaults to SYSTEM_PROPERTY.
Throws:
SchedulerException - Shouldn't a value be found

getPrepend

public String getPrepend()
A String of text to prepend (add to the beginning) to the instanceId found in the system property.


setPrepend

public void setPrepend(String prepend)
A String of text to prepend (add to the beginning) to the instanceId found in the system property.

Parameters:
prepend - the value to prepend, or null if none is desired.

getPostpend

public String getPostpend()
A String of text to postpend (add to the end) to the instanceId found in the system property.


setPostpend

public void setPostpend(String postpend)
A String of text to postpend (add to the end) to the instanceId found in the system property.

Parameters:
postpend - the value to postpend, or null if none is desired.

getSystemPropertyName

public String getSystemPropertyName()
The name of the system property from which to obtain the instanceId. Defaults to SYSTEM_PROPERTY.


setSystemPropertyName

public void setSystemPropertyName(String systemPropertyName)
The name of the system property from which to obtain the instanceId. Defaults to SYSTEM_PROPERTY.

Parameters:
systemPropertyName - the system property name


Copyright 2001-2012, Terracotta, Inc.