@Override public <T> Collection<ExtensionComponent<T>> find(Class<T> type) { return f.find(type, Hudson.getInstance()); } };
private void refreshExtensionAnnotations() { for (ExtensionComponent<GuiceExtensionAnnotation> ec : moduleFinder.find(GuiceExtensionAnnotation.class, Hudson.getInstance())) { GuiceExtensionAnnotation gea = ec.getInstance(); extensionAnnotations.put(gea.annotationType,gea); } }
modules.add(extensions); for (ExtensionComponent<Module> ec : moduleFinder.find(Module.class, Hudson.getInstance())) { modules.add(ec.getInstance());
/** * Returns true if we should keep going. */ protected boolean shouldRun() { return Hudson.getInstance() != null && !Hudson.getInstance().isTerminating(); }
@Override public <T> Collection<ExtensionComponent<T>> find(Class<T> type) { return f.find(type, Hudson.getInstance()); } };
@Override protected void onModified() throws IOException { super.onModified(); Hudson.getInstance().trimLabels(); } }
/** * All registered {@link AdministrativeMonitor} instances. */ public static ExtensionList<AdministrativeMonitor> all() { return Hudson.getInstance().getExtensionList(AdministrativeMonitor.class); } }
@Override public synchronized void setInstallations(JDK... jdks) { List<JDK> list = Hudson.getInstance().getJDKs(); list.clear(); list.addAll(Arrays.asList(jdks)); }
/** * If there's no JDK configured, there's no point in this axis. */ @Override public boolean isInstantiable() { return !Hudson.getInstance().getJDKs().isEmpty(); } }
/** * Returns all the registered {@link AxisDescriptor}s. */ public static DescriptorExtensionList<Axis,AxisDescriptor> all() { return Hudson.getInstance().<Axis,AxisDescriptor>getDescriptorList(Axis.class); }
/** * Gets the {@link TopLevelItem} of the given name. */ public TopLevelItem getItem(String name) { return Hudson.getInstance().getItem(name); }
/** * Returns all the registered {@link EnvironmentContributor}s. */ public static ExtensionList<EnvironmentContributor> all() { return Hudson.getInstance().getExtensionList(EnvironmentContributor.class); } }
/** * {@inheritDoc} */ public JobPropertyDescriptor getDescriptor() { return (JobPropertyDescriptor)Hudson.getInstance().getDescriptorOrDie(getClass()); }
/** * This is where the retrieved file will be stored. */ public TextFile getDataFile() { return new TextFile(new File(Hudson.getInstance().getRootDir(),"updates/"+id)); }
private boolean isCreateAccountBasedOnEmail() { Hudson hudson = Hudson.getInstance(); if (hudson == null) { return false; } DescriptorImpl descriptor = (DescriptorImpl) hudson.getDescriptor(GitSCM.class); if (descriptor == null) { return false; } return descriptor.isCreateAccountBasedOnEmail(); }
/** * If some version of this plugin is currently installed, return {@link PluginWrapper}. * Otherwise null. */ public PluginWrapper getInstalled() { PluginManager pm = Hudson.getInstance().getPluginManager(); return pm.getPlugin(name); }
/** * Finds a resolved method annotated with {@link CLIResolver}. */ private Method findResolver(Class type) throws IOException { List<Method> resolvers = Util.filter(Index.list(CLIResolver.class, Hudson.getInstance().getPluginManager().uberClassLoader), Method.class); for ( ; type!=null; type=type.getSuperclass()) for (Method m : resolvers) if (m.getReturnType()==type) return m; return null; }
/** * Gets the current {@link Computer} that the build is running. * This method only works when called during a build, such as by * {@link Publisher}, {@link BuildWrapper}, etc. */ public static Computer currentComputer() { Executor e = Executor.currentExecutor(); // If no executor then must be on master node return e != null ? e.getOwner() : Hudson.getInstance().toComputer(); }
@Override public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(Hudson.ADMINISTER); Hudson.getInstance().setSystemMessage(req.getParameter("description")); rsp.sendRedirect("."); }
/** * Used for CLI binding. */ @CLIResolver public static AbstractProject resolveForCLI( @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException { AbstractProject item = Hudson.getInstance().getItemByFullName(name, AbstractProject.class); if (item==null) throw new CmdLineException(null,Messages.AbstractItem_NoSuchJobExists(name,AbstractProject.findNearest(name).getFullName())); return item; } }