Class JobConfig


  • public class JobConfig
    extends java.lang.Object
    Contains the job parameter values to be supplied to an executing job, and also during validation. This is supplied via the Context object in SchedulableJob.

    Use the various get* and get*List methods to get typed access to the configured parameters. Note that attempting to retrieve the wrong type for a configured parameter will result in a ParameterException or ClassCastException.

    • 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 void addValue​(java.lang.String name, java.lang.String value, java.lang.String type)
      Not meant for public use
      java.lang.Boolean getBoolean​(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.BigDecimal getDecimal​(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.Integer getInt​(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.Long getLong​(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 use
      java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> getRawValues()
      Get all configured parameter values.
      java.lang.String getString​(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 use
      protected void putTestValues​(java.lang.String key, java.util.List<java.lang.Object> values)  
      void reset()
      Not meant for public use
      void setConfigsForExecution​(java.util.List<com.carfey.ops.bean.JobConfigurationBean> configBeans, java.util.List<com.carfey.ops.bean.JobHistoryConfigBean> historyConfigBeans, SchedulableJob job)
      Not meant for public user
      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)
      Not meant for public use
      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)
      Not meant for public user
      void validateGlobalConfigs​(java.util.List<com.carfey.ops.bean.GlobalJobConfigBean> globalConfigs)
      Not meant for public use
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • GLOBAL_SUBSTITUTIONS_PARAM_NAME

        public static final java.lang.String GLOBAL_SUBSTITUTIONS_PARAM_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • JobConfig

        public JobConfig()
        Not meant for public use
    • 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,
                                           ValidationException
        Not meant for public user
        Parameters:
        configBeans - job config
        historyConfigBeans - job history config
        job - job instance
        Throws:
        ParameterException - error related to parameters
        com.carfey.jdk.db.Database.DBException - any type of database error
        ValidationException - 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,
                                          ValidationException
        Not meant for public user
        Parameters:
        configBeans - job config
        historyConfigBeans - job history config
        job - job instance
        validationMode - mode to validate
        Throws:
        ParameterException - error related to parameters
        com.carfey.jdk.db.Database.DBException - any type of database error
        ValidationException - 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.DBException
        Not meant for public use
        Parameters:
        configBeans - job config
        historyConfigBeans - job history config
        metadata - job meatdata
        validationMode - mode to validate
        Throws:
        ParameterException - error related to parameters
        com.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.DBException
        Not 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 ParameterException
        Not 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 ParameterException
        Not meant for public use
        Parameters:
        cl - job class
        onExecute - 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 ParameterException
        Not meant for public use
        Parameters:
        name - parameter name
        value - parameter value
        type - 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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 ParameterException
        Get 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