Interface PluginDescriptor
-
- All Superinterfaces:
java.lang.Comparable<PluginDescriptor>
- All Known Implementing Classes:
AbstractPluginDescriptor
,PluginDescriptorImpl
public interface PluginDescriptor extends java.lang.Comparable<PluginDescriptor>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
compareTo(PluginDescriptor plugin)
Compares this plugin with another plugins.boolean
equals(java.lang.Object other)
return equality of plugins.<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationClass)
Return the annotation of the given class carried by this plugin.<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationClass, int methodIndex)
Return the annotation of the method at the given index.java.lang.String[]
getCategories()
Return the set of categories.java.lang.Class<? extends PluginContext>
getContextType(int methodIndex)
Returns the context type required by the method at index methodIndex.java.lang.String
getHelp()
Return the help / description of the plugin.javax.swing.ImageIcon
getIcon()
PluginDescriptorID
getID()
returns the ID of this Plugin.int
getIndexInMethod(int methodIndex, int globalParameterIndex)
Returns the index of the global parameter to the index of that parameter in the given method.int
getIndexInParameterNames(int methodIndex, int methodParameterIndex)
Returns the index of the method parameter of the given method in the list of global parameters.java.lang.String[]
getKeywords()
Return the set of keywords.java.lang.String
getMethodHelp(int methodIndex)
Return the help / description of the given method, if specified.java.lang.String
getMethodLabel(int methodIndex)
Return the label of the given method, if specified.int
getMostSignificantResult()
Returns the index in the result array of the most significant result for this pluginjava.lang.String
getName()
Return the name of the plugin.int
getNumberOfMethods()
Return the number of methods in this plugin.PackageDescriptor
getPackage()
Return the package where the plug-in resides.java.util.List<java.lang.String>
getParameterNames()
Returns a list of labels that represent the possible parameters of this plugin.java.util.List<java.lang.String>
getParameterNames(int methodIndex)
Returns a list of labels that represent the required parameters of the method at the given index.java.util.List<java.util.List<java.lang.Class<?>>>
getParameterTypes()
returns a list of sizegetNumberOfMethods()
, such that element at indexi
of the list equalsgetParameterTypes(i)
java.util.List<java.lang.Class<?>>
getParameterTypes(int methodIndex)
Returns a list of types that represent the required parameters of the method at the given index.java.lang.String
getPluginParameterName(int methodIndex, int parameterIndex)
Return the label of the parameter at indexparameterIndex
of the method atmethodIndex
.java.lang.Class<?>
getPluginParameterType(int methodIndex, int parameterIndex)
Return the type of the parameter at indexparameterIndex
of the method atmethodIndex
.java.util.List<java.lang.String>
getReturnNames()
returns the labels of the objects returned if this plugin is invoked, in the order in which they are returned.java.util.List<java.lang.Class<?>>
getReturnTypes()
returns the types of the objects returned if this plugin is invoked, in the order in which they are returnedjava.util.Set<java.lang.Class<?>>
getTypesAtParameterIndex(int globalParameterIndex)
Returns a list of types that can be accepted for the parameter at indexglobalParameterIndex
.java.net.URL
getURL()
boolean
handlesCancel()
Returns whether the plugin handles termination itself.boolean
hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Check if this plugin carries the given annotation.boolean
hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, int methodIndex)
Check if the method at the given index carries the given annotation.int
hashCode()
return hashcodePluginExecutionResult
invoke(int methodIndex, PluginContext context, java.lang.Object... args)
Asynchronously invokes a method of this plugin.boolean
isUserAccessible()
Returns true if this plugin can be used by the end-users.boolean
meetsLevelThreshold()
Return whether this plug-in meets the level threshold.boolean
meetsQualityThreshold()
Return whether this plug-in meets the quality threshold.java.lang.String
toString()
Returns a String representation of the plugin
-
-
-
Method Detail
-
hasAnnotation
boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Check if this plugin carries the given annotation. Implementing classes can return false at their discretion, i.e. they are not required to return true for all annotations carried by the plugin.- Parameters:
annotationClass
-- Returns:
-
hasAnnotation
boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, int methodIndex)
Check if the method at the given index carries the given annotation. Implementing classes can return false at their discretion, i.e. they are not required to return true for all annotations carried by the plugin.- Parameters:
annotationClass
-- Returns:
-
getAnnotation
<T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
Return the annotation of the given class carried by this plugin. Note that hasAnnotationClass(annotationClass) is assumed. This method should not be used to access any annotation elements carried by Plugin.class. Implementing classes are allows to return null when called with Plugin.class.- Type Parameters:
T
-- Parameters:
annotationClass
-- Returns:
-
getAnnotation
<T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass, int methodIndex)
Return the annotation of the method at the given index. Note that hasAnnotationClass(annotationClass, methodIndex) is assumed. This method should not be used to access any annotation elements carried by Plugin.class. Implementing classes are allows to return null when called with Plugin.class.- Type Parameters:
T
-- Parameters:
annotationClass
-methodIndex
-- Returns:
-
getPackage
PackageDescriptor getPackage()
Return the package where the plug-in resides.- Returns:
-
getName
java.lang.String getName()
Return the name of the plugin. This name is not unique within ProM.- Returns:
-
hashCode
int hashCode()
return hashcode- Overrides:
hashCode
in classjava.lang.Object
- Returns:
-
equals
boolean equals(java.lang.Object other)
return equality of plugins. The ID is used for equality.- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
-- Returns:
-
toString
java.lang.String toString()
Returns a String representation of the plugin- Overrides:
toString
in classjava.lang.Object
- Returns:
-
getNumberOfMethods
int getNumberOfMethods()
Return the number of methods in this plugin. There's always at least 1.- Returns:
-
invoke
PluginExecutionResult invoke(int methodIndex, PluginContext context, java.lang.Object... args)
Asynchronously invokes a method of this plugin. The methodIndex should refer to an existing method, i.e. 0 <= methodindex < getNumberOfMethods(); Note that the callers of this plugin should notify the lifeCycleListners of the given context of the creation of this plugin, i.e. they should call:context.getParentContext().getPluginLifeCycleEventListeners().firePluginCreated(context);
- Parameters:
methodIndex
- The index of the method to be invokedcontext
- the context in which this plugin should be invoked. The plugin may assume that this context is meant only for its execution.args
- the objects to be passed to the plugin. These objects should be in the right order. However, ifProMFuture
objects are provided, the plugin will synchronize on them. This syncrhonization is performed in a fast-fail fashion, i.e. the first future that results in an exception during execution will result in an exception while invoking this plugin. This exception is caught and the context is signaled about it.- Returns:
- a PluginExecutionResult holding pointers to the future outcome of this invokation. If synchrounous execution is required, the calling method should synchronize on this result
-
getReturnTypes
java.util.List<java.lang.Class<?>> getReturnTypes()
returns the types of the objects returned if this plugin is invoked, in the order in which they are returned- Returns:
-
getReturnNames
java.util.List<java.lang.String> getReturnNames()
returns the labels of the objects returned if this plugin is invoked, in the order in which they are returned. These are the labels provided by the plugin definition, not the labels of the objects resulting from a specific invokation, as these can be obtained through thePluginExecutionResult
object.- Returns:
-
getParameterTypes
java.util.List<java.util.List<java.lang.Class<?>>> getParameterTypes()
returns a list of sizegetNumberOfMethods()
, such that element at indexi
of the list equalsgetParameterTypes(i)
- Returns:
-
getParameterTypes
java.util.List<java.lang.Class<?>> getParameterTypes(int methodIndex)
Returns a list of types that represent the required parameters of the method at the given index. In other words, the method at indexmethodIndex
requires exectly the parameter types as provided in the returned list, in that order.- Parameters:
methodIndex
-- Returns:
-
getParameterNames
java.util.List<java.lang.String> getParameterNames()
Returns a list of labels that represent the possible parameters of this plugin. Each method required a subset of these labels, while preserving their order.- Returns:
-
getParameterNames
java.util.List<java.lang.String> getParameterNames(int methodIndex)
Returns a list of labels that represent the required parameters of the method at the given index. In other words, the method at indexmethodIndex
requires exactly the parameter labels as provided in the returned list, in that order.- Parameters:
methodIndex
-- Returns:
-
getPluginParameterType
java.lang.Class<?> getPluginParameterType(int methodIndex, int parameterIndex)
Return the type of the parameter at indexparameterIndex
of the method atmethodIndex
.- Parameters:
methodIndex
-0 <= methodIndex < getNumberOfMethods()
parameterIndex
-0 <= parameterIndex < getParameterTypes().size()
- Returns:
- may return null if the parameter is not used by the given method
-
getPluginParameterName
java.lang.String getPluginParameterName(int methodIndex, int parameterIndex)
Return the label of the parameter at indexparameterIndex
of the method atmethodIndex
.- Parameters:
methodIndex
-0 <= methodIndex < getNumberOfMethods()
parameterIndex
-0 <= parameterIndex < getParameterTypes(methodIndex).size()
- Returns:
- may return null if the parameter is not used by the given method
-
getID
PluginDescriptorID getID()
returns the ID of this Plugin. Provided that the code of a plugin does not change, these IDs are persistent between executions of ProM.- Returns:
-
getContextType
java.lang.Class<? extends PluginContext> getContextType(int methodIndex)
Returns the context type required by the method at index methodIndex.- Parameters:
methodIndex
-0 <= methodIndex < getNumberOfMethods()
- Returns:
-
getTypesAtParameterIndex
java.util.Set<java.lang.Class<?>> getTypesAtParameterIndex(int globalParameterIndex)
Returns a list of types that can be accepted for the parameter at indexglobalParameterIndex
. The parameter index is global, i.e. not method specific. Instead, for each typet
in the set returned by this method it is guaranteed that there is at least one method (suppose at indexi
), such thatgetParameterType(i, getIndexInMethod(i, globalParameterIndex)) == t
- Parameters:
globalParameterIndex
-0 <= globalParameterIndex < getParameterNames().size()
- Returns:
-
getIndexInParameterNames
int getIndexInParameterNames(int methodIndex, int methodParameterIndex)
Returns the index of the method parameter of the given method in the list of global parameters. Each method of a plugin requires a subset of the global set of parameters that the plugin defines. This method can be used to map the index of each method parameter to the index of the global parameter.- Parameters:
methodIndex
-0 <= methodIndex < getNumberOfMethods()
methodParameterIndex
-0 <= methodParameterIndex < getParameterNames(methodIndex).size()
- Returns:
0 <= return < getParameterNames().size()
-
getIndexInMethod
int getIndexInMethod(int methodIndex, int globalParameterIndex)
Returns the index of the global parameter to the index of that parameter in the given method. Each method of a plugin requires a subset of the global set of parameters that the plugin defines. This method can be used to map the index of each global parameter to the index of the method parameter. Note that if the given method does not require the global parameter, -1 is returned.- Parameters:
methodIndex
-0 <= methodIndex < getNumberOfMethods()
globalParameterIndex
-0 <= globalParameterIndex < getParameterNames().size()
- Returns:
-1 <= return < getParameterNames(methodIndex).size()
-
getMethodLabel
java.lang.String getMethodLabel(int methodIndex)
Return the label of the given method, if specified. If no label was specified, the name of the plugin is returned.- Parameters:
methodIndex
-- Returns:
-
compareTo
int compareTo(PluginDescriptor plugin)
Compares this plugin with another plugins. Uses thegetName().toLowerCase()
for comparing. Only if names are equal, then the IDs are used for comparison. Comparison should be name-based between different implementing classes.- Specified by:
compareTo
in interfacejava.lang.Comparable<PluginDescriptor>
-
isUserAccessible
boolean isUserAccessible()
Returns true if this plugin can be used by the end-users. If this is set to false, such a plugin should not be presented to the end user by any context.- Returns:
-
handlesCancel
boolean handlesCancel()
Returns whether the plugin handles termination itself.- Returns:
-
getMostSignificantResult
int getMostSignificantResult()
Returns the index in the result array of the most significant result for this plugin- Returns:
- the index in the result array of the most significant result. If no results are returned by this plugin, anything can be returned.
-
getHelp
java.lang.String getHelp()
Return the help / description of the plugin.- Returns:
-
getMethodHelp
java.lang.String getMethodHelp(int methodIndex)
Return the help / description of the given method, if specified.- Parameters:
methodIndex
-- Returns:
-
getKeywords
java.lang.String[] getKeywords()
Return the set of keywords.- Returns:
- a set of keywords
-
getCategories
java.lang.String[] getCategories()
Return the set of categories.- Returns:
- a set of categories
-
meetsQualityThreshold
boolean meetsQualityThreshold()
Return whether this plug-in meets the quality threshold.- Returns:
- whether this plug-in meets the quality threshold
-
meetsLevelThreshold
boolean meetsLevelThreshold()
Return whether this plug-in meets the level threshold.- Returns:
- whether this plug-in meets the level threshold
-
getIcon
javax.swing.ImageIcon getIcon()
-
getURL
java.net.URL getURL()
-
-