File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\PluginStrategy.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson;
25
26 import hudson.model.Hudson;
27 import jenkins.model.Jenkins;
28
29 import java.io.File;
30 import java.io.IOException;
31 import java.util.List;
32
33 /**
34 * Pluggability point for how to create {@link PluginWrapper}.
35 *
36 * <p>
37 * This extension point was added to allow plugins to be loaded into a different environment
38 * (such as loading it in an existing DI container like Plexus.) A plugin strategy is a singleton
39 * instance, and as such this feature is primarily meant for OEM.
40 *
41 * See {@link PluginManager#createPluginStrategy()} for how this instance is created.
42 */
43 public interface PluginStrategy extends ExtensionPoint {
44
45 /**
46 * Creates a plugin wrapper, which provides a management interface for the plugin
47 * @param archive
48 * Either a directory that points to a pre-exploded plugin, or an jpi file, or an jpl file.
49 */
50 PluginWrapper createPluginWrapper(File archive)
51 throws IOException;
52
53 /**
54 * Loads the plugin and starts it.
55 *
56 * <p>
57 * This should be done after all the classloaders are constructed for all
58 * the plugins, so that dependencies can be properly loaded by plugins.
59 */
60 void load(PluginWrapper wrapper) throws IOException;
61
62 /**
63 * Optionally start services provided by the plugin. Should be called
64 * when all plugins are loaded.
65 *
66 * @param plugin
67 */
68 void initializeComponents(PluginWrapper plugin);
69
70 /**
71 * Find components of the given type using the assigned strategy.
72 *
73 *
74 * @param type The component type
75 * @param hudson The Hudson scope
76 * @return Sequence of components
77 * @since 1.400
78 */
79 <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson hudson);
80 }
81