Package net.sf.basedb.core.data
Class PluginDefinitionData
- java.lang.Object
-
- net.sf.basedb.core.data.BasicData
-
- net.sf.basedb.core.data.OwnedData
-
- net.sf.basedb.core.data.SharedData
-
- net.sf.basedb.core.data.CommonData
-
- net.sf.basedb.core.data.PluginDefinitionData
-
- All Implemented Interfaces:
AnnotatableData
,IdentifiableData
,NameableData
,OwnableData
,RegisteredData
,RemovableData
,ShareableData
public class PluginDefinitionData extends CommonData implements RemovableData, AnnotatableData, RegisteredData
This class represent an installed plugin.- Version:
- 2.0
- Author:
- Nicklas, Samuel
- See Also:
PluginDefinition
, Developer documentation: Plug-ins, jobs and job agents- Hibernate: class
- table="`PluginDefinitions`" lazy="false"
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
allowImmediateExecution
private AnnotationSetData
annotationSet
private String
className
private Set<PluginConfigurationData>
configurations
private String
contact
private String
copyright
private String
description
private boolean
disabled
private String
email
private Date
entryDate
private Set<GuiContextData>
guiContexts
private boolean
interactive
private String
jarFile
private Set<JobAgentSettingsData>
jobAgentSettings
private Set<AnnotationLink>
links
private int
mainType
static int
MAX_CLASSNAME_LENGTH
The maximum length of the class name that can be stored in the database.static int
MAX_CONTACT_LENGTH
The maximum length of the contact information that can be stored in the database.static int
MAX_COPYRIGHT_LENGTH
The maximum length of the copyright notice that can be stored in the database.static int
MAX_DESCRIPTION_LENGTH
The maximum length of the url that can be stored in the database.static int
MAX_EMAIL_LENGTH
The maximum length of the email address that can be stored in the database.static int
MAX_JARFILE_LENGTH
static int
MAX_NAME_LENGTH
The maximum length of the name that can be stored in the database.static int
MAX_URL_LENGTH
The maximum length of the url that can be stored in the database.static int
MAX_VERSION_LENGTH
The maximum length of the version that can be stored in the database.private Long
maxMemory
private String
name
private Map<RoleKeyData,PluginPermission>
permissions
private Set<PluginTypeData>
pluginTypes
private Integer
removedBy
private boolean
requiresConfiguration
private boolean
supportsConfigurations
private boolean
trusted
private String
url
private boolean
useInternalJobQueue
private boolean
usePermissions
private String
version
-
Constructor Summary
Constructors Constructor Description PluginDefinitionData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getAllowImmediateExecution()
If the plugin is allowed to be immediately executed or if it must be added to the job queue.Set<AnnotationLink>
getAnnotations()
Short-cut to all annotations belonging to this item.AnnotationSetData
getAnnotationSet()
Get the annotation set that holds the annotations for an item.String
getClassName()
Get the class name of the Java class that implements this plugin.(package private) Set<PluginConfigurationData>
getConfigurations()
This is the inverse end.String
getContact()
Get contact information for the plugin.String
getCopyright()
Get a copyright notice for the plugin.String
getDescription()
Get a description of the plugin.String
getEmail()
Get an email address that can be used to get more information about the plugin.Date
getEntryDate()
Get the date this item was added to the database.Set<GuiContextData>
getGuiContexts()
The item code for all items where it makes sense to use the plugin in a client application.String
getJarFile()
Get the file name of the JAR file where the plugin class is located.(package private) Set<JobAgentSettingsData>
getJobAgentSettings()
This is the inverse end.int
getMainType()
Get the main type of plugin.Long
getMaxMemory()
The max amount of memory the plugin can use.String
getName()
Get the name of the plugin.Map<RoleKeyData,PluginPermission>
getPermissions()
Get a map containing the rolekey and the permissions for this plugin.Set<PluginTypeData>
getPluginTypes()
The plugin types of this plugin, ie. all interfaces that it implements.Integer
getRemovedBy()
Get the ID of the user that removed this item.boolean
getRequiresConfiguration()
If the plugin requires a configurations or not.boolean
getSupportsConfigurations()
If the plugin supports configurations or not.String
getUrl()
Get a URL with more information about the plugin.boolean
getUseInternalJobQueue()
If the plug-in can be executed with the internal job queue or not.boolean
getUsePermissions()
If the permissions for this plugin should be used or not.String
getVersionString()
Get the version of the plugin.boolean
isDisabled()
If the plugin is enabled or disabled. // Mapped in hibernate-properties-PluginDefinitionData.xml since annotation doesn't support a default valueboolean
isInteractive()
If the plugin is interactive or not.boolean
isTrusted()
If the plugin should be trusted or not.void
setAllowImmediateExecution(boolean allowImmediateExecution)
(package private) void
setAnnotations(Set<AnnotationLink> links)
void
setAnnotationSet(AnnotationSetData annotationSet)
Change the annotation set.void
setClassName(String className)
(package private) void
setConfigurations(Set<PluginConfigurationData> configurations)
void
setContact(String contact)
void
setCopyright(String copyright)
void
setDescription(String description)
Set the description for the item.void
setDisabled(boolean disabled)
void
setEmail(String email)
void
setEntryDate(Date entryDate)
(package private) void
setGuiContexts(Set<GuiContextData> guiContexts)
void
setInteractive(boolean interactive)
void
setJarFile(String jarFile)
(package private) void
setJobAgentSettings(Set<JobAgentSettingsData> jobAgentSettings)
void
setMainType(int mainType)
void
setMaxMemory(Long maxMemory)
void
setName(String name)
Set the name of the item.(package private) void
setPermissions(Map<RoleKeyData,PluginPermission> permissions)
(package private) void
setPluginTypes(Set<PluginTypeData> pluginTypes)
void
setRemovedBy(Integer removedBy)
Set the ID of the user that removed this item or null to restore the item.void
setRequiresConfiguration(boolean requiresConfiguration)
void
setSupportsConfigurations(boolean supportsConfigurations)
void
setTrusted(boolean trusted)
void
setUrl(String url)
void
setUseInternalJobQueue(boolean useInternalJobQueue)
void
setUsePermissions(boolean usePermissions)
void
setVersionString(String version)
-
Methods inherited from class net.sf.basedb.core.data.SharedData
getItemKey, getProjectKey, setItemKey, setProjectKey
-
Methods inherited from class net.sf.basedb.core.data.BasicData
equals, getId, getVersion, hashCode, setId, setVersion, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.basedb.core.data.IdentifiableData
getId, getVersion
-
Methods inherited from interface net.sf.basedb.core.data.OwnableData
getOwner, setOwner
-
-
-
-
Field Detail
-
removedBy
private Integer removedBy
-
annotationSet
private AnnotationSetData annotationSet
-
links
private Set<AnnotationLink> links
-
entryDate
private Date entryDate
-
MAX_CLASSNAME_LENGTH
public static final int MAX_CLASSNAME_LENGTH
The maximum length of the class name that can be stored in the database.- See Also:
- Constant Field Values
-
className
private String className
-
MAX_JARFILE_LENGTH
public static final int MAX_JARFILE_LENGTH
- See Also:
- Constant Field Values
-
jarFile
private String jarFile
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTH
The maximum length of the name that can be stored in the database.- See Also:
- Constant Field Values
-
name
private String name
-
MAX_DESCRIPTION_LENGTH
public static final int MAX_DESCRIPTION_LENGTH
The maximum length of the url that can be stored in the database.- See Also:
- Constant Field Values
-
description
private String description
-
MAX_VERSION_LENGTH
public static final int MAX_VERSION_LENGTH
The maximum length of the version that can be stored in the database.- See Also:
- Constant Field Values
-
version
private String version
-
MAX_COPYRIGHT_LENGTH
public static final int MAX_COPYRIGHT_LENGTH
The maximum length of the copyright notice that can be stored in the database.- See Also:
- Constant Field Values
-
copyright
private String copyright
-
MAX_CONTACT_LENGTH
public static final int MAX_CONTACT_LENGTH
The maximum length of the contact information that can be stored in the database.- See Also:
- Constant Field Values
-
contact
private String contact
-
MAX_EMAIL_LENGTH
public static final int MAX_EMAIL_LENGTH
The maximum length of the email address that can be stored in the database.- See Also:
- Constant Field Values
-
email
private String email
-
MAX_URL_LENGTH
public static final int MAX_URL_LENGTH
The maximum length of the url that can be stored in the database.- See Also:
- Constant Field Values
-
url
private String url
-
mainType
private int mainType
-
disabled
private boolean disabled
-
interactive
private boolean interactive
-
supportsConfigurations
private boolean supportsConfigurations
-
requiresConfiguration
private boolean requiresConfiguration
-
usePermissions
private boolean usePermissions
-
guiContexts
private Set<GuiContextData> guiContexts
-
pluginTypes
private Set<PluginTypeData> pluginTypes
-
permissions
private Map<RoleKeyData,PluginPermission> permissions
-
trusted
private boolean trusted
-
maxMemory
private Long maxMemory
-
jobAgentSettings
private Set<JobAgentSettingsData> jobAgentSettings
-
configurations
private Set<PluginConfigurationData> configurations
-
allowImmediateExecution
private boolean allowImmediateExecution
-
useInternalJobQueue
private boolean useInternalJobQueue
-
-
Method Detail
-
getRemovedBy
public Integer getRemovedBy()
Description copied from interface:RemovableData
Get the ID of the user that removed this item.- Specified by:
getRemovedBy
in interfaceRemovableData
- Overrides:
getRemovedBy
in classCommonData
- Returns:
- The ID of a user or null if the item is not removed
-
setRemovedBy
public void setRemovedBy(Integer removedBy)
Description copied from interface:RemovableData
Set the ID of the user that removed this item or null to restore the item.- Specified by:
setRemovedBy
in interfaceRemovableData
- Overrides:
setRemovedBy
in classCommonData
-
getAnnotationSet
public AnnotationSetData getAnnotationSet()
Description copied from interface:AnnotatableData
Get the annotation set that holds the annotations for an item.- Specified by:
getAnnotationSet
in interfaceAnnotatableData
- Returns:
- An
AnnotationSetData
item or null if no annotations exist
-
setAnnotationSet
public void setAnnotationSet(AnnotationSetData annotationSet)
Description copied from interface:AnnotatableData
Change the annotation set. Use null to remove the annotations.- Specified by:
setAnnotationSet
in interfaceAnnotatableData
- Parameters:
annotationSet
- Annotation set to change to.
-
getAnnotations
public Set<AnnotationLink> getAnnotations()
Description copied from interface:AnnotatableData
Short-cut to all annotations belonging to this item. Used for HQL queries only. This is the inverse end. NOTE! The property-ref="annotationSet" require that AnnotationSetData implements Serializable- Specified by:
getAnnotations
in interfaceAnnotatableData
-
setAnnotations
void setAnnotations(Set<AnnotationLink> links)
-
getEntryDate
public Date getEntryDate()
Description copied from interface:RegisteredData
Get the date this item was added to the database. The value is generated at creation time and can't be modified later.- Specified by:
getEntryDate
in interfaceRegisteredData
-
setEntryDate
public void setEntryDate(Date entryDate)
-
getClassName
public String getClassName()
Get the class name of the Java class that implements this plugin. The specified class must implement thePlugin
interface.- Returns:
- The class name for this plugin
- Hibernate: property
- column="`class_name`" type="string" length="255" not-null="true" unique="true"
-
setClassName
public void setClassName(String className)
-
getJarFile
public String getJarFile()
Get the file name of the JAR file where the plugin class is located. The JAR file must be located in the 'plugins.dir' folder specified in base.config. If the value is null the plugin must be in the classpath (eg. WEB-INF/lib).- Returns:
- The class name for this plugin
- Since:
- 3.0
- Hibernate: property
- column="`jar_file`" type="string" length="255" not-null="false"
-
setJarFile
public void setJarFile(String jarFile)
-
getName
public String getName()
Get the name of the plugin.- Specified by:
getName
in interfaceNameableData
- Overrides:
getName
in classCommonData
- Returns:
- A string with the name of the plugin
- Hibernate: property
- column="`name`" type="string" length="255" not-null="true"
-
setName
public void setName(String name)
Description copied from interface:NameableData
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by theMAX_NAME_LENGTH
constant.- Specified by:
setName
in interfaceNameableData
- Overrides:
setName
in classCommonData
- Parameters:
name
- The new name for the item
-
getDescription
public String getDescription()
Get a description of the plugin.- Specified by:
getDescription
in interfaceNameableData
- Overrides:
getDescription
in classCommonData
- Returns:
- A string with a description, or null if not known
- Hibernate: property
- column="`description`" type="text" not-null="false"
-
setDescription
public void setDescription(String description)
Description copied from interface:NameableData
Set the description for the item. The description can be null but mustn't be longer than the value specified by theMAX_DESCRIPTION_LENGTH
constant.- Specified by:
setDescription
in interfaceNameableData
- Overrides:
setDescription
in classCommonData
- Parameters:
description
- The new description for the item
-
getVersionString
public String getVersionString()
Get the version of the plugin.- Returns:
- A string with the version of the plugin, or null if not known
- Hibernate: property
- column="`version_string`" type="string" length="255" not-null="false"
-
setVersionString
public void setVersionString(String version)
-
getCopyright
public String getCopyright()
Get a copyright notice for the plugin.- Returns:
- A string with a copyright notice, or null if not known
- Hibernate: property
- column="`copyright`" type="string" length="255" not-null="false"
-
setCopyright
public void setCopyright(String copyright)
-
getContact
public String getContact()
Get contact information for the plugin.- Returns:
- A string with contact information, or null if not known
- Hibernate: property
- column="`contact`" type="string" length="255" not-null="false"
-
setContact
public void setContact(String contact)
-
getEmail
public String getEmail()
Get an email address that can be used to get more information about the plugin.- Returns:
- A string with the email address, or null if not known
- Hibernate: property
- column="`email`" type="string" length="255" not-null="false"
-
setEmail
public void setEmail(String email)
-
getUrl
public String getUrl()
Get a URL with more information about the plugin.- Returns:
- A string containing the URL, or null if not known
- Hibernate: property
- column="`url`" type="string" length="255" not-null="false"
-
setUrl
public void setUrl(String url)
-
getMainType
public int getMainType()
Get the main type of plugin.- Returns:
- A type code that is defined in the enum
Plugin.MainType
. - Hibernate: property
- column="`type`" type="int" not-null="true"
-
setMainType
public void setMainType(int mainType)
-
isDisabled
public boolean isDisabled()
If the plugin is enabled or disabled. // Mapped in hibernate-properties-PluginDefinitionData.xml since annotation doesn't support a default value- Since:
- 3.0
-
setDisabled
public void setDisabled(boolean disabled)
-
isInteractive
public boolean isInteractive()
If the plugin is interactive or not.- Hibernate: property
- column="`interactive`" type="boolean" not-null="true"
-
setInteractive
public void setInteractive(boolean interactive)
-
getSupportsConfigurations
public boolean getSupportsConfigurations()
If the plugin supports configurations or not.- Hibernate: property
- column="`supports_config`" type="boolean" not-null="true"
-
setSupportsConfigurations
public void setSupportsConfigurations(boolean supportsConfigurations)
-
getRequiresConfiguration
public boolean getRequiresConfiguration()
If the plugin requires a configurations or not. Requires that the plugin supports configurations.- Hibernate: property
- column="`requires_config`" type="boolean" not-null="true"
-
setRequiresConfiguration
public void setRequiresConfiguration(boolean requiresConfiguration)
-
getUsePermissions
public boolean getUsePermissions()
If the permissions for this plugin should be used or not.- Hibernate: property
- column="`use_permissions`" type="boolean" not-null="true"
-
setUsePermissions
public void setUsePermissions(boolean usePermissions)
-
getGuiContexts
public Set<GuiContextData> getGuiContexts()
The item code for all items where it makes sense to use the plugin in a client application. Ie. a plugin that imports reporters should return a set containing the code for Item.REPORTER.- Hibernate: set
- table="`PluginDefinitionGuiContexts`" lazy="true"
- Hibernate: collection-key
- column="`plugindefinition_id`"
- Hibernate: collection-composite-element
- class="net.sf.basedb.core.data.GuiContextData"
-
setGuiContexts
void setGuiContexts(Set<GuiContextData> guiContexts)
-
getPluginTypes
public Set<PluginTypeData> getPluginTypes()
The plugin types of this plugin, ie. all interfaces that it implements.- Hibernate: set
- table="`PluginDefinitionTypes`" lazy="true"
- Hibernate: collection-key
- column="`plugindefinition_id`"
- Hibernate: collection-many-to-many
- column="`plugintype_id`" class="net.sf.basedb.core.data.PluginTypeData"
-
setPluginTypes
void setPluginTypes(Set<PluginTypeData> pluginTypes)
-
getPermissions
public Map<RoleKeyData,PluginPermission> getPermissions()
Get a map containing the rolekey and the permissions for this plugin.- Hibernate: map
- table="`PluginKeys`" lazy="true" cascade="delete"
- Hibernate: index-many-to-many
- column="`key_id`" class="net.sf.basedb.core.data.RoleKeyData"
- Hibernate: collection-key
- column="`plugindefinition_id`"
- Hibernate: collection-composite-element
- class="net.sf.basedb.core.data.PluginPermission"
-
setPermissions
void setPermissions(Map<RoleKeyData,PluginPermission> permissions)
-
isTrusted
public boolean isTrusted()
If the plugin should be trusted or not.- Hibernate: property
- column="`trusted`" type="boolean" not-null="true"
-
setTrusted
public void setTrusted(boolean trusted)
-
getMaxMemory
public Long getMaxMemory()
The max amount of memory the plugin can use. If the value is null the job agent is free to choose an appropriate value.- Hibernate: property
- column="`max_memory`" type="long" not-null="false"
-
setMaxMemory
public void setMaxMemory(Long maxMemory)
-
getJobAgentSettings
Set<JobAgentSettingsData> getJobAgentSettings()
This is the inverse end.- See Also:
JobAgentSettingsData.getPluginDefinition()
- Hibernate: set
- inverse="true" lazy="true" cascade="delete"
- Hibernate: collection-key
- column="`plugindefinition_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.JobAgentSettingsData"
-
setJobAgentSettings
void setJobAgentSettings(Set<JobAgentSettingsData> jobAgentSettings)
-
getConfigurations
Set<PluginConfigurationData> getConfigurations()
This is the inverse end.- See Also:
PluginConfigurationData.getPluginDefinition()
- Hibernate: set
- inverse="true" lazy="true"
- Hibernate: collection-key
- column="`plugindefinition_id`"
- Hibernate: collection-one-to-many
- class="net.sf.basedb.core.data.PluginConfigurationData"
-
setConfigurations
void setConfigurations(Set<PluginConfigurationData> configurations)
-
getAllowImmediateExecution
public boolean getAllowImmediateExecution()
If the plugin is allowed to be immediately executed or if it must be added to the job queue.- Since:
- 2.2
- Hibernate: property
- column="`allow_immediate`" type="boolean" not-null="true"
-
setAllowImmediateExecution
public void setAllowImmediateExecution(boolean allowImmediateExecution)
-
getUseInternalJobQueue
public boolean getUseInternalJobQueue()
If the plug-in can be executed with the internal job queue or not. If FALSE is used, the plug-in can only be executed by a job agent or other external tool.- Since:
- 2.5
- Hibernate: property
- column="`use_internal_queue`" type="boolean" not-null="true"
-
setUseInternalJobQueue
public void setUseInternalJobQueue(boolean useInternalJobQueue)
-
-