public class PluginManager
extends java.lang.Object
Constructor and Description |
---|
PluginManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addFromProperties(java.io.File propsFile)
Add all key value pairs from the supplied property file
|
static void |
addFromProperties(java.io.File propsFile,
boolean maintainInsertionOrder)
Add all key value pairs from the supplied property file
|
static void |
addFromProperties(java.io.InputStream propsStream)
Add all key value pairs from the supplied properties stream
|
static void |
addFromProperties(java.io.InputStream propsStream,
boolean maintainInsertionOrder)
Add all key value pairs from the supplied properties stream
|
static void |
addFromProperties(java.util.Properties props)
Add all key value pairs from the supplied properties object
|
static void |
addFromProperties(java.util.Properties props,
boolean maintainInsertionOrder)
Add all key value pairs from the supplied properties object
|
static void |
addFromProperties(java.lang.String packageName,
java.io.File propsFile)
Add all key value pairs from the supplied property file
|
static void |
addFromProperties(java.lang.String packageName,
java.io.File propsFile,
boolean maintainInsertionOrder)
Add all key value pairs from the supplied property file
|
static void |
addFromProperties(java.lang.String packageName,
java.io.InputStream propsStream)
Add all key value pairs from the supplied properties stream
|
static void |
addFromProperties(java.lang.String packageName,
java.io.InputStream propsStream,
boolean maintainInsertionOrder)
Add all key value pairs from the supplied properties stream
|
static void |
addFromProperties(java.lang.String packageName,
java.util.Properties props)
Add all key value pairs from the supplied properties object
|
static void |
addFromProperties(java.lang.String packageName,
java.util.Properties props,
boolean maintainInsertionOrder)
Add all key value pairs from the supplied properties object
|
static void |
addPlugin(java.lang.String interfaceName,
java.lang.String name,
java.lang.String concreteType)
Add a plugin.
|
static void |
addPlugin(java.lang.String interfaceName,
java.lang.String name,
java.lang.String concreteType,
boolean maintainInsertionOrder)
Add a plugin.
|
static void |
addPluginResource(java.lang.String resourceGroupID,
java.lang.String resourceDescription,
java.lang.String resourcePath)
Add a resource.
|
static void |
addPluginResource(java.lang.String packageName,
java.lang.String resourceGroupID,
java.lang.String resourceDescription,
java.lang.String resourcePath)
Add a resource.
|
static void |
addPluginResourcesFromProperty(java.lang.String resourceList)
Add resources from a list.
|
static void |
addToDisabledList(java.util.List<java.lang.String> classnames)
Add the supplied list of fully qualified class names to the disabled list
|
static void |
addToDisabledList(java.lang.String classname)
Add the supplied fully qualified class name to the list of disabled plugins
|
static java.lang.Object |
getPluginInstance(java.lang.String interfaceType,
java.lang.String name)
Get an instance of a concrete implementation of a plugin type
|
static java.util.Set<java.lang.String> |
getPluginNamesOfType(java.lang.String interfaceName)
Get a set of names of plugins that implement the supplied interface.
|
static java.util.List<java.lang.String> |
getPluginNamesOfTypeList(java.lang.String interfaceName)
Get a sorted list of names of plugins that implement the supplied interface.
|
static java.io.InputStream |
getPluginResourceAsStream(java.lang.String resourceGroupID,
java.lang.String resourceDescription)
Get an input stream for a named resource under a given resource group ID.
|
static java.util.Map<java.lang.String,java.lang.String> |
getResourcesWithGroupID(java.lang.String resourceGroupID)
Get a map of resources (description,path) registered under a given resource
group ID.
|
static boolean |
isInDisabledList(java.lang.String classname)
Returns true if the supplied fully qualified class name is in the disabled
list
|
static int |
numResourcesForWithGroupID(java.lang.String resourceGroupID)
Get the number of resources available under a given resource group ID.
|
static boolean |
pluginRegistered(java.lang.String interfaceType,
java.lang.String name)
Checks if a named plugin exists in the map of registered plugins
|
static void |
removeFromDisabledList(java.util.List<java.lang.String> classnames)
Remove the supplied list of fully qualified class names to the disabled
list
|
static void |
removeFromDisabledList(java.lang.String classname)
Remove the supplied fully qualified class name from the list of disabled
plugins
|
static void |
removePlugin(java.lang.String interfaceName,
java.lang.String name)
Remove a plugin.
|
static void |
removePlugins(java.lang.String interfaceName,
java.util.List<java.lang.String> names)
Remove plugins of a specific type.
|
public static void addToDisabledList(java.util.List<java.lang.String> classnames)
classnames
- a list of class names to addpublic static void addToDisabledList(java.lang.String classname)
classname
- the fully qualified name of a class to addpublic static void removeFromDisabledList(java.util.List<java.lang.String> classnames)
classnames
- a list of class names to removepublic static void removeFromDisabledList(java.lang.String classname)
classname
- the fully qualified name of a class to removepublic static boolean isInDisabledList(java.lang.String classname)
classname
- the name of the class to checkpublic static void addFromProperties(java.io.File propsFile) throws java.lang.Exception
propsFile
- the properties file to addjava.lang.Exception
- if a problem occurspublic static void addFromProperties(java.lang.String packageName, java.io.File propsFile) throws java.lang.Exception
packageName
- the name of the Weka package that owns this properties
object. Can be null if not owned by a Weka packagepropsFile
- the properties file to addjava.lang.Exception
- if a problem occurspublic static void addFromProperties(java.io.File propsFile, boolean maintainInsertionOrder) throws java.lang.Exception
propsFile
- the properties file to addmaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)java.lang.Exception
- if a problem occurspublic static void addFromProperties(java.lang.String packageName, java.io.File propsFile, boolean maintainInsertionOrder) throws java.lang.Exception
packageName
- the name of the Weka package that owns this properties
object. Can be null if not owned by a Weka packagepropsFile
- the properties file to addmaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)java.lang.Exception
- if a problem occurspublic static void addFromProperties(java.io.InputStream propsStream) throws java.lang.Exception
propsStream
- an input stream to a properties filejava.lang.Exception
- if a problem occurspublic static void addFromProperties(java.lang.String packageName, java.io.InputStream propsStream) throws java.lang.Exception
packageName
- the name of the Weka package that owns this properties
object. Can be null if not owned by a Weka packagepropsStream
- an input stream to a properties filejava.lang.Exception
- if a problem occurspublic static void addFromProperties(java.io.InputStream propsStream, boolean maintainInsertionOrder) throws java.lang.Exception
propsStream
- an input stream to a properties filemaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)java.lang.Exception
- if a problem occurspublic static void addFromProperties(java.lang.String packageName, java.io.InputStream propsStream, boolean maintainInsertionOrder) throws java.lang.Exception
packageName
- the name of the Weka package that owns this properties
object. Can be null if not owned by a Weka packagepropsStream
- an input stream to a properties filemaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)java.lang.Exception
- if a problem occurspublic static void addFromProperties(java.util.Properties props) throws java.lang.Exception
props
- a Properties objectjava.lang.Exception
- if a problem occurspublic static void addFromProperties(java.lang.String packageName, java.util.Properties props) throws java.lang.Exception
packageName
- the name of the Weka package that owns this properties
object. Can be null if not owned by a Weka packageprops
- a Properties objectjava.lang.Exception
- if a problem occurspublic static void addFromProperties(java.util.Properties props, boolean maintainInsertionOrder) throws java.lang.Exception
props
- a Properties objectmaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)java.lang.Exception
- if a problem occurspublic static void addFromProperties(java.lang.String packageName, java.util.Properties props, boolean maintainInsertionOrder) throws java.lang.Exception
packageName
- the name of the Weka package that owns this properties
object. Can be null if not owned by a Weka packageprops
- a Properties objectmaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)java.lang.Exception
- if a problem occurspublic static void addPluginResourcesFromProperty(java.lang.String resourceList)
[groupID|description|path],[groupID|description|path],...
resourceList
- a list of resources to addpublic static void addPluginResource(java.lang.String resourceGroupID, java.lang.String resourceDescription, java.lang.String resourcePath)
resourceGroupID
- the ID of the group under which the resource should
be storedresourceDescription
- the description/ID of the resourceresourcePath
- the path to the resourcepublic static void addPluginResource(java.lang.String packageName, java.lang.String resourceGroupID, java.lang.String resourceDescription, java.lang.String resourcePath)
packageName
- the name of the package that owns this resource. Can be
null if not owned by a package, in which case the current
classloader will be used to load the resource.resourceGroupID
- the ID of the group under which the resource should
be storedresourceDescription
- the description/ID of the resourceresourcePath
- the path to the resourcepublic static java.io.InputStream getPluginResourceAsStream(java.lang.String resourceGroupID, java.lang.String resourceDescription) throws java.io.IOException
resourceGroupID
- the group ID that the resource falls underresourceDescription
- the description/ID of the resourcejava.io.IOException
- if the group ID or resource description/ID are not
known to the PluginManager, or a problem occurs while trying to
open an input streampublic static int numResourcesForWithGroupID(java.lang.String resourceGroupID)
resourceGroupID
- the group ID of the resourcespublic static java.util.Map<java.lang.String,java.lang.String> getResourcesWithGroupID(java.lang.String resourceGroupID)
resourceGroupID
- the group ID of the resources to getpublic static java.util.Set<java.lang.String> getPluginNamesOfType(java.lang.String interfaceName)
interfaceName
- the fully qualified name of the interface to list
plugins forpublic static java.util.List<java.lang.String> getPluginNamesOfTypeList(java.lang.String interfaceName)
interfaceName
- the fully qualified name of the interface to list
plugins forpublic static void addPlugin(java.lang.String interfaceName, java.lang.String name, java.lang.String concreteType)
interfaceName
- the fully qualified interface name that the plugin
implementsname
- the name/short description of the pluginconcreteType
- the fully qualified class name of the actual concrete
implementationpublic static void addPlugin(java.lang.String interfaceName, java.lang.String name, java.lang.String concreteType, boolean maintainInsertionOrder)
interfaceName
- the fully qualified interface name that the plugin
implementsname
- the name/short description of the pluginconcreteType
- the fully qualified class name of the actual concrete
implementationmaintainInsertionOrder
- true if the order of insertion of
implementations is to be preserved (rather than sorted order)public static void removePlugins(java.lang.String interfaceName, java.util.List<java.lang.String> names)
interfaceName
- the fully qualified interface name that the plugins to
be remove implementnames
- a list of named plugins to removepublic static void removePlugin(java.lang.String interfaceName, java.lang.String name)
interfaceName
- the fully qualified interface name that the plugin
implementsname
- the name/short description of the pluginpublic static boolean pluginRegistered(java.lang.String interfaceType, java.lang.String name)
interfaceType
- the fully qualified interface name of the plugin typename
- the name/short description of the plugin to getpublic static java.lang.Object getPluginInstance(java.lang.String interfaceType, java.lang.String name) throws java.lang.Exception
interfaceType
- the fully qualified interface name of the plugin typename
- the name/short description of the plugin to getjava.lang.Exception
- if the plugin can't be found or instantiated