jenkins.model.Jenkins.getExtensionList()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(267)

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

Jenkins.getExtensionList介绍

[英]Returns ExtensionList that retains the discovered instances for the given extension type.
[中]

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the {@link Descriptor} that corresponds to the given {@link Describable} type.
 * <p>
 * If you have an instance of {@code type} and call {@link Describable#getDescriptor()},
 * you'll get the same instance that this method returns.
 */
@CheckForNull
public Descriptor getDescriptor(Class<? extends Describable> type) {
  for( Descriptor d : getExtensionList(Descriptor.class) )
    if(d.clazz==type)
      return d;
  return null;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the {@link Descriptor} instance in the current Jenkins by its type.
 */
public <T extends Descriptor> T getDescriptorByType(Class<T> type) {
  for( Descriptor d : getExtensionList(Descriptor.class) )
    if(d.getClass()==type)
      return type.cast(d);
  return null;
}

代码示例来源:origin: jenkinsci/jenkins

/**
   * All the registered {@link ChannelConfigurator}s.
   */
  public static ExtensionList<ChannelConfigurator> all() {
    return Jenkins.getInstance().getExtensionList(ChannelConfigurator.class);
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Used to bind {@link ExtensionList}s to URLs.
 *
 * @since 1.349
 */
@StaplerDispatchable
public ExtensionList getExtensionList(String extensionType) throws ClassNotFoundException {
  return getExtensionList(pluginManager.uberClassLoader.loadClass(extensionType));
}

代码示例来源:origin: jenkinsci/jenkins

public static ExtensionList<PingFailureAnalyzer> all() {
    return Jenkins.get().getExtensionList(PingFailureAnalyzer.class);
  }
}

代码示例来源:origin: jenkinsci/jenkins

public static ExtensionList<CallableWhitelist> all() {
    return Jenkins.getInstance().getExtensionList(CallableWhitelist.class);
  }
}

代码示例来源:origin: jenkinsci/jenkins

private ExtensionList<T> storage() {
  return Jenkins.getInstance().getExtensionList(type);
}

代码示例来源:origin: jenkinsci/jenkins

private ExtensionList<T> storage() {
  return Jenkins.getInstance().getExtensionList(type);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * @since 1.568
 */
@SuppressWarnings("deprecation")
public static Collection<? extends SCMListener> all() {
  Jenkins j = Jenkins.getInstanceOrNull();
  if (j == null) { // TODO use !Functions.isExtensionsAvailable() once JENKINS-33377
    return Collections.emptySet();
  }
  List<SCMListener> r = new ArrayList<SCMListener>(j.getExtensionList(SCMListener.class));
  for (SCMListener l : j.getSCMListeners()) {
    r.add(l);
  }
  return r;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the extension list for a given type.
 * Normally calls {@link Jenkins#getExtensionList(Class)} but falls back to an empty list
 * in case {@link Jenkins#getInstanceOrNull()} is null.
 * Thus it is useful to call from {@code all()} methods which need to behave gracefully during startup or shutdown.
 * @param type the extension point type
 * @return some list
 * @since 1.572
 */
public static @Nonnull <T> ExtensionList<T> lookup(Class<T> type) {
  Jenkins j = Jenkins.getInstanceOrNull();
  return j == null ? create((Jenkins) null, type) : j.getExtensionList(type);
}

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

public static List<GitLabClientBuilder> getAllGitLabClientBuilders() {
  List<GitLabClientBuilder> builders = new ArrayList<>(Jenkins.getInstance().getExtensionList(GitLabClientBuilder.class));
  sort(builders);
  return builders;
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

public static List<SecretSource> all() {
    List<SecretSource> all = new ArrayList<>();
    all.addAll(Jenkins.getInstance().getExtensionList(SecretSource.class));
    return all;
  }
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

/**
   * Retrieve default implementation from Jenkins
   */
  static ConfiguratorRegistry get() {
    return Jenkins.getInstance().getExtensionList(ConfiguratorRegistry.class).get(0);
  }
}

代码示例来源:origin: jenkinsci/jenkins

public Descriptor getDescriptor(String id) {
  Iterable<Descriptor> descriptors = Iterators.sequence(getExtensionList(Descriptor.class), DescriptorExtensionList.listLegacyInstances());
  for (Descriptor d : descriptors) {
    if (d.getId().equals(id)) {

代码示例来源:origin: jenkinsci/jenkins

@Initializer(after=EXTENSIONS_AUGMENTED)
public void verify() {
  Jenkins h = Jenkins.getInstance();
  for (Descriptor d : h.getExtensionList(Descriptor.class)) {
    PluginWrapper p = h.getPluginManager().whichPlugin(d.getClass());
    String id;
    try {
      id = d.getId();
    } catch (Throwable t) {
      LOGGER.log(Level.SEVERE,MessageFormat.format("Descriptor {0} from plugin {1} with display name {2} reported an exception for ID",
          d, p == null ? "???" : p.getLongName(), d.getDisplayName()),t);
      problems.add(d);
      continue;
    }
    if (id==null) {
      LOGGER.severe(MessageFormat.format("Descriptor {0} from plugin {1} with display name {2} has null ID",
          d, p==null?"???":p.getLongName(), d.getDisplayName()));
      problems.add(d);
    }
  }
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@CheckForNull
@Override
public CNode describe(GlobalConfigurationCategory instance, ConfigurationContext context) {
  final Mapping mapping = new Mapping();
  Jenkins.getInstance().getExtensionList(Descriptor.class).stream()
    .filter(d -> d.getCategory() == category)
    .filter(d -> d.getGlobalConfigPage() != null)
    .forEach(d -> describe(d, mapping, context));
  return mapping;
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Override
public Set describe() {
  return (Set) Jenkins.getInstance().getExtensionList(Descriptor.class).stream()
      .filter(d -> d.getCategory() == category)
      .filter(d -> d.getGlobalConfigPage() != null)
      .map(d -> new DescriptorConfigurator(d))
      .filter(GlobalConfigurationCategoryConfigurator::reportDescriptorWithoutSetters)
      .map(c -> new Attribute<GlobalConfigurationCategory, Object>(c.getName(), c.getTarget()).setter(NOP))
      .collect(Collectors.toSet());
}

代码示例来源:origin: jenkinsci/jenkins

ExtensionList<ExtensionFinder> finders = getExtensionList(ExtensionFinder.class);
for (ExtensionFinder ef : finders) {
  if (!ef.isRefreshable())

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Override
protected T instance(Mapping mapping, ConfigurationContext context) throws ConfiguratorException {
  final ExtensionList<T> list = Jenkins.getInstance().getExtensionList(target);
  if (list.size() != 1) {
    throw new ConfiguratorException("Expected a unique instance of extension "+target);
  }
  return (T) list.get(0);
}

代码示例来源:origin: jenkinsci/jenkins

.getExtensionList(AbstractProject.LabelValidator.class)) {
FormValidation result = v.check(project, l);
if (!FormValidation.Kind.OK.equals(result.kind)) {

相关文章

Jenkins类方法