Package io.manebot.plugin
Interface PluginManager
-
public interface PluginManager
The PluginManager handles loading and unload plugins from the system.
-
-
Method Summary
Modifier and Type Method Description java.util.Collection<ArtifactDependency>
getDependencies(ArtifactIdentifier identifier)
Finds all dependencies for a specific plugin artifact identifier.default java.util.Collection<Plugin>
getDisabledPlugins()
Gets a list of disabled plugins.default java.util.Collection<Plugin>
getEnabledPlugins()
Gets a list of enabled plugins.java.util.Collection<Plugin>
getLoadedPlugins()
Gets an immutable collection of loaded plugins.PluginLoaderRegistry
getLoaderRegistry()
Gets this PluginManager's PluginLoaderRegistry instance, used to load plugins from LocalArtifacts.default PluginRegistration
getPlugin(ArtifactIdentifier id)
Finds a previously installed plugin by its artifact identifier.default PluginRegistration
getPlugin(ManifestIdentifier id)
Finds a previously installed plugin by its artifact identifier.java.util.Collection<PluginRegistration>
getPlugins()
Gets an immutable collection of registered plugins.ArtifactRepository
getRepostiory()
Gets the plugin and library repository.PluginRegistration
install(ArtifactIdentifier artifactIdentifier)
Adds a plugin to the system.boolean
isInstalled(ArtifactIdentifier artifactIdentifier)
Finds if the specified artifact identifier is installed.ArtifactIdentifier
resolveIdentifier(java.lang.String friendlyName)
Resolves an identifier by its friendly name, or returns an artifact identifier otherwise.boolean
uninstall(PluginRegistration registration)
Removes a plugin from the system.
-
-
-
Method Detail
-
getRepostiory
ArtifactRepository getRepostiory()
Gets the plugin and library repository.- Returns:
- global repository.
-
getLoaderRegistry
PluginLoaderRegistry getLoaderRegistry()
Gets this PluginManager's PluginLoaderRegistry instance, used to load plugins from LocalArtifacts.- Returns:
- PluginLoaderRegistry instance.
-
getLoadedPlugins
java.util.Collection<Plugin> getLoadedPlugins()
Gets an immutable collection of loaded plugins.- Returns:
- Plugin collection.
-
getPlugins
java.util.Collection<PluginRegistration> getPlugins()
Gets an immutable collection of registered plugins.- Returns:
- Plugin collection.
-
getDependencies
java.util.Collection<ArtifactDependency> getDependencies(ArtifactIdentifier identifier) throws ArtifactRepositoryException, ArtifactNotFoundException
Finds all dependencies for a specific plugin artifact identifier.- Parameters:
identifier
- Plugin ArtifactIdentifier to find dependencies for.- Returns:
- immutable collection of artifact dependencies.
- Throws:
ArtifactRepositoryException
ArtifactNotFoundException
-
install
PluginRegistration install(ArtifactIdentifier artifactIdentifier) throws java.lang.IllegalArgumentException, PluginLoadException
Adds a plugin to the system.- Parameters:
artifactIdentifier
- Plugin ArtifactIdentifier to add.- Returns:
- PluginRegistration instance that was installed.
- Throws:
java.lang.IllegalArgumentException
- if there is a problem obtaining a plugin from the given artifact identifierPluginLoadException
- if there is a problem loading the plugin
-
uninstall
boolean uninstall(PluginRegistration registration)
Removes a plugin from the system.- Parameters:
registration
- Plugin registration instance to remove.- Returns:
- true if the plugin was removed, false otherwise.
-
isInstalled
boolean isInstalled(ArtifactIdentifier artifactIdentifier)
Finds if the specified artifact identifier is installed.- Parameters:
artifactIdentifier
- artifact identifier to check.- Returns:
- true if the identifier is installed, false otherwise.
-
getPlugin
default PluginRegistration getPlugin(ArtifactIdentifier id)
Finds a previously installed plugin by its artifact identifier.- Parameters:
id
- artifact identifier- Returns:
- Plugin instance if one is found, null otherwise.
-
getPlugin
default PluginRegistration getPlugin(ManifestIdentifier id)
Finds a previously installed plugin by its artifact identifier.- Parameters:
id
- manifest identifier- Returns:
- Plugin instance if one is found, null otherwise.
-
getEnabledPlugins
default java.util.Collection<Plugin> getEnabledPlugins()
Gets a list of enabled plugins.- Returns:
- enabled plugins.
-
getDisabledPlugins
default java.util.Collection<Plugin> getDisabledPlugins()
Gets a list of disabled plugins.- Returns:
- disabled plugins.
-
resolveIdentifier
ArtifactIdentifier resolveIdentifier(java.lang.String friendlyName)
Resolves an identifier by its friendly name, or returns an artifact identifier otherwise.- Parameters:
friendlyName
- Friendly name.- Returns:
- ArtifactIdentifier instance.
-
-