@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()); }
/** * Get all {@link DeclarativeAgentDescriptor}s, sorted by name. * * @return a list of all {@link DeclarativeAgentDescriptor}s registered, sorted by name. */ public static List<DeclarativeAgentDescriptor> allSorted() { return all().stream().sorted(Comparator.comparing(DeclarativeAgentDescriptor::getName)).collect(Collectors.toList()); }
/** * Get all {@link DeclarativeOptionDescriptor}s. * * @return a list of all {@link DeclarativeOptionDescriptor}s registered.` */ public static List<DeclarativeOptionDescriptor> all() { ExtensionList<DeclarativeOptionDescriptor> descs = ExtensionList.lookup(DeclarativeOptionDescriptor.class); return descs.stream().sorted(Comparator.comparing(DeclarativeOptionDescriptor::getName)).collect(Collectors.toList()); } }
/** * Get all {@link DeclarativeStageConditionalDescriptor}s. * * @return a list of all {@link DeclarativeStageConditionalDescriptor}s registered.` */ public static List<DeclarativeStageConditionalDescriptor> all() { ExtensionList<DeclarativeStageConditionalDescriptor> descs = ExtensionList.lookup(DeclarativeStageConditionalDescriptor.class); return descs.stream().sorted(Comparator.comparing(DeclarativeStageConditionalDescriptor::getName)).collect(Collectors.toList()); }
/** * Returns the agents names in provisioning according to all implementations of this extension point for the given label. * * @param label the {@link Label} being checked. * @return the agents names in provisioning according to all implementations of this extension point for the given label. */ @Nonnull public static Set<String> getAllInProvisioning(@CheckForNull Label label) { return all().stream() .flatMap(c -> c.getInProvisioning(label).stream()) .collect(toSet()); }
@Override @Nonnull public List<Descriptor> getDescriptors() { List<Descriptor> descriptors = new ArrayList<>(); List<DeclarativeAgentDescriptor> descs = DeclarativeAgentDescriptor.all().stream() .sorted(Comparator.comparing(DeclarativeAgentDescriptor::getName)).collect(Collectors.toList()); for (DeclarativeAgentDescriptor td : descs) { if (!SymbolLookup.getSymbolValue(td).isEmpty()) { descriptors.add(td); } } return descriptors; }
public static List<PodTemplate> getAll(@Nonnull KubernetesCloud cloud) { return ExtensionList.lookup(PodTemplateSource.class) .stream() .map(s -> s.getList(cloud)) .flatMap(Collection::stream) .collect(toList()); }
/** * Returns the agents names in provisioning according to all implementations of this extension point for the given label. * * @param label the {@link Label} being checked. * @return the agents names in provisioning according to all implementations of this extension point for the given label. */ @Nonnull public static Set<String> getAllInProvisioning(@CheckForNull Label label) { return all().stream() .flatMap(c -> c.getInProvisioning(label).stream()) .collect(toSet()); }
@Exported(inline = true) public String[] getTopLevelDescriptors() { return TopLevelItemDescriptor.all().stream() .map(itemDescriptor -> itemDescriptor.getClass().getName()) .toArray(String[]::new); }
@Override @Nonnull public List<Descriptor> getDescriptors() { return ExtensionList.lookup(ParameterDefinition.ParameterDescriptor.class).stream() .filter(d -> DirectiveDescriptor.symbolForDescriptor(d) != null) .sorted(Comparator.comparing(d -> DirectiveDescriptor.symbolForDescriptor(d))) .collect(Collectors.toList()); }
@Override @Nonnull public List<Descriptor> getDescriptors() { return ExtensionList.lookup(TriggerDescriptor.class).stream() .filter(d -> DirectiveDescriptor.symbolForDescriptor(d) != null) .sorted(Comparator.comparing(d -> DirectiveDescriptor.symbolForDescriptor(d))) .collect(Collectors.toList()); }
@Override @Nonnull public List<Descriptor> getDescriptors() { return ExtensionList.lookup(ToolDescriptor.class).stream().filter(t -> t.getInstallations().length > 0 && DirectiveGenerator.getSymbolForDescriptor(t) != null ).collect(Collectors.toList()); }
@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; }
private void reportAmbiguousStepInvocation(CpsStepContext context, StepDescriptor d) { Exception e = null; try { TaskListener listener = context.get(TaskListener.class); if (listener != null) { List<String> ambiguousClassNames = StepDescriptor.all().stream() .filter(sd -> sd.getFunctionName().equals(d.getFunctionName())) .map(sd -> sd.clazz.getName()) .collect(Collectors.toList()); String message = String.format("Warning: Invoking ambiguous Pipeline Step ā%1$sā (%2$s). " + "ā%1$sā could refer to any of the following steps: %3$s. " + "You can invoke steps by class name instead to avoid ambiguity. " + "For example: steps.'%2$s'(...)", d.getFunctionName(), d.clazz.getName(), ambiguousClassNames); listener.getLogger().println(message); return; } } catch (InterruptedException | IOException temp) { e = temp; } LOGGER.log(Level.FINE, "Unable to report ambiguous step invocation for: " + d.getFunctionName(), e); }
@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()); }
listener.getLogger().println("[withMaven] Available options: " + availableMavenPublishers.stream().map(publisher -> publisher.toString()).collect(Collectors.joining(",")));
/** * Attempts to migrate data from SonarPublished, which was previously holding the global configuration. * It will refuse to migrate if a SonarQube installation already exists in this class. * Migration will only be attempted once. */ @SuppressWarnings("deprecation") @Initializer(after = InitMilestone.JOB_LOADED) public void migrateData() { if (dataMigrated) { return; } Optional<DescriptorImpl> publisherOpt = ExtensionList.lookup(SonarPublisher.DescriptorImpl.class).stream().findFirst(); // SonarPublisher might be missing if Maven plugin is disabled or not installed publisherOpt.ifPresent(publisher -> { if (publisher.getDeprecatedInstallations() != null && publisher.getDeprecatedInstallations().length > 0) { if (ArrayUtils.isEmpty(this.installations)) { this.installations = publisher.getDeprecatedInstallations(); this.buildWrapperEnabled = publisher.isDeprecatedBuildWrapperEnabled(); save(); } else { Logger.LOG.warning("SonarQube server configurations exist in both deprecated SonarPublisher and SonarGlobalConfiguration. Deleting deprecated configuration.."); } publisher.deleteGlobalConfiguration(); } }); dataMigrated = true; save(); }