Class PluginInterfaceImpl
java.lang.Object
com.biglybt.pifimpl.local.PluginInterfaceImpl
- All Implemented Interfaces:
CoreComponent, PluginInterface
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Listprotected ClassLoaderprivate PluginConfigImplprivate CopyOnWriteList<PluginEventListener> private StringThis is the plugin ID value we were given when we were created.private Set<PluginListener> private PluginInitializerprivate Objectprivate IPCInterfaceImplprivate Stringprivate CopyOnWriteList<PluginListener> private Loggerprivate static final LogIDsprivate Pluginprivate StringWe store this value as soon as someone calls getPluginID(), meaning we will return a consistent value for the plugin's lifetime.private Stringprivate Stringprivate Stringprivate Propertiesprivate final PluginStateImpl -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPluginInterfaceImpl(Plugin _plugin, PluginInitializer _initialiser, Object _initialiser_key, ClassLoader _class_loader, List<File> _verified_files, String _key, Properties _props, String _pluginDir, String _plugin_id, String _plugin_version) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidprotected voidprotected voidprotected voiddestroy()protected voidfireInitComplete(PluginListener listener) voidfirePluginEvent(PluginEvent event) Fire a plugin-specific event.protected voidprotected voidgenerateEvidence(IndentWriter writer) Returns the name of the application that the user sees - if you need to display the name of the program, you should use this method.Retrieve the Application's version as a string.Retrieve the name of the application.Get the connection manager.Get the distributed databaseGives access to the download managergetIPC()Get the inter-plugin-communications interface for this pluginGives access to the IP filtergetLocalPluginInterface(Class plugin_class, String id) Returns an initialised plugin instance with its own scope (e.g.Gives access to the loggerReturns the manager object for registering plugins that connect to the Mainline DHT.Get the peer messaging manager.gives access to the per-user plugin directory.Gets the platform manager that gives access to native functionalityGives access to the plugin itselfgives access to the ClassLoader used to load the pluginGives access to the plugin config interfaceGives access to the plugin installation path - note, if you want to use this path to store data files in, it would be better for you to usePluginConfig.getPluginUserFile(String)instead.Returns an identifier used to identify this particular plugingives access to the plugin managerReturns the value of "plugin.name" if it exists in the properties file, otherwise the directory name is returned.gives access to the plugin propertiesReturns an object that provides information the current state of the plugin, and provides various mechanisms to query and control plugins and their integration with the client at a low-level.(package private) PluginStateImplReturns the version number of the plugin it if can be deduced from either the name of the jar file it is loaded from or the properties file.Gives access to the sharing functionalityaccess to a set of convenience routines for doing things in a quicker, although less structured, fashionGives access to the torrent managerGives access to the tracker functionalityaccess to UI extension featuresaccess to the update manager used to update plugins.access to various utility functionsprotected voidbooleanIndicates whether or not the current thread is the one responsible for running plugin initialisationvoidvoid(package private) voidvoidsetPluginDirectoryName(String name) voidsetPluginName(String name) voidsetPluginVersion(String version) protected void
-
Field Details
-
LOGID
-
plugin
-
initialiser
-
initialiser_key
-
class_loader
-
listeners
-
init_complete_fired_set
-
event_listeners
-
key
-
pluginConfigKey
-
props
-
pluginDir
-
config
-
plugin_version
-
logger
-
ipc_interface
-
children
-
state
-
given_plugin_id
This is the plugin ID value we were given when we were created. We might use it, but it depends what value is the plugins properties (which will override this value). -
plugin_id_to_use
We store this value as soon as someone calls getPluginID(), meaning we will return a consistent value for the plugin's lifetime.
-
-
Constructor Details
-
PluginInterfaceImpl
protected PluginInterfaceImpl(Plugin _plugin, PluginInitializer _initialiser, Object _initialiser_key, ClassLoader _class_loader, List<File> _verified_files, String _key, Properties _props, String _pluginDir, String _plugin_id, String _plugin_version) throws PluginException - Throws:
PluginException
-
-
Method Details
-
getPlugin
Description copied from interface:PluginInterfaceGives access to the plugin itself- Specified by:
getPluginin interfacePluginInterface
-
getInitializerKey
-
getPluginManager
Description copied from interface:PluginInterfacegives access to the plugin manager- Specified by:
getPluginManagerin interfacePluginInterface
-
getApplicationName
Description copied from interface:PluginInterfaceReturns the name of the application that the user sees - if you need to display the name of the program, you should use this method.- Specified by:
getApplicationNamein interfacePluginInterface
-
getAzureusName
Description copied from interface:PluginInterfaceRetrieve the name of the application.- Specified by:
getAzureusNamein interfacePluginInterface- Returns:
- the Application's name
-
getApplicationVersion
Description copied from interface:PluginInterfaceRetrieve the Application's version as a string.- Specified by:
getApplicationVersionin interfacePluginInterface- Returns:
- Application's version. Typically in the following formats (regexp):
[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+_CVS
[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+_B[0-9]+
-
setPluginName
-
getPluginName
Description copied from interface:PluginInterfaceReturns the value of "plugin.name" if it exists in the properties file, otherwise the directory name is returned.- Specified by:
getPluginNamein interfacePluginInterface
-
setPluginVersion
-
getPluginVersion
Description copied from interface:PluginInterfaceReturns the version number of the plugin it if can be deduced from either the name of the jar file it is loaded from or the properties file. null otherwise- Specified by:
getPluginVersionin interfacePluginInterface- Returns:
- Version number as a string, or null
-
getPluginID
Description copied from interface:PluginInterfaceReturns an identifier used to identify this particular plugin- Specified by:
getPluginIDin interfacePluginInterface
-
getPluginProperties
Description copied from interface:PluginInterfacegives access to the plugin properties- Specified by:
getPluginPropertiesin interfacePluginInterface- Returns:
- the properties from the file plugin.properties
-
getPluginDirectoryName
Description copied from interface:PluginInterfaceGives access to the plugin installation path - note, if you want to use this path to store data files in, it would be better for you to usePluginConfig.getPluginUserFile(String)instead.- Specified by:
getPluginDirectoryNamein interfacePluginInterface- Returns:
- the full path the plugin is installed in
-
getPerUserPluginDirectoryName
Description copied from interface:PluginInterfacegives access to the per-user plugin directory. Useful for shared plugins that need to store per-user state. Will be same as getPluginDirectoryName for per-user installed plugins directory may not yet exist- Specified by:
getPerUserPluginDirectoryNamein interfacePluginInterface
-
setPluginDirectoryName
-
getPluginconfig
Description copied from interface:PluginInterfaceGives access to the plugin config interface- Specified by:
getPluginconfigin interfacePluginInterface- Returns:
- the PluginConfig object associated with this plugin
-
getPluginConfigKey
-
getTracker
Description copied from interface:PluginInterfaceGives access to the tracker functionality- Specified by:
getTrackerin interfacePluginInterface- Returns:
- The tracker
-
getDownloadManager
Description copied from interface:PluginInterfaceGives access to the download manager- Specified by:
getDownloadManagerin interfacePluginInterface- Returns:
- An object that allows management of downloads
-
getMainlineDHTManager
Description copied from interface:PluginInterfaceReturns the manager object for registering plugins that connect to the Mainline DHT.- Specified by:
getMainlineDHTManagerin interfacePluginInterface
-
getTorrentManager
Description copied from interface:PluginInterfaceGives access to the torrent manager- Specified by:
getTorrentManagerin interfacePluginInterface- Returns:
- An object to manage torrents
-
getLogger
Description copied from interface:PluginInterfaceGives access to the logger- Specified by:
getLoggerin interfacePluginInterface- Returns:
- The logger
-
getIPFilter
Description copied from interface:PluginInterfaceGives access to the IP filter- Specified by:
getIPFilterin interfacePluginInterface- Returns:
- An object that allows access to IP Filtering
-
getUtilities
Description copied from interface:PluginInterfaceaccess to various utility functions- Specified by:
getUtilitiesin interfacePluginInterface
-
getShortCuts
Description copied from interface:PluginInterfaceaccess to a set of convenience routines for doing things in a quicker, although less structured, fashion- Specified by:
getShortCutsin interfacePluginInterface
-
getUIManager
Description copied from interface:PluginInterfaceaccess to UI extension features- Specified by:
getUIManagerin interfacePluginInterface
-
getUpdateManager
Description copied from interface:PluginInterfaceaccess to the update manager used to update plugins. required for non-Azureus SF hosted plugins (SF ones are managed automatically)- Specified by:
getUpdateManagerin interfacePluginInterface
-
unloadSupport
protected void unloadSupport() -
isInitialisationThread
public boolean isInitialisationThread()Description copied from interface:PluginInterfaceIndicates whether or not the current thread is the one responsible for running plugin initialisation- Specified by:
isInitialisationThreadin interfacePluginInterface
-
getClientIDManager
- Specified by:
getClientIDManagerin interfacePluginInterface
-
getConnectionManager
Description copied from interface:PluginInterfaceGet the connection manager.- Specified by:
getConnectionManagerin interfacePluginInterface- Returns:
- manager
-
getMessageManager
Description copied from interface:PluginInterfaceGet the peer messaging manager.- Specified by:
getMessageManagerin interfacePluginInterface- Returns:
- manager
-
getDistributedDatabase
Description copied from interface:PluginInterfaceGet the distributed database- Specified by:
getDistributedDatabasein interfacePluginInterface
-
getPlatformManager
Description copied from interface:PluginInterfaceGets the platform manager that gives access to native functionality- Specified by:
getPlatformManagerin interfacePluginInterface
-
initialisationComplete
protected void initialisationComplete() -
fireInitComplete
-
closedownInitiated
protected void closedownInitiated() -
closedownComplete
protected void closedownComplete() -
getPluginClassLoader
Description copied from interface:PluginInterfacegives access to the ClassLoader used to load the plugin- Specified by:
getPluginClassLoaderin interfacePluginInterface
-
getLocalPluginInterface
public PluginInterface getLocalPluginInterface(Class plugin_class, String id) throws PluginException Description copied from interface:PluginInterfaceReturns an initialised plugin instance with its own scope (e.g. for config params). Designed for loading secondary plugins directly from a primary one. Note - ensure that the bundled secondary plugins do *not* contain a plugin.properties as this will cause no end of problems.- Specified by:
getLocalPluginInterfacein interfacePluginInterface- Parameters:
plugin_class- must implement Pluginid- the unique id of this plugin (used to scope config params etc)- Throws:
PluginException
-
getIPC
Description copied from interface:PluginInterfaceGet the inter-plugin-communications interface for this plugin- Specified by:
getIPCin interfacePluginInterface
-
setAsFailed
void setAsFailed() -
destroy
protected void destroy() -
addListener
- Specified by:
addListenerin interfacePluginInterface
-
removeListener
- Specified by:
removeListenerin interfacePluginInterface
-
addEventListener
- Specified by:
addEventListenerin interfacePluginInterface
-
removeEventListener
- Specified by:
removeEventListenerin interfacePluginInterface
-
firePluginEvent
Description copied from interface:PluginInterfaceFire a plugin-specific event. See PluginEvent for details of type values to use- Specified by:
firePluginEventin interfacePluginInterface- Parameters:
event- plugin event
-
firePluginEventSupport
-
generateEvidence
-
getPluginState
Description copied from interface:PluginInterfaceReturns an object that provides information the current state of the plugin, and provides various mechanisms to query and control plugins and their integration with the client at a low-level.- Specified by:
getPluginStatein interfacePluginInterface
-
getPluginStateImpl
PluginStateImpl getPluginStateImpl()
-