Package hudson

Examples of hudson.PluginWrapper


     * <p>
     * This allows URL <tt>hudson/plugin/ID</tt> to be served by the views
     * of the plugin class.
     */
    public Plugin getPlugin(String shortName) {
        PluginWrapper p = pluginManager.getPlugin(shortName);
        if(p==null)     return null;
        return p.getPlugin();
    }
View Full Code Here


     *
     * @return The plugin instance.
     */
    @SuppressWarnings("unchecked")
    public <P extends Plugin> P getPlugin(Class<P> clazz) {
        PluginWrapper p = pluginManager.getPlugin(clazz);
        if(p==null)     return null;
        return (P) p.getPlugin();
    }
View Full Code Here

     */
    @LocalData
    public void testDependencyClassLoader() throws Exception {
        // Test data has: foo3 depends on foo2,foo1; foo2 depends on foo1
        // (thus findResources from foo3 can find foo1 resources via 2 dependency paths)
        PluginWrapper p = hudson.getPluginManager().getPlugin("foo3");
        String res = p.getIndexPage().toString();
        assertTrue(res + "should be foo3", res.contains("/foo3/"));

        // In the current impl, the dependencies are the parent ClassLoader so resources
        // are found there before checking the plugin itself.  Adjust the expected results
        // below if this is ever changed to check the plugin first.
View Full Code Here

    }

    private void verify() {
        Jenkins h = Jenkins.getInstance();
        for (Descriptor d : h.getExtensionList(Descriptor.class)) {
            PluginWrapper p = h.getPluginManager().whichPlugin(d.getClass());
            String id;
            try {
                id = d.getId();
            } catch (Throwable t) {
                LOGGER.log(Level.SEVERE,MessageFormat.format("Descriptor {0} from plugin {1} with display name {2} reported an exception for ID",
                        d, p == null ? "???" : p.getLongName(), d.getDisplayName()),t);
                problems.add(d);
                continue;
            }
            if (id==null) {
                LOGGER.severe(MessageFormat.format("Descriptor {0} from plugin {1} with display name {2} has null ID",
                        d, p==null?"???":p.getLongName(), d.getDisplayName()));
                problems.add(d);
            }
        }
    }
View Full Code Here

         * If it's not older, or it's not installed, or it's installed but there's no compatibleSinceVersion
         * specified, it'll return true.
         */
        @Exported
        public boolean isCompatibleWithInstalledVersion() {
            PluginWrapper installedVersion = getInstalled();
            if (installedVersion != null) {
                if (compatibleSinceVersion != null) {
                    if (new VersionNumber(installedVersion.getVersion())
                            .isOlderThan(new VersionNumber(compatibleSinceVersion))) {
                        return false;
                    }
                }
            }
View Full Code Here

            for(Map.Entry<String,String> e : dependencies.entrySet()) {
                Plugin depPlugin = Jenkins.getInstance().getUpdateCenter().getPlugin(e.getKey());
                VersionNumber requiredVersion = new VersionNumber(e.getValue());
               
                // Is the plugin installed already? If not, add it.
                PluginWrapper current = depPlugin.getInstalled();

                if (current ==null) {
                    deps.add(depPlugin);
                }
                // If the dependency plugin is installed, is the version we depend on newer than
                // what's installed? If so, upgrade.
                else if (current.isOlderThan(requiredVersion)) {
                    deps.add(depPlugin);
                }
            }

            return deps;
View Full Code Here

        String path = req.getRestOfPath();
        if(path.contains("..")) throw new ServletException("Illegal path: "+path);

        path = path.replace('/','-');

        PluginWrapper pw = getPlugin();
        if (pw!=null) {
            rsp.setHeader("X-Plugin-Short-Name",pw.getShortName());
            rsp.setHeader("X-Plugin-Long-Name",pw.getLongName());
            rsp.setHeader("X-Plugin-From", Messages.Descriptor_From(
                    pw.getLongName().replace("Hudson","Jenkins").replace("hudson","jenkins"), pw.getUrl()));
        }

        for (Klass<?> c= getKlass(); c!=null; c=c.getSuperClass()) {
            RequestDispatcher rd = Stapler.getCurrentRequest().getView(c, "help"+path);
            if(rd!=null) {// template based help page
View Full Code Here

        @Override
        public void _run() throws IOException, InstallationStatus {
            super._run();

            // if this is a bundled plugin, make sure it won't get overwritten
            PluginWrapper pw = plugin.getInstalled();
            if (pw!=null && pw.isBundled()) {
                SecurityContext oldContext = ACL.impersonate(ACL.SYSTEM);
                try {
                    pw.doPin();
                } finally {
                    SecurityContextHolder.setContext(oldContext);
                }
            }
View Full Code Here

  public String getDisplayName() {
    return Messages.SonarAction_Sonar();
  }

  public String getIcon() {
    PluginWrapper wrapper = Jenkins.getInstance().getPluginManager()
        .getPlugin(SonarPlugin.class);
    return "/plugin/" + wrapper.getShortName() + "/images/" + MagicNames.ICON;
  }
View Full Code Here

  public ProjectSonarAction(AbstractProject<?, ?> project) {
    this.project = project;
  }

  public String getIconFileName() {
    PluginWrapper wrapper = Jenkins.getInstance().getPluginManager()
        .getPlugin(SonarPlugin.class);
    return "/plugin/" + wrapper.getShortName() + "/images/" + MagicNames.ICON;
  }
View Full Code Here

TOP

Related Classes of hudson.PluginWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.