com.sap.scheduler.runtime

Class JobDefinition

java.lang.Object
  extended by com.sap.scheduler.runtime.JobDefinition
All Implemented Interfaces:
Serializable

public final class JobDefinition
extends Object
implements Serializable

This abstract class represents the job meta information for jobs which have been deployed. Information represented by instances of this class are taken from the deployment descriptor and the JobDefinition.xml file. Instances of this class are provided by the scheduler. Applications cannot change this object in the scheduler.

Note: Although there are a constructor with no arguments and public set methods, these methods should not be used. This class is designed to be XML serializable/deserializable. Instances of these class are asumed to be immutable and once a field is initialized it cannot be changed. An attempt to invoke the setter for a given attribute would result in an IllegalStateException.

See Also:
Serialized Form

Field Summary
static int DEFAULT_RETENTION_PERIOD
          This constant represents the default retention period if no value is specified.
static int INFINITE_RETENTION_PERIOD
          This constant represents the value for an infinite retention period.
 
Constructor Summary
JobDefinition()
          Deprecated. Please use #JobDefinition(JobDefinitionID, JobDefinitionName, String, JobParameterDefinition[], int, int, Date, String[][], Map)
JobDefinition(JobDefinitionID id, JobDefinitionName name, String description, JobParameterDefinition[] parameters, int retentionPeriod, int jobDefinitionType, Date removeDate, String[][] properties, HashMap<String,HashMap<String,String>> localizedTextMap)
          Creates a new instance of JobDefinition.
JobDefinition(JobDefinitionID id, String name, String description, JobParameterDefinition[] parameters, int retentionPeriod, int jobDefinitionType, Date removeDate, String[][] properties, String application, HashMap<String,HashMap<String,String>> localizedTextMap)
          Deprecated. Please use #JobDefinition(JobDefinitionID, JobDefinitionName, String, JobParameterDefinition[], int, int, Date, String[][], Map)
 
Method Summary
 String getApplication()
           
 String getDescription()
          Obtains a text description of this job definition
 JobDefinitionID getJobDefinitionId()
          Obtains the id of this job definition.
 JobDefinitionName getJobDefinitionName()
          This method returns the JobDefinitionName object which represents the name of this job definition.
 int getJobType()
          This method returns an int representing the type of this job.
 HashMap<String,HashMap<String,String>> getLocalizationInfoMap()
          Returns the localization info for this parameter.
 String getLocalizedDescription()
          Returns the localized description depending on the current system locale, if not available, the default description deployed with this job will be returned.
 String getLocalizedDescription(Locale l)
          Returns the localized description depending on the provided locale if available, otherwise the default description deployed with this job will be returned.
 String getLocalizedName()
          Returns the localized name depending on the current system locale.
 String getLocalizedName(Locale l)
          Returns the localized name depending on the provided locale if available, otherwise the default name deployed with this job will be returned.
 String getName()
          Deprecated. Use getJobDefinitionName.getName() instead
 JobParameterDefinition getParameter(String name)
          This method returns the job parameter definition for the specified parameter.
 JobParameterDefinition[] getParameters()
          This method returns the array of parameter definitions for this job definition.
 String[][] getProperties()
          Obtains all properties currently stored in this instance.
 Date getRemoveDate()
           
 int getRetentionPeriod()
          Obtains the retention period in days.
 String putProperty(String name, String value)
          Puts a property in the list of properties belonging to this instance.
 String readProperty(String name)
          Queries a property from the current instance.
 void setDescription(String description)
          Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accipting a description argument.
 void setJobDefinitionId(JobDefinitionID id)
          Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor acceptiong JobDefintionID argument.
 void setJobType(int jobDefinitionType)
          Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accipting a parameters argument.
 void setLocalizationInfoMap(HashMap<String,HashMap<String,String>> localizedTextMap)
          Deprecated. use constructor instead
 void setName(String name)
          Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accepting a JobDefinitionName argument.
 void setParameters(JobParameterDefinition[] parameters)
          Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accepting a parameters argument.
 void setProperties(String[][] properties)
          Deprecated. - intended to be used only by XML Seriliazliation/deserialization framework. Instead of this method use the putProperty(String, String) method
 void setRetentionPeriod(int days)
          Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accepting a parameters argument.
 String toString()
          Obtains a string representation of this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITE_RETENTION_PERIOD

