/** * An instance of {@link Proc}, which has an internal workaround for JENKINS-23271. * It presumes that the instance of the object is guaranteed to be used after the {@link Proc#join()} call. * See <a href="https://jenkins-ci.org/issue/23271">JENKINS-23271</a> * @author Oleg Nenashev */ @Restricted(NoExternalUse.class) public interface ProcWithJenkins23271Patch { // Empty marker interface } }
/** * Get the {@link Nodes} object that handles maintaining individual {@link Node}s. * @return The Nodes object. */ @Restricted(NoExternalUse.class) public Nodes getNodesObject() { // TODO replace this with something better when we properly expose Nodes. return nodes; }
/** * Backdoor for {@link Fingerprint} to set itself to its facets. * Public only because this needs to be accessible to {@link Fingerprint}. Do not call this method directly. */ @Restricted(NoExternalUse.class) public void _setOwner(Fingerprint fingerprint) { assert fingerprint!=null; this.fingerprint = fingerprint; } }
/** * Determine if the legacy token is still present */ @Restricted(NoExternalUse.class) public boolean hasLegacyToken(){ return apiToken != null; }
/** * Does not revoke the token stored in the store */ @Restricted(NoExternalUse.class) public void deleteApiToken(){ this.apiToken = null; }
/** * Used by {@link WebAppMain#contextInitialized(ServletContextEvent)} and * {@link WebAppMain#contextDestroyed(ServletContextEvent)} to identify the classloader and JVM which started * {@link Jenkins} * * @param jenkinsJVM {@code true} if and only if this is the classloader and JVM that started {@link Jenkins}. */ @Restricted(NoExternalUse.class) protected static void setJenkinsJVM(boolean jenkinsJVM) { JenkinsJVM.jenkinsJVM = jenkinsJVM; } }
@VisibleForTesting @Restricted(NoExternalUse.class) void setUrlFactory(UrlFactory urlFactory) { this.urlFactory = urlFactory; }
/** * If the configured buildsDir has it's default value or has been changed. * * @return true if default value. */ @Restricted(NoExternalUse.class) public boolean isDefaultBuildDir() { return DEFAULT_BUILDS_DIR.equals(buildsDir); }
/** * No longer used. This method is now a no-op but the signature is retained for backward compatibility. * * @param id the id * @return the name * @deprecated No current use. */ @Deprecated @Restricted(ProtectedExternally.class) public String legacyFilenameOf(@Nonnull String id) { return null; }
/** * Creates a sub map by using the given range (upper end inclusive). */ @Restricted(NoExternalUse.class) public static <V> SortedMap<Integer,V> filterExcludingFrom(SortedMap<Integer,V> map, String from, String to) { if(from==null && to==null) return map; if(to==null) return map.headMap(Integer.parseInt(from)); if(from==null) return map.tailMap(Integer.parseInt(to)); return map.subMap(Integer.parseInt(to),Integer.parseInt(from)); }
@Restricted(NoExternalUse.class) // Jelly use public List<String> getOriginalDependencyErrors() { Predicate<Map.Entry<String, Boolean>> p = Map.Entry::getValue; return dependencyErrors.entrySet().stream().filter(p.negate()).map(Map.Entry::getKey).collect(Collectors.toList()); }
@Restricted(DoNotUse.class) public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) { // Provide a legacy interface in case plugins are not going through p:config-assignedLabel // see: JENKINS-25372 LOGGER.log(Level.WARNING, "autocompleting label via legacy '_.assignedLabelString'"); return doAutoCompleteLabel(value); }
/** * Compute the number of calendar days elapsed since the given date. * As it's only the calendar days difference that matter, "11.00pm" to "2.00am the day after" returns 1, * even if there are only 3 hours between. As well as "10am" to "2pm" both on the same day, returns 0. */ @Restricted(NoExternalUse.class) public static long daysBetween(@Nonnull Date a, @Nonnull Date b){ LocalDate aLocal = a.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate bLocal = b.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); return ChronoUnit.DAYS.between(aLocal, bLocal); }
/** * Deletes the given directory and contents recursively using a filter. * @param dir a directory to delete * @param pathChecker a security check to validate a path before deleting * @throws IOException if the operation fails */ @Restricted(NoExternalUse.class) public static void deleteRecursive(@Nonnull Path dir, @Nonnull PathRemover.PathChecker pathChecker) throws IOException { newPathRemover(pathChecker).forceRemoveRecursive(dir); }
@Restricted(NoExternalUse.class) // just for form validation public @CheckForNull Calendar next() { Calendar nearest = null; for (CronTab tab : tabs) { Calendar scheduled = tab.ceil(tab.getTimeZone() == null ? Calendar.getInstance() : Calendar.getInstance(tab.getTimeZone())); if (nearest == null || nearest.after(scheduled)) { nearest = scheduled; } } return nearest; }
@Restricted(NoExternalUse.class) public List<User> getImpactedUserList() { return User.getAll().stream() .filter(user -> { ApiTokenProperty apiTokenProperty = user.getProperty(ApiTokenProperty.class); return (apiTokenProperty != null && apiTokenProperty.hasLegacyToken()); }) .collect(Collectors.toList()); }
@Restricted(NoExternalUse.class) public static String expandVariablesForDirectory(String base, String itemFullName, String itemRootDir) { return Util.replaceMacro(base, ImmutableMap.of( "JENKINS_HOME", Jenkins.getInstance().getRootDir().getPath(), "ITEM_ROOTDIR", itemRootDir, "ITEM_FULLNAME", itemFullName, // legacy, deprecated "ITEM_FULL_NAME", itemFullName.replace(':','$'))); // safe, see JENKINS-12251 }
@Exported(name="upstreamProjects") @Restricted(DoNotUse.class) // only for exporting public List<AbstractProject> getUpstreamProjectsForApi() { List<AbstractProject> r = new ArrayList<>(); for (AbstractProject p : getUpstreamProjects()) { if (p.hasPermission(Item.READ)) { r.add(p); } } return r; }
/** * Does not check when system default encoding is "ISO-8859-1". */ @Restricted(NoExternalUse.class) @RestrictedSince("2.37") @Deprecated public static boolean isCheckURIEncodingEnabled() { return ExtensionList.lookupSingleton(URICheckEncodingMonitor.class).isCheckEnabled(); }
/** * Returns the {@link Node} description for this computer */ @Restricted(DoNotUse.class) @Exported public @Nonnull String getDescription() { Node node = getNode(); return (node != null) ? node.getNodeDescription() : null; }