Class JobAgentSettings

  • All Implemented Interfaces:
    AccessControlled, Identifiable

    public class JobAgentSettings
    extends ChildItem
    This class contains a job agent's settings for a specific plugin. The settings may override the default settings for the JAR path where to plugin is located, maximum memory to use, and if the plugin is trusted or not.
    Version:
    2.0
    Author:
    nicklas
    Last modified
    $Date: 2015-04-17 14:02:22 +0200 (fr, 17 apr 2015) $
    • Field Detail

      • RUNTIME_FILTER

        private static final QueryRuntimeFilter RUNTIME_FILTER
        This filter will only return items if the logged in user has generic read permission to job agents.
    • Method Detail

      • getNew

        static JobAgentSettings getNew​(DbControl dc,
                                       JobAgent agent,
                                       PluginDefinition plugin)
        Create a new JobAgentSettings item.
        Parameters:
        dc - The DbControl which will be used for permission checking and database access
        agent - The job agent these settings belong to
        plugin - The plugin definition these settings are for
        Returns:
        The new JobAgentSettings item
        Throws:
        BaseException - If there is another error
      • getQuery

        static ItemQuery<JobAgentSettings> getQuery​(PluginDefinition plugin)
        Get a query configured to retrieve settings for the specified plugin. This query only return items if the logged in user has generic read permission for all job agents.
        Parameters:
        plugin - The plugin to retreive settings for, null is not allowed
        Returns:
        An ItemQuery object
      • getType

        public Item getType()
        Description copied from interface: Identifiable
        Get the type of item represented by the object. The returned value is one of the values defined in the Item enumeration.
        Returns:
        A value indicating the type of item
      • setJobAgent

        private void setJobAgent​(JobAgent agent)
      • getPluginDefinition

        public PluginDefinition getPluginDefinition()
        Get the plugin that these settings are used for.
        Returns:
        The PluginDefinition item
        Throws:
        PermissionDeniedException - If the logged in user doesn't have read permission to the item
        BaseException - If there is another error
      • setPluginDefinition

        private void setPluginDefinition​(PluginDefinition plugin)
      • isEffectivelyTrusted

        public boolean isEffectivelyTrusted()
        If the plugin is a trusted plugin or not. If these settings hasn't configured a value the trusted flag returned by the plugin definition is used.
        Returns:
        TRUE if the plugin is trusted, FALSE otherwise
        See Also:
        PluginDefinition.isTrusted(), isTrusted()
      • setTrusted

        public void setTrusted​(Boolean trusted)
        Set the trusted flag for this plugin.
        Parameters:
        trusted - A boolean value or null if the plugin definition setting should be used
        See Also:
        PluginDefinition.isTrusted()
      • getMaxMemory

        public Long getMaxMemory()
        Get the maximum amount of memory the plugin is allowed to use. If null the max memory returned by the plugin definition should be used.
        Returns:
        The maximum amount of memory or null
        See Also:
        PluginDefinition.getMaxMemory(), getEffectiveMaxMemory()
      • getEffectiveMaxMemory

        public Long getEffectiveMaxMemory()
        Get the effective maximum amount of memory the plugin is allowed to use. If these settings hasn't configured an amount, the max memory from the plugin definition is returned.
        Returns:
        The maximum memory or null if no maximum has been specified
        See Also:
        PluginDefinition.getMaxMemory(), getMaxMemory()
      • getPriorityBoost

        public int getPriorityBoost()
        Get the priority boost given to jobs executed by this plugin. The priority boost is subtracted from the value job's priority value, resulting in a lower priority value for the job. Jobs with lower values are executed befor jobs with higher values.

        The priority boost is useful if we, for example, want to use one server mainly for importing data. By giving all import plugins a priority boost they will be executed before all other jobs.

        Returns:
        The priority boost, a value between 0 and 10
        See Also:
        Job.getPriority()
      • setPriorityBoost

        public void setPriorityBoost​(int priorityBoost)
        Set the priority boost given to jobs executed by this plugin.
        Parameters:
        priorityBoost - The priority boost, must be between 0 and 10
        Throws:
        PermissionDeniedException - If the logged in user doesn't have write permission
        InvalidDataException - If the new value is less than 0 or greater than 10
      • getEffectivePriority

        public int getEffectivePriority​(Job job)
                                 throws InvalidDataException
        Get the effective priority for the specified job, when the priority boost is taken into account.
        Parameters:
        job - The job to get the prioriy for
        Returns:
        The effective priority
        Throws:
        InvalidDataException - If the job is null or has a different plugin definition than these settings
        See Also:
        Job.getPriority()