/** * Returns all the registered {@link Cloud} descriptors. */ public static DescriptorExtensionList<Cloud,Descriptor<Cloud>> all() { return Jenkins.get().getDescriptorList(Cloud.class); }
@Override public boolean isActivated() { return Jenkins.get().getCrumbIssuer() == null; } }
/** * Gets the directory where Hudson stores user information. */ static File getRootDir() { return new File(Jenkins.get().getRootDir(), "users"); }
public Executor(@Nonnull Computer owner, int n) { super("Executor #"+n+" for "+owner.getDisplayName()); this.owner = owner; this.queue = Jenkins.get().getQueue(); this.number = n; }
@CheckForNull public PluginWrapper getPlugin(@Nonnull UpdateSite.Warning warning) { if (warning.type != UpdateSite.Warning.Type.PLUGIN) { return null; } return Jenkins.get().getPluginManager().getPlugin(warning.component); }
/** * @deprecated This is a verbose historical alias for {@link #get}. * @since 1.590 */ @Deprecated @Nonnull public static Jenkins getActiveInstance() throws IllegalStateException { return get(); }
@Override @Nonnull public ACL getACL() { ACL base = Jenkins.get().getAuthorizationStrategy().getACL(this); // always allow a non-anonymous user full control of himself. return ACL.lambda((a, permission) -> (idStrategy().equals(a.getName(), id) && !(a instanceof AnonymousAuthenticationToken)) || base.hasPermission(a, permission)); }
/** * {@inheritDoc} */ @Override public boolean filter(@CheckForNull Object context, @Nonnull Descriptor descriptor) { return descriptor.clazz != JNLPLauncher.class || Jenkins.get().getTcpSlaveAgentListener() != null; }
/** * Sets up the Setup Wizard filter if the current state requires it. */ private void checkFilter() { if (!Jenkins.get().getInstallState().isSetupComplete()) { setUpFilter(); } } }
public void initializeState() { Jenkins j = Jenkins.get(); try { j.getSetupWizard().completeSetup(); } catch (Exception e) { throw new RuntimeException(e); } j.setInstallState(RUNNING); } }
/** * Returns all login page decorators. * @since 2.156 */ public static List<SimplePageDecorator> all() { return Jenkins.get().getDescriptorList(SimplePageDecorator.class); }
/** * File that captures the state of upgrade. * * This file records the version number that the installation has upgraded to. */ /*package*/ static File getUpdateStateFile() { return new File(Jenkins.get().getRootDir(),"jenkins.install.UpgradeWizard.state"); }
/** * Returns true if this monitor {@link #disable(boolean) isn't disabled} earlier. * * <p> * This flag implements the ability for the admin to say "no thank you" to the monitor that * he wants to ignore. */ public boolean isEnabled() { return !((AbstractCIBase)Jenkins.get()).disabledAdministrativeMonitors.contains(id); }
/** * Returns all the registered {@link NodeDescriptor} descriptors. */ public static DescriptorExtensionList<Node,NodeDescriptor> all() { return Jenkins.get().getDescriptorList(Node.class); }
@Override @Restricted(NoExternalUse.class) public Object getTarget() { if (!SKIP_PERMISSION_CHECK) { if (!Jenkins.get().hasPermission(Jenkins.READ)) { return null; } } return this; }
/** * Returns all the registered {@link RetentionStrategy} descriptors. */ public static DescriptorExtensionList<RetentionStrategy<?>,Descriptor<RetentionStrategy<?>>> all() { return (DescriptorExtensionList) Jenkins.get().getDescriptorList(RetentionStrategy.class); }
@Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { try { Jenkins.get().clouds.rebuildHetero(req,json, Cloud.all(), "cloud"); return true; } catch (IOException e) { throw new FormException(e,"clouds"); } } }
/** * Returns all the registered {@link GlobalConfiguration} descriptors. */ public static @Nonnull ExtensionList<GlobalConfiguration> all() { return Jenkins.get().getDescriptorList(GlobalConfiguration.class); // pointless type parameters help work around bugs in javac in earlier versions http://codepad.org/m1bbFRrH } }
/** * Gets the list of {@link Build}s that include changes by this user, * by the timestamp order. */ @SuppressWarnings("unchecked") @WithBridgeMethods(List.class) public @Nonnull RunList getBuilds() { return RunList.fromJobs((Iterable) Jenkins.get(). allItems(Job.class)).filter((Predicate<Run<?, ?>>) r -> r instanceof AbstractBuild && relatedTo((AbstractBuild<?, ?>) r)); }
@Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { // for compatibility reasons, the actual value is stored in Jenkins Jenkins j = Jenkins.get(); if (json.has("myViewsTabBar")) { j.setMyViewsTabBar(req.bindJSON(MyViewsTabBar.class,json.getJSONObject("myViewsTabBar"))); } else { j.setMyViewsTabBar(new DefaultMyViewsTabBar()); } return true; } }