@Override public <T> Collection<ExtensionComponent<T>> find(Class<T> type) { return f.find(type, Hudson.getInstance()); } };
@Override public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(Hudson.ADMINISTER); Hudson.getInstance().setSystemMessage(req.getParameter("description")); rsp.sendRedirect("."); }
/** * For compatibility reason, this method may not return a {@link ListViewColumnDescriptor} * and instead return a plain {@link Descriptor} instance. */ public Descriptor<ListViewColumn> getDescriptor() { return Hudson.getInstance().getDescriptorOrDie(getClass()); }
/** * Returns all the registered {@link AuthorizationStrategy} descriptors. */ public static DescriptorExtensionList<AuthorizationStrategy,Descriptor<AuthorizationStrategy>> all() { return Hudson.getInstance().<AuthorizationStrategy,Descriptor<AuthorizationStrategy>>getDescriptorList(AuthorizationStrategy.class); }
public FormValidation doCheck(@AncestorInPath AbstractProject project, @QueryParameter String value) { // Require CONFIGURE permission on this project if(!project.hasPermission(Item.CONFIGURE)) return FormValidation.ok(); for (String name : Util.tokenize(fixNull(value), ",")) { name = name.trim(); if(Hudson.getInstance().getItemByFullName(name)==null) return FormValidation.error(hudson.tasks.Messages.BuildTrigger_NoSuchProject(name,AbstractProject.findNearest(name).getName())); } return FormValidation.ok(); }
@Override protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException { super.submit(req, rsp); reporters.rebuild(req, req.getSubmittedForm(),MavenReporters.getConfigurableList()); goals = Util.fixEmpty(req.getParameter("goals").trim()); // dependency setting might have been changed by the user, so rebuild. Hudson.getInstance().rebuildDependencyGraph(); }
/** * Returns the descriptor of {@link SubversionSCM}. */ public SubversionSCM.DescriptorImpl getSubversionSCMDescriptor() { if (scmDescriptor == null) { scmDescriptor = (SubversionSCM.DescriptorImpl) Hudson.getInstance().getDescriptor(SubversionSCM.class); } return scmDescriptor; } }
@Override public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { String url = this.url; if (url.startsWith("/")) { url = Hudson.getInstance().getRootUrl() + url.substring(1); } text.addHyperlink(charPos, charPos + length, url); return null; }
/** * Getter for the Descriptor. * @return the Descriptor for the PluginDraftPublishedEvent. */ @Override public Descriptor<PluginGerritEvent> getDescriptor() { return Hudson.getInstance().getDescriptorByType(PluginDraftPublishedEventDescriptor.class); }
/** * Cancels a scheduled build. */ public void doCancelQueue(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(BUILD); Hudson.getInstance().getQueue().cancel(this); rsp.forwardToPreviousPage(req); }
/** * Invoked to actually tag the workspace. */ public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Hudson.getInstance().checkPermission(Hudson.ADMINISTER); String tag = req.getParameter("name"); String desc = req.getParameter("desc"); tagBuild(tag, desc); rsp.sendRedirect("."); }
/** * Accepts the update to the node configuration. */ public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException { final Hudson app = Hudson.getInstance(); app.checkPermission(Hudson.ADMINISTER); properties.rebuild(req, req.getSubmittedForm(), getApplicablePropertyDescriptors()); updateTransientActions(); save(); // take the user back to the label top page. rsp.sendRedirect2("."); }
protected final void sendError(String message, StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException { req.setAttribute("message",message); req.setAttribute("pre",true); rsp.forward(Hudson.getInstance(),"error",req); }
/** * 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); }
/** * Ignore the problem and go back to using Hudson. */ public void doIgnore(StaplerRequest req, StaplerResponse rsp) throws IOException { ignore = true; WebAppController.get().install(Hudson.getInstance()); rsp.sendRedirect2(req.getContextPath()+'/'); }
/** * Marks the build as disabled. */ public void makeDisabled(boolean b) throws IOException { if(disabled==b) return; // noop this.disabled = b; if(b) Hudson.getInstance().getQueue().cancel(this); save(); }
/** * 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; }
@SuppressWarnings("unchecked") public ArrayList<Descriptor<IvyBuilderType>> getBuilderTypeDescriptors() { ArrayList<Descriptor<IvyBuilderType>> buildTypeDescriptors = new ArrayList<Descriptor<IvyBuilderType>>(); buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(AntIvyBuilderType.class)); if (Hudson.getInstance().getPlugin("nant") != null) { buildTypeDescriptors.add(Hudson.getInstance().getDescriptor(NAntIvyBuilderType.class)); } return buildTypeDescriptors; }
@Exported(visibility=999,name="url") public final String getAbsoluteUrl() { StaplerRequest request = Stapler.getCurrentRequest(); if(request==null) throw new IllegalStateException("Not processing a HTTP request"); return Util.encode(Hudson.getInstance().getRootUrl()+getUrl()); }
/** * Returns the first queue item if the owner is scheduled for execution in the queue. */ public Item getQueuedItem() { return Hudson.getInstance().getQueue().getItem(owner); }