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 Details

    • TYPE

      public static final Item TYPE
      The type of item represented by this class.
      See Also:
    • 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.
  • Constructor Details

  • Method Details

    • 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
    • getById

      Get a JobAgentSettings item when you know the ID.
      Parameters:
      dc - The DbControl which will be used for permission checking and database access
      id - The ID of the item to load
      Returns:
      The JobAgentSettings item
      Throws:
      ItemNotFoundException - If an item with the specified ID is not found
      PermissionDeniedException - If the logged in user doesn't have read permission for the item
      BaseException - If there is another error
    • getQuery

      static ItemQuery<JobAgentSettings> getQuery(JobAgent agent)
      Get a query configured to retrieve settings for the specified agent.
      Parameters:
      agent - The job agent to retreive settings for, null is not allowed
      Returns:
      An ItemQuery object
      See Also:
    • 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
    • getData

      Description copied from class: BasicItem
      Get the BasicData object that holds all data for this item.
      Specified by:
      getData in class BasicItem
    • 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
    • getSharedParent

      SharedData getSharedParent()
      Description copied from class: ChildItem
      Get the shareable parent item of this child item. This is used by the ChildItem.initPermissions(int, int) method to calculate the logged in user's permissions for the child item.
      Specified by:
      getSharedParent in class ChildItem
      Returns:
      The parent item
    • getJobAgent

      public JobAgent getJobAgent() throws PermissionDeniedException, BaseException
      Get the job agent that owns these settings.
      Returns:
      The JobAgent item
      Throws:
      PermissionDeniedException - If the logged in user doesn't have read permission to the item
      BaseException - If there is another error
    • 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)
    • isTrusted

      public Boolean isTrusted()
      If the plugin is a trusted plugin or not. If null the trusted flag returned by the plugin definition should be used.
      Returns:
      A boolean vaue or null
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • setMaxMemory

      public void setMaxMemory(Long maxMemory) throws PermissionDeniedException, InvalidDataException
      Set maximim amount of memory the plugin is allowed to use.
      Parameters:
      maxMemory - The maximum amount or null to use the amount specified by the plugin definition
      Throws:
      PermissionDeniedException - If the logged in user doesn't have write permission
      InvalidDataException - If the new value is less than zero
    • 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:
    • 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: