hudson.model.Hudson.getPlugin()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中hudson.model.Hudson.getPlugin()方法的一些代码示例,展示了Hudson.getPlugin()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.getPlugin()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:getPlugin

Hudson.getPlugin介绍

[英]Gets the plugin object from its class.

This allows easy storage of plugin information in the plugin singleton without every plugin reimplementing the singleton pattern.
[中]从其类中获取插件对象。
这允许在插件单例中轻松存储插件信息,而无需每个插件重新实现单例模式。

代码示例

代码示例来源:origin: etsy/jenkins-master-project

public List<Descriptor<Publisher>> getPotentialPublisherDescriptors() {
 List<Descriptor<Publisher>> publishers =
   Lists.<Descriptor<Publisher>>newArrayList(MasterMailer.DESCRIPTOR);
 if (hudson.getPlugin("ircbot") != null) {
  publishers.add(IrcPublisher.DESCRIPTOR);
 }
 if (hudson.getPlugin("postbuild-task") != null) {
  publishers.add(hudson.getPublisher("PostbuildTask"));
 }
 if (hudson.getPlugin("build-pipeline-plugin") != null) {
  publishers.add(hudson.getPublisher("BuildPipelineTrigger"));
 }
 return publishers;
}

代码示例来源:origin: org.jvnet.hudson.plugins/ci-game

/**
 * Returns if the plugin is installed or not.
 * 
 * @return true, if the plugin is installed; false otherwise.
 */
@Override
public boolean isAvailable() {
  return (Hudson.getInstance().getPlugin(pluginName) != null);
}

代码示例来源:origin: jenkinsci/ci-game-plugin

/**
 * Returns if the plugin is installed or not.
 * 
 * @return true, if the plugin is installed; false otherwise.
 */
@Override
public boolean isAvailable() {
  return (Hudson.getInstance().getPlugin(pluginName) != null);
}

代码示例来源:origin: etsy/jenkins-master-project

@Override
public boolean isApplicable(Class<? extends Job> jobType) {
  return jobType.equals(MasterProject.class) && hudson.getPlugin("slack") != null && hudson.getPlugin("slack").getWrapper().isActive();
}

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Returns whether the specified plug-in is installed.
 *
 * @param shortName
 *            the plug-in to check
 * @return <code>true</code> if the specified plug-in is installed,
 *         <code>false</code> if not.
 */
public static boolean isPluginInstalled(final String shortName) {
  Hudson instance = Hudson.getInstance();
  if (instance != null) {
    return instance.getPlugin(shortName) != null;
  }
  return true;
}

代码示例来源:origin: org.jenkins-ci.plugins/ec2

public static PluginImpl get() {
  return Hudson.getInstance().getPlugin(PluginImpl.class);
}

代码示例来源:origin: org.jenkins-ci.plugins/global-build-stats

public static GlobalBuildStatsPlugin getInstance(){
  return Hudson.getInstance().getPlugin(GlobalBuildStatsPlugin.class);
}

代码示例来源:origin: jenkinsci/cobertura-plugin

@Extension(optional = true)
public static DescriptorImpl newInstance() {
  if (Hudson.getInstance().getPlugin("dashboard-view") != null) {
    return new DescriptorImpl();
  } else {
    return null;
  }
}

代码示例来源:origin: jenkinsci/m2release-plugin

@Extension(optional = true)
public static DescriptorImpl newInstance() {
  if (Hudson.getInstance().getPlugin("dashboard-view") != null) {
    return new DescriptorImpl();
  } else {
    return null;
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/collabnet

if (Hudson.getInstance().getPlugin("promoted-builds") != null) {

代码示例来源:origin: org.hudsonci.plugins/ivy

@SuppressWarnings("unchecked")
public ArrayList<Descriptor<IvyBuilderType>> getBuilderTypeDescriptors() {
  ArrayList<Descriptor<IvyBuilderType>> buildTypeDescriptors = new ArrayList<Descriptor<IvyBuilderType>>();
  buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(AntIvyBuilderType.class));
  if (Hudson.getInstance().getPlugin("nant") != null) {
    buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(NAntIvyBuilderType.class));
  }
  return buildTypeDescriptors;
}

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

@SuppressWarnings("unchecked")
public ArrayList<Descriptor<IvyBuilderType>> getBuilderTypeDescriptors() {
  ArrayList<Descriptor<IvyBuilderType>> buildTypeDescriptors = new ArrayList<Descriptor<IvyBuilderType>>();
  buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(AntIvyBuilderType.class));
  if (Hudson.getInstance().getPlugin("nant") != null) {
    buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(NAntIvyBuilderType.class));
  }
  return buildTypeDescriptors;
}

代码示例来源:origin: org.jenkins-ci.plugins/ivy

@SuppressWarnings("unchecked")
public ArrayList<Descriptor<IvyBuilderType>> getBuilderTypeDescriptors() {
  ArrayList<Descriptor<IvyBuilderType>> buildTypeDescriptors = new ArrayList<Descriptor<IvyBuilderType>>();
  buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(AntIvyBuilderType.class));
  if (Hudson.getInstance().getPlugin("nant") != null) {
    buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(NAntIvyBuilderType.class));
  }
  return buildTypeDescriptors;
}

代码示例来源:origin: org.jenkins-ci.plugins/collabnet

public String interpret(AbstractBuild<?,?> build, TaskListener listener) throws IOException, InterruptedException {
  Map<String, String> envVars;
  if (Hudson.getInstance().getPlugin("promoted-builds") != null
    && build.getClass().equals(Promotion.class)) {
    // if this is a promoted build, get the env vars from
    // the original build
    Promotion promotion = Promotion.class.cast(build);
    envVars = promotion.getTarget().getEnvironment(listener);
  } else {
    envVars = build.getEnvironment(listener);
  }
  //XXX should this use envVars instead of build.getEnv.... ?
  return CommonUtil.getInterpreted(envVars, value);
}

代码示例来源:origin: jenkinsci/instant-messaging-plugin

if (Hudson.getInstance().getPlugin("ci-game") != null) {
  UserScoreProperty property = user.getProperty(UserScoreProperty.class);
  if (property != null) {

代码示例来源:origin: org.hudsonci.plugins/instant-messaging

if (Hudson.getInstance().getPlugin("ci-game") != null) {
  UserScoreProperty property = user.getProperty(UserScoreProperty.class);
  if (property != null) {

代码示例来源:origin: org.jenkins-ci.plugins/collabnet

/**
 * Translates a string that may contain  build vars like ${BUILD_VAR} to
 * a string with those vars interpreted.
 * 
 * @param build the Jenkins build.
 * @param str the string to be interpreted.
 * @return the interpreted string.
 * @throws IllegalArgumentException if the env var is not found.
 */
private String getInterpreted(AbstractBuild<?, ?> build, String str)
    throws IOException, InterruptedException {
  Map<String, String> envVars = null;
  if (Hudson.getInstance().getPlugin("promoted-builds") != null
    && build.getClass().equals(Promotion.class)) {
    // if this is a promoted build, get the env vars from
    // the original build
    Promotion promotion = Promotion.class.cast(build);
    envVars = promotion.getTarget().getEnvironment(TaskListener.NULL);
  } else {
    envVars = build.getEnvironment(TaskListener.NULL);
  }
  try {
    //XXX should this use envVars instead of build.getEnv.... ?
    return CommonUtil.getInterpreted(build.getEnvironment(TaskListener.NULL), str);
  } catch (IllegalArgumentException iae) {
    this.log(iae.getMessage());
    throw iae;
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/build-pipeline-plugin

pbList.add(newPB);
if (Hudson.getInstance().getPlugin("parameterized-trigger") != null) {
  for (SubProjectsAction action : Util.filter(currentProject.getActions(), SubProjectsAction.class)) {
    for (BlockableBuildTriggerConfig config : action.getConfigs()) {

代码示例来源:origin: etsy/jenkins-master-project

private void rebuildNotify() {
 if (masterBuild.getNotifyOnRebuild() && hudson.getPlugin("slack") != null && hudson.getPlugin("slack").getWrapper().isActive()) {
  if (masterBuild.getResult() == Result.SUCCESS) {
   SlackNotifier notifier = null;
   Map<Descriptor<Publisher>, Publisher> map = masterBuild.getProject().getPublishersList().toMap();
   for (Publisher publisher : map.values()) {
    if (publisher instanceof SlackNotifier) {
     notifier = (SlackNotifier) publisher;
    }
   }
   ActiveNotifier.MessageBuilder messageBuilder = new ActiveNotifier.MessageBuilder(notifier, masterBuild);
   String message = messageBuilder.append(" Rebuild was successful").appendOpenLink().toString();
   notifier.newSlackService(masterBuild, new StreamBuildListener(new NullOutputStream())).publish(message, "good");
  }
 }
}

代码示例来源:origin: org.jenkins-ci.plugins/build-pipeline-plugin

if (Hudson.getInstance().getPlugin("parameterized-trigger") != null) {
  for (SubProjectsAction action : Util.filter(project.getActions(), SubProjectsAction.class)) {
    for (hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig config : action.getConfigs()) {

相关文章

Hudson类方法