Package net.sf.basedb.core
Class JobAgentSettings
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.ChildItem
net.sf.basedb.core.JobAgentSettings
- All Implemented Interfaces:
AccessControlled
,Identifiable
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 Summary
Modifier and TypeFieldDescriptionprivate static final QueryRuntimeFilter
This filter will only return items if the logged in user has generic read permission to job agents.static final Item
The type of item represented by this class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JobAgentSettings
Get aJobAgentSettings
item when you know the ID.(package private) JobAgentSettingsData
getData()
Get theBasicData
object that holds all data for this item.Get the effective maximum amount of memory the plugin is allowed to use.int
getEffectivePriority
(Job job) Get the effective priority for the specified job, when the priority boost is taken into account.Get the job agent that owns these settings.Get the maximum amount of memory the plugin is allowed to use.(package private) static JobAgentSettings
getNew
(DbControl dc, JobAgent agent, PluginDefinition plugin) Create a newJobAgentSettings
item.Get the plugin that these settings are used for.int
Get the priority boost given to jobs executed by this plugin.(package private) static ItemQuery<JobAgentSettings>
Get a query configured to retrieve settings for the specified agent.(package private) static ItemQuery<JobAgentSettings>
getQuery
(PluginDefinition plugin) Get a query configured to retrieve settings for the specified plugin.(package private) SharedData
Get the shareable parent item of this child item.getType()
Get the type of item represented by the object.boolean
If the plugin is a trusted plugin or not.If the plugin is a trusted plugin or not.private void
setJobAgent
(JobAgent agent) void
setMaxMemory
(Long maxMemory) Set maximim amount of memory the plugin is allowed to use.private void
setPluginDefinition
(PluginDefinition plugin) void
setPriorityBoost
(int priorityBoost) Set the priority boost given to jobs executed by this plugin.void
setTrusted
(Boolean trusted) Set the trusted flag for this plugin.Methods inherited from class net.sf.basedb.core.ChildItem
getPermissionForUse, getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to job agents.
-
-
Constructor Details
-
JobAgentSettings
JobAgentSettings(JobAgentSettingsData data)
-
-
Method Details
-
getNew
Create a newJobAgentSettings
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessagent
- The job agent these settings belong toplugin
- The plugin definition these settings are for- Returns:
- The new
JobAgentSettings
item - Throws:
BaseException
- If there is another error
-
getById
public static JobAgentSettings getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aJobAgentSettings
item when you know the ID.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessid
- The ID of the item to load- Returns:
- The
JobAgentSettings
item - Throws:
ItemNotFoundException
- If an item with the specified ID is not foundPermissionDeniedException
- If the logged in user doesn't have read permission for the itemBaseException
- If there is another error
-
getQuery
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
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
JobAgentSettingsData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this 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 theItem
enumeration.- Returns:
- A value indicating the type of item
-
getJobAgent
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 itemBaseException
- If there is another error
-
setJobAgent
-
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 itemBaseException
- If there is another error
-
setPluginDefinition
-
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
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
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
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
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 permissionInvalidDataException
- 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 permissionInvalidDataException
- If the new value is less than 0 or greater than 10
-
getEffectivePriority
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:
-