Package hudson
Class ClassicPluginStrategy
- java.lang.Object
-
- hudson.ClassicPluginStrategy
-
- All Implemented Interfaces:
ExtensionPoint
,PluginStrategy
public class ClassicPluginStrategy extends Object implements PluginStrategy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
useAntClassLoader
-
Constructor Summary
Constructors Constructor Description ClassicPluginStrategy(PluginManager pluginManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected ClassLoader
createClassLoader(List<File> paths, ClassLoader parent)
Deprecated.protected ClassLoader
createClassLoader(List<File> paths, ClassLoader parent, Attributes atts)
Creates the classloader that can load all the specified jar files and delegate to the given parent.PluginWrapper
createPluginWrapper(File archive)
Creates a plugin wrapper, which provides a management interface for the plugin<T> List<ExtensionComponent<T>>
findComponents(Class<T> type, Hudson hudson)
Find components of the given type using the assigned strategy.static List<PluginWrapper.Dependency>
getImpliedDependencies(String pluginName, String jenkinsVersion)
Deprecated.since 2.163String
getShortName(File archive)
Finds the plugin name without actually unpacking anythingPluginStrategy.createPluginWrapper(java.io.File)
would.void
initializeComponents(PluginWrapper plugin)
Optionally start services provided by the plugin.void
load(PluginWrapper wrapper)
Loads the plugin and starts it.void
startPlugin(PluginWrapper plugin)
void
updateDependency(PluginWrapper depender, PluginWrapper dependee)
Called when a plugin is installed, but there was already a plugin installed which optionally depended on that plugin.
-
-
-
Constructor Detail
-
ClassicPluginStrategy
public ClassicPluginStrategy(PluginManager pluginManager)
-
-
Method Detail
-
getShortName
public String getShortName(File archive) throws IOException
Description copied from interface:PluginStrategy
Finds the plugin name without actually unpacking anythingPluginStrategy.createPluginWrapper(java.io.File)
would. Needed byPluginManager.dynamicLoad(java.io.File)
to decide whether such a plugin is already installed.- Specified by:
getShortName
in interfacePluginStrategy
- Returns:
- the
PluginWrapper.getShortName()
- Throws:
IOException
-
createPluginWrapper
public PluginWrapper createPluginWrapper(File archive) throws IOException
Description copied from interface:PluginStrategy
Creates a plugin wrapper, which provides a management interface for the plugin- Specified by:
createPluginWrapper
in interfacePluginStrategy
- Parameters:
archive
- Either a directory that points to a pre-exploded plugin, or an jpi file, or an jpl file.- Throws:
IOException
-
getImpliedDependencies
@Deprecated @NonNull public static List<PluginWrapper.Dependency> getImpliedDependencies(String pluginName, String jenkinsVersion)
Deprecated.since 2.163
-
createClassLoader
@Deprecated protected ClassLoader createClassLoader(List<File> paths, ClassLoader parent) throws IOException
Deprecated.- Throws:
IOException
-
createClassLoader
protected ClassLoader createClassLoader(List<File> paths, ClassLoader parent, Attributes atts) throws IOException
Creates the classloader that can load all the specified jar files and delegate to the given parent.- Throws:
IOException
-
initializeComponents
public void initializeComponents(PluginWrapper plugin)
Description copied from interface:PluginStrategy
Optionally start services provided by the plugin. Should be called when all plugins are loaded.- Specified by:
initializeComponents
in interfacePluginStrategy
-
findComponents
public <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson hudson)
Description copied from interface:PluginStrategy
Find components of the given type using the assigned strategy.- Specified by:
findComponents
in interfacePluginStrategy
- Parameters:
type
- The component typehudson
- The Hudson scope- Returns:
- Sequence of components
-
load
public void load(PluginWrapper wrapper) throws IOException
Description copied from interface:PluginStrategy
Loads the plugin and starts it.This should be done after all the classloaders are constructed for all the plugins, so that dependencies can be properly loaded by plugins.
- Specified by:
load
in interfacePluginStrategy
- Throws:
IOException
-
startPlugin
public void startPlugin(PluginWrapper plugin) throws Exception
- Throws:
Exception
-
updateDependency
public void updateDependency(PluginWrapper depender, PluginWrapper dependee)
Description copied from interface:PluginStrategy
Called when a plugin is installed, but there was already a plugin installed which optionally depended on that plugin. The class loader of the existing depending plugin should be updated to load classes from the newly installed plugin.- Specified by:
updateDependency
in interfacePluginStrategy
- Parameters:
depender
- plugin depending on dependee.dependee
- newly loaded plugin.
-
-