@Override public boolean isEmpty() { return storage().isEmpty(); } };
/** * Called by tests in the JTH. Otherwise this shouldn't be called. * Even in the tests this usage is questionable. */ @Deprecated public static void clear() { if (ExtensionList.lookup(AllUsers.class).isEmpty()) { return; } UserIdMapper.getInstance().clear(); AllUsers.clear(); }
/** * Installs the default queue sorter. * * {@link Queue#Queue(LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Jenkins.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }
if (!extensions.isEmpty()) { return new DescriptorConfigurator((Descriptor) extensions.get(0));
@Override public boolean isEmpty() { return storage().isEmpty(); } };
@Override public boolean isEmpty() { return storage().isEmpty(); } };
@Override public boolean isEmpty() { return storage().isEmpty(); } };
/** * {@inheritDoc} */ @Override public String getIconFileName() { return ExtensionList.lookup(CredentialsDescriptor.class).isEmpty() ? null : "/plugin/credentials/images/48x48/credentials.png"; }
@Override public boolean isEmpty() { return storage().isEmpty(); } };
@Override public boolean isEmpty() { return storage().isEmpty(); } };
/** * {@inheritDoc} */ @Override public String getIconFileName() { return ExtensionList.lookup(CredentialsDescriptor.class).isEmpty() ? null : "/plugin/credentials/images/48x48/credentials.png"; }
private Set<UpdateSite.Warning> getActiveWarnings() { ExtensionList<UpdateSiteWarningsConfiguration> configurations = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class); if (configurations.isEmpty()) { return Collections.emptySet(); } UpdateSiteWarningsConfiguration configuration = configurations.get(0); HashSet<UpdateSite.Warning> activeWarnings = new HashSet<>(); for (UpdateSite.Warning warning : configuration.getApplicableWarnings()) { if (!configuration.getIgnoredWarnings().contains(warning.id)) { activeWarnings.add(warning); } } return Collections.unmodifiableSet(activeWarnings); }
@CheckForNull public static Coordinator getInstance() { Jenkins j = Jenkins.getInstance(); if (j != null) { ExtensionList<Coordinator> list = j.getExtensionList(Coordinator.class); if (list != null && !list.isEmpty()) { return list.get(0); } } return null; }
protected CredentialsSaveableListener getSaveableListener() { if (null == saveableListener) { ExtensionList<SaveableListener> extensionList = Hudson.getInstance().getExtensionList( SaveableListener.class); if (null != extensionList && !extensionList.isEmpty()) { for (SaveableListener listener : extensionList) { if (listener instanceof CredentialsSaveableListener) { saveableListener = (CredentialsSaveableListener) listener; break; } } } } return saveableListener; }
protected CredentialsSaveableListener getSaveableListener() { if (null == saveableListener) { ExtensionList<SaveableListener> extensionList = Hudson.getInstance().getExtensionList( SaveableListener.class); if (null != extensionList && !extensionList.isEmpty()) { for (SaveableListener listener : extensionList) { if (listener instanceof CredentialsSaveableListener) { saveableListener = (CredentialsSaveableListener) listener; break; } } } } return saveableListener; }
/** * The singleton instance registered in the Jenkins extension list. * @return the instance. */ public static ShutdownDecorator getInstance() { ExtensionList<ShutdownDecorator> list = Jenkins.getInstance().getExtensionList(ShutdownDecorator.class); if (!list.isEmpty()) { return list.get(0); } else { throw new IllegalStateException("Extensions are not loaded yet."); } } }
/** * Returns true iff there are applicable but ignored (i.e. hidden) warnings. * * @return true iff there are applicable but ignored (i.e. hidden) warnings. */ public boolean hasApplicableHiddenWarnings() { ExtensionList<UpdateSiteWarningsConfiguration> configurations = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class); if (configurations.isEmpty()) { return false; } UpdateSiteWarningsConfiguration configuration = configurations.get(0); return getActiveWarnings().size() < configuration.getApplicableWarnings().size(); }
/** * Installs the default queue sorter. * * {@link Queue#Queue(hudson.model.LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Hudson.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }
/** * Installs the default queue sorter. * * {@link Queue#Queue(hudson.model.LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Hudson.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }
/** * Installs the default queue sorter. * * {@link Queue#Queue(hudson.model.LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Hudson.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }