本文整理了Java中jenkins.model.Jenkins.getPluginManager()
方法的一些代码示例,展示了Jenkins.getPluginManager()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getPluginManager()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getPluginManager
暂无
代码示例来源:origin: jenkinsci/jenkins
private static File getTargetFile(String name) {
return new File(Jenkins.getActiveInstance().getPluginManager().rootDir,name+".jpi");
}
}
代码示例来源:origin: jenkinsci/jenkins
private GroovyHookScript(String hook, Jenkins j) {
this(hook, j.servletContext, j.getRootDir(), j.getPluginManager().uberClassLoader);
}
代码示例来源:origin: jenkinsci/jenkins
public ClassLoader getClassLoader() {
return Jenkins.getInstance().getPluginManager().uberClassLoader;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public List<? extends ToolInstaller> getDefaultInstallers() {
try {
Class<? extends ToolInstaller> jdkInstallerClass = Jenkins.getInstance().getPluginManager()
.uberClassLoader.loadClass("hudson.tools.JDKInstaller").asSubclass(ToolInstaller.class);
Constructor<? extends ToolInstaller> constructor = jdkInstallerClass.getConstructor(String.class, boolean.class);
return Collections.singletonList(constructor.newInstance(null, false));
} catch (ClassNotFoundException e) {
return Collections.emptyList();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unable to get default installer", e);
return Collections.emptyList();
}
}
代码示例来源:origin: jenkinsci/jenkins
static <T extends Annotation> List<IndexItem<T,Object>> listDelta(Class<T> annotationType, List<? extends IndexItem<?,Object>> old) {
// list up newly discovered components
final List<IndexItem<T,Object>> delta = Lists.newArrayList();
ClassLoader cl = Jenkins.getInstance().getPluginManager().uberClassLoader;
for (IndexItem<T,Object> ii : Index.load(annotationType, Object.class, cl)) {
if (!old.contains(ii)) {
delta.add(ii);
}
}
return delta;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Loads all the extensions.
*/
protected List<ExtensionComponent<T>> load() {
if (LOGGER.isLoggable(Level.FINE))
LOGGER.log(Level.FINE,"Loading ExtensionList: "+extensionType, new Throwable());
return jenkins.getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated Use {@link #getAction(Class)} on {@code AbstractTestResultAction}.
*/
@Deprecated
public Action getTestResultAction() {
try {
return getAction(Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.tasks.test.AbstractTestResultAction").asSubclass(Action.class));
} catch (ClassNotFoundException x) {
return null;
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated Use {@link #getAction(Class)} on {@code AggregatedTestResultAction}.
*/
@Deprecated
public Action getAggregatedTestResultAction() {
try {
return getAction(Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.tasks.test.AggregatedTestResultAction").asSubclass(Action.class));
} catch (ClassNotFoundException x) {
return null;
}
}
代码示例来源:origin: jenkinsci/jenkins
@CheckForNull
public PluginWrapper getPlugin(@Nonnull UpdateSite.Warning warning) {
if (warning.type != UpdateSite.Warning.Type.PLUGIN) {
return null;
}
return Jenkins.get().getPluginManager().getPlugin(warning.component);
}
代码示例来源:origin: jenkinsci/jenkins
public ComputerLauncher getLauncher() {
if (launcher == null && !StringUtils.isEmpty(agentCommand)) {
try {
launcher = (ComputerLauncher) Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.slaves.CommandLauncher").getConstructor(String.class, EnvVars.class).newInstance(agentCommand, null);
agentCommand = null;
save();
} catch (Exception x) {
LOGGER.log(Level.WARNING, "could not update historical agentCommand setting to CommandLauncher", x);
}
}
// Default launcher does not use Work Directory
return launcher == null ? new JNLPLauncher(false) : launcher;
}
代码示例来源:origin: jenkinsci/jenkins
public Map<PluginWrapper, List<UpdateSite.Warning>> getActivePluginWarningsByPlugin() {
Map<PluginWrapper, List<UpdateSite.Warning>> activePluginWarningsByPlugin = new HashMap<>();
for (UpdateSite.Warning warning : getActiveWarnings()) {
if (warning.type != UpdateSite.Warning.Type.PLUGIN) {
// this is not a plugin warning
continue;
}
String pluginName = warning.component;
PluginWrapper plugin = Jenkins.getInstance().getPluginManager().getPlugin(pluginName);
if (!activePluginWarningsByPlugin.containsKey(plugin)) {
activePluginWarningsByPlugin.put(plugin, new ArrayList<UpdateSite.Warning>());
}
activePluginWarningsByPlugin.get(plugin).add(warning);
}
return activePluginWarningsByPlugin;
}
代码示例来源:origin: jenkinsci/jenkins
public boolean isActivated() {
if(pluginsWithCycle == null){
pluginsWithCycle = new ArrayList<>();
for (PluginWrapper p : Jenkins.getInstance().getPluginManager().getPlugins()) {
if(p.hasCycleDependency()){
pluginsWithCycle.add(p);
isActive = true;
}
}
}
return isActive;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected void configure() {
Jenkins j = Jenkins.getInstance();
bind(Jenkins.class).toInstance(j);
bind(PluginManager.class).toInstance(j.getPluginManager());
}
});
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns the plugin in which this descriptor is defined.
*
* @return
* null to indicate that this descriptor came from the core.
*/
protected PluginWrapper getPlugin() {
return Jenkins.getInstance().getPluginManager().whichPlugin(clazz);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Finds a resolved method annotated with {@link CLIResolver}.
*/
private Method findResolver(Class type) throws IOException {
List<Method> resolvers = Util.filter(Index.list(CLIResolver.class, Jenkins.get().getPluginManager().uberClassLoader), Method.class);
for ( ; type!=null; type=type.getSuperclass())
for (Method m : resolvers)
if (m.getReturnType()==type)
return m;
return null;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* If some version of this plugin is currently installed, return {@link PluginWrapper}.
* Otherwise null.
*/
@Exported
public PluginWrapper getInstalled() {
PluginManager pm = Jenkins.getInstance().getPluginManager();
return pm.getPlugin(name);
}
代码示例来源:origin: jenkinsci/jenkins
@RequirePOST
public HttpResponse doDoUninstall() throws IOException {
Jenkins jenkins = Jenkins.getActiveInstance();
jenkins.checkPermission(Jenkins.ADMINISTER);
archive.delete();
// Redo who depends on who.
jenkins.getPluginManager().resolveDependantPlugins();
return HttpResponses.redirectViaContextPath("/pluginManager/installed"); // send back to plugin manager
}
代码示例来源:origin: jenkinsci/jenkins
@Initializer(after=JOB_LOADED)
public static void init(Jenkins j) {
new GroovyHookScript("init", j.servletContext, j.getRootDir(), j.getPluginManager().uberClassLoader).run();
}
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected int run() throws Exception {
Jenkins jenkins = Jenkins.get();
jenkins.checkPermission(Jenkins.ADMINISTER);
PluginManager manager = jenkins.getPluginManager();
boolean enabledAnyPlugins = false;
for (String pluginName : pluginNames) {
enabledAnyPlugins |= enablePlugin(manager, pluginName);
}
if (restart && enabledAnyPlugins) {
jenkins.safeRestart();
}
return 0;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Does any of the plugin has updates?
*/
@Exported
public boolean hasUpdates() {
Data data = getData();
if(data==null) return false;
for (PluginWrapper pw : Jenkins.getInstance().getPluginManager().getPlugins()) {
if(!pw.isBundled() && pw.getUpdateInfo()!=null)
// do not advertize updates to bundled plugins, since we generally want users to get them
// as a part of jenkins.war updates. This also avoids unnecessary pinning of plugins.
return true;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!