/** * 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; }
/** * 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; }
/** * All the registered {@link ChannelConfigurator}s. */ public static ExtensionList<ChannelConfigurator> all() { return Jenkins.getInstance().getExtensionList(ChannelConfigurator.class); } }
/** * 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)); }
public static ExtensionList<PingFailureAnalyzer> all() { return Jenkins.get().getExtensionList(PingFailureAnalyzer.class); } }
public static ExtensionList<CallableWhitelist> all() { return Jenkins.getInstance().getExtensionList(CallableWhitelist.class); } }
private ExtensionList<T> storage() { return Jenkins.getInstance().getExtensionList(type); }
private ExtensionList<T> storage() { return Jenkins.getInstance().getExtensionList(type); }
/** * @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; }
/** * 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); }
public static List<GitLabClientBuilder> getAllGitLabClientBuilders() { List<GitLabClientBuilder> builders = new ArrayList<>(Jenkins.getInstance().getExtensionList(GitLabClientBuilder.class)); sort(builders); return builders; }
public static List<SecretSource> all() { List<SecretSource> all = new ArrayList<>(); all.addAll(Jenkins.getInstance().getExtensionList(SecretSource.class)); return all; } }
/** * Retrieve default implementation from Jenkins */ static ConfiguratorRegistry get() { return Jenkins.getInstance().getExtensionList(ConfiguratorRegistry.class).get(0); } }
public Descriptor getDescriptor(String id) { Iterable<Descriptor> descriptors = Iterators.sequence(getExtensionList(Descriptor.class), DescriptorExtensionList.listLegacyInstances()); for (Descriptor d : descriptors) { if (d.getId().equals(id)) {
@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); } } }
@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; }
@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()); }
ExtensionList<ExtensionFinder> finders = getExtensionList(ExtensionFinder.class); for (ExtensionFinder ef : finders) { if (!ef.isRefreshable())
@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); }
.getExtensionList(AbstractProject.LabelValidator.class)) { FormValidation result = v.check(project, l); if (!FormValidation.Kind.OK.equals(result.kind)) {