public static final int INFINITE_RETENTION_PERIOD
This constant represents the value for an infinite retention period.

See Also:
Constant Field Values

DEFAULT_RETENTION_PERIOD

public static final int DEFAULT_RETENTION_PERIOD
This constant represents the default retention period if no value is specified. It means the jobs are kept persistent for 4 weekends and the 3 weeks in between (23 days).

See Also:
Constant Field Values
Constructor Detail

JobDefinition

public JobDefinition(JobDefinitionID id,
                     String name,
                     String description,
                     JobParameterDefinition[] parameters,
                     int retentionPeriod,
                     int jobDefinitionType,
                     Date removeDate,
                     String[][] properties,
                     String application,
                     HashMap<String,HashMap<String,String>> localizedTextMap)
Deprecated. Please use #JobDefinition(JobDefinitionID, JobDefinitionName, String, JobParameterDefinition[], int, int, Date, String[][], Map)


JobDefinition

public JobDefinition(JobDefinitionID id,
                     JobDefinitionName name,
                     String description,
                     JobParameterDefinition[] parameters,
                     int retentionPeriod,
                     int jobDefinitionType,
                     Date removeDate,
                     String[][] properties,
                     HashMap<String,HashMap<String,String>> localizedTextMap)
Creates a new instance of JobDefinition. An object created with this constructor is considered to be completely initialized and values of its properties cannot be changed with call to any of the set methods.

Parameters:
id - the id of this job definition object. This parameter cannot be null.
name - the name of this job definition. It must not be null.
description - description of the job. This could be also null. If description is null then the job definition is considered to have no description.
parameters - an array of job parameter definitions. This parameter must not be null. If a instances of this job definition takes no parameters than an empty array must be passed.
retentionPeriod - the period for which the logs of individual job instance are kept. Afte this period has expired the logs are removed. Its values are in days measurement units.
jobDefinitionType - an integer signifying the job defintion type. It's values are enumerated by JobDefinitionTyp class.
removeDate - the date when the job which is represented by this metadata has been removed. This can be null if the job is still deployed.
properties - a list of additional properties for this job.
localizedTextMap - localization information for this job.
Throws:
NullPointerException - thrown if id, name, or parameters is null.
IllegalArgumentException - thrown if the value of jobDefinitionType does not corresponds to a valid job definition as defined in JobDefinitionType

JobDefinition

public JobDefinition()
Deprecated. Please use #JobDefinition(JobDefinitionID, JobDefinitionName, String, JobParameterDefinition[], int, int, Date, String[][], Map)

Method Detail

setLocalizationInfoMap

public void setLocalizationInfoMap(HashMap<String,HashMap<String,String>> localizedTextMap)
Deprecated. use constructor instead

Sets the localization info fpr this parameter

Parameters:
the - localization info

getLocalizationInfoMap

public HashMap<String,HashMap<String,String>> getLocalizationInfoMap()
Returns the localization info for this parameter.

Note: This method should be used only by the Scheduler runtime.

Returns:
the localization info

readProperty

public String readProperty(String name)
Queries a property from the current instance. The property name search is done with linear complexity. The search is not casensitive so quering for property with name "EXAMPLENAME" and "exampblename" would yield the same result.

Parameters:
name - - a property name whose value should be found. This parameter can be null.
Returns:
the value of the property name. Null if no property with this name is found.

putProperty

public String putProperty(String name,
                          String value)
Puts a property in the list of properties belonging to this instance. If a property with the same name already exists it is overriden. Letter capitalization is not taken into care so if a name equals "EXAMPLENAME" but a property with name "examplename" exists the value will be overriden.

Parameters:
name - name of the property to be put. This cannot be null nor it could be the empty string
value - the value of the property.
Returns:
the old value associated with this name. Null if no property with this name is found.

getProperties

public String[][] getProperties()
Obtains all properties currently stored in this instance. Each row of the returned array represents a single property. The first column is the property's name and the second is the property's value. I.e. getProperties[2][0] would yield the name of the 3 property and the expression getProperties[2][1] would yield the value of the 3 property. The lenght of the returned array could not be used to accurately determine the number of properties currently stored in this instance.

