public class PluginType extends BasicItem<PluginTypeData> implements Nameable, Removable, Registered
Modifier and Type | Field and Description |
---|---|
static int |
MAX_INTERFACENAME_LENGTH
The maximum length of the interface name that can be stored in the
database.
|
static int |
MAX_JARFILE_LENGTH
The maximum length of the jar path name that can be stored in the
database.
|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
PluginType(PluginTypeData data)
Creates a plugin type item.
|
Modifier and Type | Method and Description |
---|---|
static PluginType |
getById(DbControl dc,
int id)
Get a
PluginType object when you know the ID. |
static PluginType |
getByInterfaceName(DbControl dc,
java.lang.String interfaceName)
Get a
PluginType object when you know the interface
name it represents. |
java.lang.String |
getDescription()
Get the description for the item.
|
java.util.Date |
getEntryDate()
Get the date that the item was registered in the database.
|
java.lang.String |
getInterfaceName()
Get the class name of the Java class that implements this plugin.
|
java.lang.String |
getJarFile()
Get the name of the JAR file that contains this plug-in.
|
java.lang.String |
getJarPath()
Get the path to the JAR file that contains the plugin class file.
|
java.lang.String |
getName()
Get the name of the item.
|
static PluginType |
getNew(DbControl dc,
java.lang.String interfaceName,
java.lang.String jarFile)
Create a new
PluginType item. |
ItemQuery<PluginDefinition> |
getPlugins()
Get a query that returns the plugin definitions which implements
this type.
|
static ItemQuery<PluginType> |
getQuery()
Get a query configured to retrieve plugin types.
|
Item |
getType()
Get the type of item represented by the object.
|
(package private) void |
initPermissions(int granted,
int denied)
All users get READ access.
|
boolean |
isRemoved()
Check if the removed flag is set for this item.
|
void |
loadInterfaceInformation(java.lang.String jarFile,
java.lang.String interfaceName) |
void |
setDescription(java.lang.String description)
Set the description for the item.
|
private void |
setInterfaceName(java.lang.String interfaceName)
The class name cannot be changed.
|
private void |
setJarFile(java.lang.String jarFile)
The jar path cannot be changed.
|
void |
setName(java.lang.String name)
Set the name of the item.
|
void |
setRemoved(boolean removed)
Set the removed flag for this item.
|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
public static final Item TYPE
Item.PLUGINTYPE
,
getType()
public static final int MAX_INTERFACENAME_LENGTH
setInterfaceName(String)
method to avoid exceptions.public static final int MAX_JARFILE_LENGTH
PluginType(PluginTypeData data)
data
- the datapublic static PluginType getNew(DbControl dc, java.lang.String interfaceName, java.lang.String jarFile) throws BaseException
PluginType
item.dc
- The DbControl
which will be used for
permission checking and database access.interfaceName
- The name of an interface that a plugin
must implement to be of this typejarFile
- Optional file name of the JAR file which contains the
plugin class. The JAR file must be located in the plugins.dir
directory. If not specified the plugin must be in the classpathPluginDefinition
itemBaseException
- If there is an errorpublic static PluginType getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
PluginType
object 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.PluginType
itemItemNotFoundException
- If an item with the specified
id is not foundPermissionDeniedException
- If the logged in user doesn't
have read permission to the itemBaseException
- If there is another errorpublic static PluginType getByInterfaceName(DbControl dc, java.lang.String interfaceName) throws ItemNotFoundException, PermissionDeniedException, BaseException
PluginType
object when you know the interface
name it represents.dc
- The DbControl
which will be used for
permission checking and database access.interfaceName
- The interface name of the plugin typePluginType
itemItemNotFoundException
- If an item with the specified
interface name is not foundPermissionDeniedException
- If the logged in user doesn't
have read permission to the itemBaseException
- If there is another errorpublic static ItemQuery<PluginType> getQuery()
ItemQuery
objectpublic Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
public java.lang.String getName()
Nameable
public void setName(java.lang.String name) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_NAME_LENGTH
constant.setName
in interface Nameable
name
- The new name for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH
constantpublic java.lang.String getDescription()
Nameable
getDescription
in interface Nameable
String
with a description of the itempublic void setDescription(java.lang.String description) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_DESCRIPTION_LENGTH
constant.setDescription
in interface Nameable
description
- The new description for the itemPermissionDeniedException
- If the logged in user doesn't
have write permissionInvalidDataException
- If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH
constantvoid initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem<PluginTypeData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclassBaseException
- If the permissions couldn't be initialisedpublic boolean isRemoved()
Removable
public void setRemoved(boolean removed) throws PermissionDeniedException
Removable
setRemoved
in interface Removable
removed
- TRUE if the item should be flagged as removed,
FALSE otherwisePermissionDeniedException
- If the logged in user doesn't
have Permission.DELETE
permission for setting the flag
to TRUE or Permission.WRITE
permission for setting the
flag to FALSEpublic java.util.Date getEntryDate()
Registered
getEntryDate
in interface Registered
public java.lang.String getInterfaceName()
Plugin
interface.private void setInterfaceName(java.lang.String interfaceName) throws InvalidDataException
InvalidDataException
public java.lang.String getJarFile()
public java.lang.String getJarPath()
private void setJarFile(java.lang.String jarFile) throws InvalidDataException
InvalidDataException
public void loadInterfaceInformation(java.lang.String jarFile, java.lang.String interfaceName) throws InvalidDataException, BaseException
jarFile
- File name of the jar file containing the plug-in. The
JAR file must be located in the directory spercified by 'plugins.dir' setting
in base.config. Null is allowed if plugin is located in the classpath (eg. WEB-INF/lib).interfaceName
- The name of an interface that a plugin
must implement to be of this type.InvalidDataException
- If the found class not really is an interface, or
if the found interface doesn't extend from Plugin
BaseException
- If there is some other error.public ItemQuery<PluginDefinition> getPlugins()
PluginDefinition.getQuery()