Last update: 2011-06-23

org.proteios.core
Class PluginConfiguration

java.lang.Object
  extended by org.proteios.core.BasicItem<D>
      extended by org.proteios.core.OwnedItem<D>
          extended by org.proteios.core.SharedItem<D>
              extended by org.proteios.core.CommonItem<PluginConfigurationData>
                  extended by org.proteios.core.PluginConfiguration
All Implemented Interfaces:
AccessControlled, Identifiable, Nameable, Ownable, Removable, Shareable

public class PluginConfiguration
extends CommonItem<PluginConfigurationData>

This class is used to configure a plugin. A plugin can have many configurations. The sequence to setup a configuration is the following

Version:
2.0
Author:
Nicklas, Samuel

Field Summary
static Item TYPE
          The type of item represented by this class.
 
Fields inherited from interface org.proteios.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Method Summary
 PluginConfigurationRequest configure()
          Start the configuration sequence for a plugin.
static PluginConfiguration getById(DbControl dc, int id)
          Get a PluginConfiguration item when you know the ID.
 ItemQuery<Job> getJobs()
          Get a query that returns the jobs using this plugin configuration.
static PluginConfiguration getNew(DbControl dc, PluginDefinition pd)
          Create a new PluginConfiguration item.
 Set<String> getParameterNames()
          Get the names of all configuration values.
 List<?> getParameterValues(String name)
          Get the values of a configuration parameter.
 PluginDefinition getPluginDefinition()
          Get the plugin definition for this configuration.
static ItemQuery<PluginConfiguration> getQuery()
          Get a query configured to retrieve plugin configurations.
static ItemQuery<PluginConfiguration> getQuery(GuiContext gc, String interfaceName)
          Get a query that returns all plugins configurations related to a specified GUI context and implementing a certain interface.
 Item getType()
          Get the type of item represented by the object.
 boolean isUsed()
          Check if: A Job is using this plugin configuration
 void setParameterValues(String name, ParameterType<?> parameterType, List<?> values)
          Set a configuration parameter.
 
Methods inherited from class org.proteios.core.CommonItem
getDescription, getName, isRemoved, setDescription, setName, setRemoved
 
Methods inherited from class org.proteios.core.SharedItem
getItemKey, getProjectKey, isShared, setItemKey, setProjectKey
 
Methods inherited from class org.proteios.core.OwnedItem
getOwner, setOwner
 
Methods inherited from class org.proteios.core.BasicItem
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.proteios.core.Identifiable
getId, getVersion
 
Methods inherited from interface org.proteios.core.AccessControlled
checkPermission, hasPermission
 
Methods inherited from interface org.proteios.core.Ownable
getOwner, setOwner
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.PLUGINCONFIGURATION, getType()
Method Detail

getNew

public static PluginConfiguration getNew(DbControl dc,
                                         PluginDefinition pd)
                                  throws PermissionDeniedException,
                                         BaseException
Create a new PluginConfiguration item.

Parameters:
dc - The DbControl which will be used for permission checking and database access.
Returns:
The new PluginDefinition item
Throws:
InvalidDataException - If the plugin definition is null
PermissionDeniedException - If the logged in user doesn't have use permission for the plugin definition
BaseException - If there is an error

getById

public static PluginConfiguration getById(DbControl dc,
                                          int id)
                                   throws ItemNotFoundException,
                                          PermissionDeniedException,
                                          BaseException
Get a PluginConfiguration 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 PluginConfiguration 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

public static ItemQuery<PluginConfiguration> getQuery()
Get a query configured to retrieve plugin configurations.

Returns:
An ItemQuery object

getQuery

public static ItemQuery<PluginConfiguration> getQuery(GuiContext gc,
                                                      String interfaceName)
Get a query that returns all plugins configurations related to a specified GUI context and implementing a certain interface. Ie. The PluginDefinition.isInContext(GuiContext) returns true for the specified item, and PluginDefinition.supports(PluginType) returns true for the specified interface.

Parameters:
gc - The item the plugin should be related to, or null if this parameter is irrelevant
interfaceName - The complete name of the interface that the plugin must implement, or null if this parameter is irrelevant

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

isUsed

public boolean isUsed()
               throws BaseException
Check if:

Specified by:
isUsed in class BasicItem<PluginConfigurationData>
Returns:
TRUE if this item is used, FALSE otherwise
Throws:
BaseException

getPluginDefinition

public PluginDefinition getPluginDefinition()
                                     throws PermissionDeniedException,
                                            BaseException
Get the plugin definition for this configuration.

Returns:
PluginDefinition object.
Throws:
PermissionDeniedException - This exception is thrown if the logged in user doesn't have READ permission to the items.
BaseException

getParameterNames

public Set<String> getParameterNames()
Get the names of all configuration values.

Returns:
A Set containing the names of the configuration values or an empty set if no values has been defined

getParameterValues

public List<?> getParameterValues(String name)
                           throws PermissionDeniedException,
                                  BaseException
Get the values of a configuration parameter.

Parameters:
name - The name of the parameter
Returns:
The values, or null if no value has been set
Throws:
PermissionDeniedException - If the logged in user doesn't have read permission to all values
BaseException - If there is another error

setParameterValues

public void setParameterValues(String name,
                               ParameterType<?> parameterType,
                               List<?> values)
                        throws InvalidDataException,
                               PermissionDeniedException,
                               BaseException
Set a configuration parameter.

Parameters:
name - The name of the configuration parameter
parameterType - The type of the parameter
values - A list containing the new values, null or empty to remove the configuration values
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If name is null or the new value doesn't validate against the parameter type
BaseException - If there is another error

configure

public PluginConfigurationRequest configure()
                                     throws PermissionDeniedException,
                                            BaseException
Start the configuration sequence for a plugin.

Returns:
A PluginRequest object
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
BaseException - If there is another error

getJobs

public ItemQuery<Job> getJobs()
Get a query that returns the jobs using this plugin configuration.

Returns:
An ItemQuery object

Last update: 2011-06-23