Package com.carfey.ops.job.config
Class JobConfig
- java.lang.Object
-
- com.carfey.ops.job.config.JobConfig
-
public class JobConfig extends java.lang.ObjectContains the job parameter values to be supplied to an executing job, and also during validation. This is supplied via theContextobject inSchedulableJob.Use the various
get*andget*Listmethods to get typed access to the configured parameters. Note that attempting to retrieve the wrong type for a configured parameter will result in aParameterExceptionorClassCastException.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJobConfig.ParameterValidation
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGLOBAL_SUBSTITUTIONS_PARAM_NAME
-
Constructor Summary
Constructors Constructor Description JobConfig()Not meant for public use
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddValue(java.lang.String name, java.lang.String value, java.lang.String type)Not meant for public usejava.lang.BooleangetBoolean(java.lang.String name)Get a single-valued Boolean parameter.java.util.List<java.lang.Boolean>getBooleanList(java.lang.String name)Get a multi-valued Boolean parameter.java.lang.Class<?>getClass(java.lang.String name)Get a single-valued Class parameter.java.util.List<java.lang.Class>getClassList(java.lang.String name)Get a multi-valued Class parameter.java.math.BigDecimalgetDecimal(java.lang.String name)Get a single-valued BigDecimal parameter.java.util.List<java.math.BigDecimal>getDecimalList(java.lang.String name)Get a multi-valued BigDecimal parameter.java.lang.IntegergetInt(java.lang.String name)Get a single-valued Integer parameter.java.util.List<java.lang.Integer>getIntList(java.lang.String name)Get a multi-valued Integer parameter.java.lang.LonggetLong(java.lang.String name)Get a single-valued Long parameter.java.util.List<java.lang.Long>getLongList(java.lang.String name)Get a multi-valued Long parameter.static java.util.Map<java.lang.String,com.carfey.ops.job.param.DefinedParameter>getParamDefs(java.lang.Class<?> cl, boolean onExecute)Not meant for public usejava.util.Map<java.lang.String,java.util.List<java.lang.Object>>getRawValues()Get all configured parameter values.java.lang.StringgetString(java.lang.String name)Get a single-valued String parameter.java.util.List<java.lang.String>getStringList(java.lang.String name)Get a multi-valued String parameter.protected java.util.List<com.carfey.ops.bean.GlobalJobConfigBean>loadGlobalConfig()Not meant for public useprotected voidputTestValues(java.lang.String key, java.util.List<java.lang.Object> values)voidreset()Not meant for public usevoidsetConfigsForExecution(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, SchedulableJob job)Not meant for public uservoidsetConfigsForMetadata(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, com.carfey.ops.job.param.JobMetadata metadata, JobConfig.ParameterValidation validationMode)Not meant for public usevoidsetConfigsForMetadata(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, SchedulableJob job, JobConfig.ParameterValidation validationMode)Not meant for public uservoidvalidateGlobalConfigs(java.util.List<com.carfey.ops.bean.GlobalJobConfigBean> globalConfigs)Not meant for public use
-
-
-
Field Detail
-
GLOBAL_SUBSTITUTIONS_PARAM_NAME
public static final java.lang.String GLOBAL_SUBSTITUTIONS_PARAM_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
putTestValues
protected void putTestValues(java.lang.String key, java.util.List<java.lang.Object> values)
-
setConfigsForExecution
public void setConfigsForExecution(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, SchedulableJob job) throws ParameterException, com.carfey.jdk.db.Database.DBException, ValidationExceptionNot meant for public user- Parameters:
configBeans- job confighistoryConfigBeans- job history configjob- job instance- Throws:
ParameterException- error related to parameterscom.carfey.jdk.db.Database.DBException- any type of database errorValidationException- validation error for config
-
setConfigsForMetadata
public void setConfigsForMetadata(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, SchedulableJob job, JobConfig.ParameterValidation validationMode) throws ParameterException, com.carfey.jdk.db.Database.DBException, ValidationExceptionNot meant for public user- Parameters:
configBeans- job confighistoryConfigBeans- job history configjob- job instancevalidationMode- mode to validate- Throws:
ParameterException- error related to parameterscom.carfey.jdk.db.Database.DBException- any type of database errorValidationException- validation error for config
-
setConfigsForMetadata
public void setConfigsForMetadata(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, com.carfey.ops.job.param.JobMetadata metadata, JobConfig.ParameterValidation validationMode) throws ParameterException, com.carfey.jdk.db.Database.DBExceptionNot meant for public use- Parameters:
configBeans- job confighistoryConfigBeans- job history configmetadata- job meatdatavalidationMode- mode to validate- Throws:
ParameterException- error related to parameterscom.carfey.jdk.db.Database.DBException- any type of database error
-
loadGlobalConfig
protected java.util.List<com.carfey.ops.bean.GlobalJobConfigBean> loadGlobalConfig() throws com.carfey.jdk.db.Database.DBExceptionNot meant for public use- Returns:
- all global configs
- Throws:
com.carfey.jdk.db.Database.DBException- any type of database eror
-
validateGlobalConfigs
public void validateGlobalConfigs(java.util.List<com.carfey.ops.bean.GlobalJobConfigBean> globalConfigs) throws ParameterExceptionNot meant for public use- Parameters:
globalConfigs- global configuration- Throws:
ParameterException- an error validating the config
-
reset
public void reset()
Not meant for public use
-
getParamDefs
public static java.util.Map<java.lang.String,com.carfey.ops.job.param.DefinedParameter> getParamDefs(java.lang.Class<?> cl, boolean onExecute) throws ParameterExceptionNot meant for public use- Parameters:
cl- job classonExecute- whether this call is for execution- Returns:
- map of defined names to defined parameters
- Throws:
ParameterException- error generating parameters
-
addValue
protected void addValue(java.lang.String name, java.lang.String value, java.lang.String type) throws ParameterExceptionNot meant for public use- Parameters:
name- parameter namevalue- parameter valuetype- Java class name- Throws:
ParameterException- an error adding the parameter
-
getRawValues
public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> getRawValues()
Get all configured parameter values.- Returns:
- an unmodifiable map of parameter names to typed values.
-
getString
public java.lang.String getString(java.lang.String name) throws ParameterExceptionGet a single-valued String parameter.- Parameters:
name- parameter name- Returns:
- the single configured value, or null if not found.
- Throws:
ParameterException- if more than one value found.java.lang.ClassCastException- if the value does not match the requested type
-
getInt
public java.lang.Integer getInt(java.lang.String name) throws ParameterExceptionGet a single-valued Integer parameter.- Parameters:
name- parameter name- Returns:
- the single configured value, or null if not found.
- Throws:
ParameterException- if more than one value found.java.lang.ClassCastException- if the value does not match the requested type
-
getLong
public java.lang.Long getLong(java.lang.String name) throws ParameterExceptionGet a single-valued Long parameter.- Parameters:
name- parameter name- Returns:
- the single configured value, or null if not found.
- Throws:
ParameterException- if more than one value found.java.lang.ClassCastException- if the value does not match the requested type
-
getDecimal
public java.math.BigDecimal getDecimal(java.lang.String name) throws ParameterExceptionGet a single-valued BigDecimal parameter.- Parameters:
name- parameter name- Returns:
- the single configured value, or null if not found.
- Throws:
ParameterException- if more than one value found.java.lang.ClassCastException- if the value does not match the requested type
-
getBoolean
public java.lang.Boolean getBoolean(java.lang.String name) throws ParameterExceptionGet a single-valued Boolean parameter.- Parameters:
name- parameter name- Returns:
- the single configured value, or null if not found.
- Throws:
ParameterException- if more than one value found.java.lang.ClassCastException- if the value does not match the requested type.
-
getClass
public java.lang.Class<?> getClass(java.lang.String name) throws ParameterExceptionGet a single-valued Class parameter.- Parameters:
name- parameter name- Returns:
- the single configured value, or null if not found.
- Throws:
ParameterException- if more than one value found.java.lang.ClassCastException- if the value does not match the requested type.
-
getClassList
public java.util.List<java.lang.Class> getClassList(java.lang.String name) throws ParameterExceptionGet a multi-valued Class parameter.- Parameters:
name- parameter name- Returns:
- the configured values, or empty list if not found.
- Throws:
ParameterException- if the values do not match the requested type
-
getStringList
public java.util.List<java.lang.String> getStringList(java.lang.String name) throws ParameterExceptionGet a multi-valued String parameter.- Parameters:
name- parameter name- Returns:
- the configured values, or empty list if not found.
- Throws:
ParameterException- if the values do not match the requested type
-
getIntList
public java.util.List<java.lang.Integer> getIntList(java.lang.String name) throws ParameterExceptionGet a multi-valued Integer parameter.- Parameters:
name- parameter name- Returns:
- the configured values, or empty list if not found.
- Throws:
ParameterException- if the values do not match the requested type
-
getLongList
public java.util.List<java.lang.Long> getLongList(java.lang.String name) throws ParameterExceptionGet a multi-valued Long parameter.- Parameters:
name- parameter name- Returns:
- the configured values, or empty list if not found.
- Throws:
ParameterException- if the values do not match the requested type
-
getDecimalList
public java.util.List<java.math.BigDecimal> getDecimalList(java.lang.String name) throws ParameterExceptionGet a multi-valued BigDecimal parameter.- Parameters:
name- parameter name- Returns:
- the configured values, or empty list if not found.
- Throws:
ParameterException- if the values do not match the requested type
-
getBooleanList
public java.util.List<java.lang.Boolean> getBooleanList(java.lang.String name) throws ParameterExceptionGet a multi-valued Boolean parameter.- Parameters:
name- parameter name- Returns:
- the configured values, or empty list if not found.
- Throws:
ParameterException- if the values do not match the requested type
-
-