Returns:
The list of properties stored in this instance. The return value cannot not be null.

setProperties

public void setProperties(String[][] properties)
Deprecated. - intended to be used only by XML Seriliazliation/deserialization framework. Instead of this method use the putProperty(String, String) method

Throws:
IllegalStateException - - thrown if properties field is already initialized.

getJobDefinitionId

public JobDefinitionID getJobDefinitionId()
Obtains the id of this job definition.

Returns:
the id of this job definition
Throws:
IllegalStateException - - if job id is not initialized

setJobDefinitionId

public void setJobDefinitionId(JobDefinitionID id)
Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor acceptiong JobDefintionID argument.

Parameters:
id - - the id of this job definition

getDescription

public String getDescription()
Obtains a text description of this job definition

Returns:
the description of this job the description. Null if the job definition has no description

setDescription

public void setDescription(String description)
Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accipting a description argument.

Parameters:
description - The description to set.

getName

public String getName()
Deprecated. Use getJobDefinitionName.getName() instead

Returns:
the name of this job definition. The return value cannot be null.
Throws:
IllegalStateException - - if this instance has not yet been initialized

getJobDefinitionName

public JobDefinitionName getJobDefinitionName()
This method returns the JobDefinitionName object which represents the name of this job definition.

Returns:
the name object

setName

public void setName(String name)
Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accepting a JobDefinitionName argument.

Parameters:
name - - the name to set.

getParameters

public JobParameterDefinition[] getParameters()
This method returns the array of parameter definitions for this job definition.

Returns:
possibly empty array of parameters
Throws:
IllegalStateException - - if this instance has not been initialized yet.

getParameter

public JobParameterDefinition getParameter(String name)
This method returns the job parameter definition for the specified parameter.

Parameters:
name - name of the parameter
Returns:
a JobParameterDefinition object or null if there is no such parameter
Throws:
NullPointerException - if name is null

setParameters

public void setParameters(JobParameterDefinition[] parameters)
Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accepting a parameters argument.

Sets the list of parameter definitions for this job.

Parameters:
parameters - The parameters to set.

setRetentionPeriod

public void setRetentionPeriod(int days)
Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accepting a parameters argument.

Set the retention period in days

Parameters:
days - retention period for this job

getRetentionPeriod

public int getRetentionPeriod()
Obtains the retention period in days.

Returns:
the retention period in days. The value INFINITE_RETENTION_PERIOD means that instances of this job definition will not deleted.

getJobType

public int getJobType()
This method returns an int representing the type of this job.

Returns:
an int representing the type of this job
Throws:
IllegalStateException - - if this instance has not been initialized yet.

getApplication

public String getApplication()

getRemoveDate

public Date getRemoveDate()

setJobType

public void setJobType(int jobDefinitionType)
Deprecated. - used only for XML Serialization/Deserialization. Instead of using this method use a constructor accipting a parameters argument.


toString

public String toString()
Obtains a string representation of this instance. The string representation contains all attributes including the properties. The returned string delimits each attribute by a new line character. Each property is also represented as a name=value string, where the seprate properties are again delimited by new line character. Each parameter is delimited from the rest again with a new line character.

Overrides:
toString in class Object
Returns:
the string representation of this object.

getLocalizedName

public String getLocalizedName()
Returns the localized name depending on the current system locale. If not available, the default name deployed with this job will be returned.

Returns:
the localized name

getLocalizedName

public String getLocalizedName(Locale l)
Returns the localized name depending on the provided locale if available, otherwise the default name deployed with this job will be returned.

Parameters:
l - the locale
Returns:
the localized String if available, otherwise the default name

getLocalizedDescription

public String getLocalizedDescription()
Returns the localized description depending on the current system locale, if not available, the default description deployed with this job will be returned.

Returns:
the localized description

getLocalizedDescription

public String getLocalizedDescription(Locale l)
Returns the localized description depending on the provided locale if available, otherwise the default description deployed with this job will be returned.

Parameters:
l - the locale
Returns:
the localized String if available, otherwise the default description


Copyright 2009 SAP AG Complete Copyright Notice