|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.core.BasicItem<D>
net.sf.basedb.core.OwnedItem<D>
net.sf.basedb.core.SharedItem<D>
net.sf.basedb.core.CommonItem<D>
net.sf.basedb.core.AnnotatedItem<PluginConfigurationData>
net.sf.basedb.core.PluginConfiguration
public class PluginConfiguration
This class is used to configure a plugin. A plugin can have many configurations.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface net.sf.basedb.core.Transactional |
|---|
Transactional.Action |
| Field Summary | |
|---|---|
private int |
newParameterVersion
|
static Item |
TYPE
The type of item represented by this class. |
| Fields inherited from interface net.sf.basedb.core.Nameable |
|---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
| Constructor Summary | |
|---|---|
PluginConfiguration(PluginConfigurationData pc)
|
|
| Method Summary | ||
|---|---|---|
PluginConfigurationRequest |
configure()
Start the configuration sequence for a plugin. |
|
void |
copyParametersFrom(PluginConfiguration copyFrom)
Copy all parameter values from another plugin configuration. |
|
Set<Annotatable> |
getAnnotatableParents()
Get all parents objects which are annotatable and the logged in user has read permission to. |
|
String |
getAnnotationMessage()
Get a message explaining what the proxy does with the annotations. |
|
ItemQuery<AnnotationType> |
getAnnotationTypes()
Get the annotation types that can be used by this configuration. |
|
static PluginConfiguration |
getById(DbControl dc,
int id)
Get a PluginConfiguration item when you know the ID. |
|
Date |
getEntryDate()
Get the date that the item was registered in the database. |
|
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. |
|
private int |
getNewParameterVersion()
Increase the version number once per transaction. |
|
ParameterInfo |
getParameterInfo(String name)
Get extra information about a parameter in the latest version. |
|
ParameterInfo |
getParameterInfo(String name,
int version)
Get extra information about a parameter in a specific version. |
|
Set<String> |
getParameterNames()
Get the names of all configuration values in the latest version. |
|
Set<String> |
getParameterNames(int version)
Get the names of all configuration values in a specific version. |
|
private
|
getParameterType(Class<T> parameterClass,
List<?> values)
Gets the ParameterType to use with a class. |
|
ParameterValues |
getParameterValues(int version)
Get the configuration parameters as a ParameterValues object. |
|
List<?> |
getParameterValues(String name)
Get the values of a configuration parameter in the latest version. |
|
List<?> |
getParameterValues(String name,
int version)
Get the values of a configuration parameter in a specific version. |
|
(package private) ParameterValuesImpl |
getParameterValuesImpl(int version)
Get a write-protected ParameterValuesImpl object so a job can read the paremeters. |
|
int |
getParameterVersion()
Get the latest version number of the parameters. |
|
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. |
|
Set<ItemProxy> |
getUsingItems()
Get all: Job:s using this configuration
|
|
private
|
getValueList(Element parameter,
Class<T> classType)
Gets the list of values for a parameter from the XML-file. |
|
boolean |
isUsed()
Check if: A Job is using this plugin configuration
|
|
static List<Element> |
loadXmlFile(InputStream in,
String fileName)
Load a configurations xml file from the given stream. |
|
Job |
newJob(Experiment experiment)
Create a new Job for this plugin configuration. |
|
(package private) void |
onAfterCommit(Transactional.Action action)
Reset parameter version so that adding new parameters will increase the version the next time. |
|
void |
setParameterValues(List<Element> parameters)
Sets parameters for a PluginConfiguration from the elements in a xml configurations file. |
|
void |
setParameterValues(String name,
ParameterType<?> parameterType,
List<?> values)
Set a configuration parameter. |
|
void |
setParameterValues(String name,
String label,
String description,
ParameterType<?> parameterType,
List<?> values)
Set a configuration parameter. |
|
(package private) void |
setParameterValuesInternal(String name,
String label,
String description,
ParameterType<?> parameterType,
List<?> values,
boolean validate)
Set the values of a configuration parameter. |
|
private void |
setPluginDefinition(PluginDefinition pd)
The definition cannot be changed. |
|
| Methods inherited from class net.sf.basedb.core.AnnotatedItem |
|---|
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations, toTransferable |
| Methods inherited from class net.sf.basedb.core.CommonItem |
|---|
getDescription, getName, isRemoved, setDescription, setName, setRemoved, toTransferable |
| Methods inherited from class net.sf.basedb.core.SharedItem |
|---|
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey, toTransferable |
| Methods inherited from class net.sf.basedb.core.OwnedItem |
|---|
getOwner, isOwner, setOwner, takeOwnership, toTransferable |
| Methods inherited from class net.sf.basedb.core.BasicItem |
|---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.basedb.core.Annotatable |
|---|
getAnnotationSet, getProtocol, isAnnotated, removeAnnotations |
| Methods inherited from interface net.sf.basedb.core.Identifiable |
|---|
getId, getVersion |
| Methods inherited from interface net.sf.basedb.core.AccessControlled |
|---|
checkPermission, getPermissions, hasPermission |
| Methods inherited from interface net.sf.basedb.core.Ownable |
|---|
getOwner, isOwner, setOwner, takeOwnership |
| Field Detail |
|---|
public static final Item TYPE
Item.PLUGINCONFIGURATION,
getType()private int newParameterVersion
| Constructor Detail |
|---|
PluginConfiguration(PluginConfigurationData pc)
| Method Detail |
|---|
public static PluginConfiguration getNew(DbControl dc,
PluginDefinition pd)
throws PermissionDeniedException,
BaseException
PluginConfiguration item.
dc - The DbControl which will be used for
permission checking and database access.pd - PluginDefinition to create a configuration for.
PluginConfiguration item
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
public static PluginConfiguration getById(DbControl dc,
int id)
throws ItemNotFoundException,
PermissionDeniedException,
BaseException
PluginConfiguration item when you know the ID.
dc - The DbControl which will be used for
permission checking and database access.id - The ID of the item to load
PluginConfiguration item
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 errorpublic static ItemQuery<PluginConfiguration> getQuery()
ItemQuery object
public static ItemQuery<PluginConfiguration> getQuery(GuiContext gc,
String interfaceName)
PluginDefinition.isInContext(GuiContext) returns true for the
specified item, and PluginDefinition.supports(PluginType) returns
true for the specified interface.
gc - The item the plugin should be related to, or null
if this parameter is irrelevantinterfaceName - The complete name of the interface that the plugin
must implement, or null if this parameter is irrelevant
public static List<Element> loadXmlFile(InputStream in,
String fileName)
throws IOException,
JDOMException
in - The input stream to read fromfileName - The name of the originating file (optional)
IOException
JDOMExceptionpublic Item getType()
IdentifiableItem enumeration.
getType in interface Identifiablepublic Date getEntryDate()
Registered
getEntryDate in interface Registered
public boolean isUsed()
throws BaseException
Job is using this plugin configuration
isUsed in class BasicItem<PluginConfigurationData>BaseException - If not able to tell if item is used or not.BasicItem.getUsingItems()public Set<ItemProxy> getUsingItems()
Job:s using this configuration
getUsingItems in class BasicItem<PluginConfigurationData>BasicItem.addUsingItems(Set, Item, org.hibernate.Query)void onAfterCommit(Transactional.Action action)
onAfterCommit in class BasicItem<PluginConfigurationData>Transactional,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classespublic Set<Annotatable> getAnnotatableParents()
AnnotatableSubtypable item that has a subtype
with the ItemSubtype.getPushAnnotations() flag set.
getAnnotatableParents in interface Annotatablepublic ItemQuery<AnnotationType> getAnnotationTypes()
AnnotationSetterPlugin interface.
getAnnotationTypes in interface AnnotatableProxypublic String getAnnotationMessage()
getAnnotationMessage in interface AnnotatableProxy
public PluginDefinition getPluginDefinition()
throws PermissionDeniedException,
BaseException
PluginDefinition object.
PermissionDeniedException - This exception is thrown if
the logged in user doesn't have READ
permission to the items.
BaseException - If anything else fails.
private void setPluginDefinition(PluginDefinition pd)
throws PermissionDeniedException,
InvalidUseOfNullException
PermissionDeniedException
InvalidUseOfNullExceptionpublic int getParameterVersion()
private int getNewParameterVersion()
public Set<String> getParameterNames()
Set containing the names of the configuration values
or an empty set if no values has been definedgetParameterNames(int)public Set<String> getParameterNames(int version)
version - The version to get the configuration parameters for
Set containing the names of the configuration values
or an empty set if no values has been definedgetParameterNames()
public List<?> getParameterValues(String name)
throws PermissionDeniedException,
BaseException
name - The name of the parameter
PermissionDeniedException - If the logged in user doesn't have
read permission to all values
BaseException - If there is another errorgetParameterValues(String, int)
public List<?> getParameterValues(String name,
int version)
throws PermissionDeniedException,
BaseException
name - The name of the parameterversion - The version of the parameter
PermissionDeniedException - If the logged in user doesn't have
read permission to all values
BaseException - If there is another errorgetParameterValues(String)
public ParameterInfo getParameterInfo(String name)
throws PermissionDeniedException,
BaseException
name - The name of the parameter
PermissionDeniedException - If the parameter contain values that
the logged in user doesn't have read permission for
BaseException - If there is another errorgetParameterInfo(String, int)
public ParameterInfo getParameterInfo(String name,
int version)
throws PermissionDeniedException,
BaseException
name - The name of the parameterversion - The version of the parameter
PermissionDeniedException - If the parameter contain values that
the logged in user doesn't have read permission for
BaseException - If there is another errorgetParameterInfo(String)public ParameterValues getParameterValues(int version)
ParameterValues object.
version - The version of the parameters
getParameterVersion()
public void setParameterValues(String name,
ParameterType<?> parameterType,
List<?> values)
throws InvalidDataException,
PermissionDeniedException,
BaseException
name - The name of the configuration parameterparameterType - The type of the parametervalues - A list containing the new values, null or empty to remove the
configuration values
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
public void setParameterValues(String name,
String label,
String description,
ParameterType<?> parameterType,
List<?> values)
throws InvalidDataException,
PermissionDeniedException,
BaseException
name - The name of the configuration parameterlabel - The label of the parameter (optional)description - A description of the parameter (optional)parameterType - The type of the parametervalues - A list containing the new values, null or empty to remove the
configuration values
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
void setParameterValuesInternal(String name,
String label,
String description,
ParameterType<?> parameterType,
List<?> values,
boolean validate)
throws InvalidDataException,
PermissionDeniedException,
BaseException
name - The name of the configuration parameterlabel - The label of the parameter (optional)description - A description of the parameter (optional)parameterType - The type of the parametervalues - A list containing the new values, null or empty to remove the
configuration valuesvalidate - If validation by ParameterType.validate(String, List)
is needed or not
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
public void copyParametersFrom(PluginConfiguration copyFrom)
throws InvalidDataException,
PermissionDeniedException,
BaseException
copyFrom - The configuration to copy parameters from
InvalidDataException - If the copyFrom parameter is null
PermissionDeniedException - If the logged in user doesn't have write
permission for this configuration
BaseException - If there is another error
public PluginConfigurationRequest configure()
throws PermissionDeniedException,
BaseException
PluginRequest
for more information. The parameters sent to the plugin are those from the latest
version.
PluginRequest object
PermissionDeniedException - If the logged in user doesn't have
write permission
BaseException - If there is another error
public Job newJob(Experiment experiment)
throws PermissionDeniedException,
BaseException
Job for this plugin configuration.
experiment - The experiment the job is part of, or null
if the job is not part of an experiment
Job item
PermissionDeniedException - If
the logged in user doesn't have use
permission for this plugin definition
BaseExceptionpublic ItemQuery<Job> getJobs()
ItemQuery object
ParameterValuesImpl getParameterValuesImpl(int version)
throws BaseException
BaseException
public void setParameterValues(List<Element> parameters)
throws ClassNotFoundException
parameters - A list of the parameters that shall be set to the configuration
ClassNotFoundException - If there is an error while trying to find the type of the parameters.
private <T> List<T> getValueList(Element parameter,
Class<T> classType)
private <T> ParameterType<T> getParameterType(Class<T> parameterClass,
List<?> values)
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||