|
3.0.4: 2012-03-05 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.BasicItem<PluginTypeData>
net.sf.basedb.core.PluginType
public class PluginType
Field Summary | |
---|---|
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. |
Fields inherited from interface net.sf.basedb.core.Nameable |
---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
Constructor Summary | |
---|---|
PluginType(PluginTypeData data)
Creates a plugin type item. |
Method Summary | |
---|---|
static PluginType |
getById(DbControl dc,
int id)
Get a PluginType object when you know the ID. |
static PluginType |
getByInterfaceName(DbControl dc,
String interfaceName)
Get a PluginType object when you know the interface
name it represents. |
String |
getDescription()
Get the description for the item. |
Date |
getEntryDate()
Get the date that the item was registered in the database. |
String |
getInterfaceName()
Get the class name of the Java class that implements this plugin. |
String |
getJarFile()
Get the name of the JAR file that contains this plug-in. |
String |
getJarPath()
Get the path to the JAR file that contains the plugin class file. |
String |
getName()
Get the name of the item. |
static PluginType |
getNew(DbControl dc,
String interfaceName,
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(String jarFile,
String interfaceName)
|
void |
setDescription(String description)
Set the description for the item. |
private void |
setInterfaceName(String interfaceName)
The class name cannot be changed. |
private void |
setJarFile(String jarFile)
The jar path cannot be changed. |
void |
setName(String name)
Set the name of the item. |
void |
setRemoved(boolean removed)
Set the removed flag for this item. |
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.Identifiable |
---|
getId, getVersion |
Methods inherited from interface net.sf.basedb.core.AccessControlled |
---|
checkPermission, getPermissions, hasPermission |
Field Detail |
---|
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
Constructor Detail |
---|
PluginType(PluginTypeData data)
data
- the dataMethod Detail |
---|
public static PluginType getNew(DbControl dc, String interfaceName, 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 classpath
PluginDefinition
item
BaseException
- 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
item
ItemNotFoundException
- If an item with the specified
id is not found
PermissionDeniedException
- If the logged in user doesn't
have read permission to the item
BaseException
- If there is another errorpublic static PluginType getByInterfaceName(DbControl dc, 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 type
PluginType
item
ItemNotFoundException
- If an item with the specified
interface name is not found
PermissionDeniedException
- If the logged in user doesn't
have read permission to the item
BaseException
- If there is another errorpublic static ItemQuery<PluginType> getQuery()
ItemQuery
objectpublic Item getType()
Identifiable
Item
enumeration.
getType
in interface Identifiable
public String getName()
Nameable
getName
in interface Nameable
String
with the name of the itempublic void setName(String name) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_NAME_LENGTH
constant.
setName
in interface Nameable
name
- The new name for the item
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH
constantpublic String getDescription()
Nameable
getDescription
in interface Nameable
String
with a description of the itempublic void setDescription(String description) throws PermissionDeniedException, InvalidDataException
Nameable
Nameable.MAX_DESCRIPTION_LENGTH
constant.
setDescription
in interface Nameable
description
- The new description for the item
PermissionDeniedException
- If the logged in user doesn't
have write permission
InvalidDataException
- 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 subclass
BaseException
- If the permissions couldn't be initialisedpublic boolean isRemoved()
Removable
isRemoved
in interface Removable
public void setRemoved(boolean removed) throws PermissionDeniedException
Removable
setRemoved
in interface Removable
removed
- TRUE if the item should be flagged as removed,
FALSE otherwise
PermissionDeniedException
- 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 Date getEntryDate()
Registered
getEntryDate
in interface Registered
public String getInterfaceName()
Plugin
interface.
private void setInterfaceName(String interfaceName) throws InvalidDataException
InvalidDataException
public String getJarFile()
public String getJarPath()
private void setJarFile(String jarFile) throws InvalidDataException
InvalidDataException
public void loadInterfaceInformation(String jarFile, 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()
|
3.0.4: 2012-03-05 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |