Package org.rhq.core.domain.plugin

Examples of org.rhq.core.domain.plugin.Plugin


     * @throws PluginTransformException if any IO errors occur trying to read the JAR file or if a version not in the
     * plugin descriptor or in the plugin JAR manifest
     */
    public Plugin toPlugin(PluginDescriptor pluginDescriptor, URL pluginURL) {
        try {
            Plugin plugin = new Plugin();
            plugin.setName(pluginDescriptor.getName());

            if (pluginDescriptor.getDisplayName() == null) {
                plugin.setDisplayName(pluginDescriptor.getName());
            }
            else {
                plugin.setDisplayName(pluginDescriptor.getDisplayName());
            }

            plugin.setAmpsVersion(getAmpsVersion(pluginDescriptor));
            plugin.setDescription(pluginDescriptor.getDescription());
            plugin.setPath(pluginURL.getPath());
            plugin.setMtime(pluginURL.openConnection().getLastModified());
            plugin.setHelp(getHelp(pluginDescriptor));
            plugin.setMd5(getMd5(pluginURL));
            plugin.setVersion(getVersion(pluginDescriptor, pluginURL));

            return plugin;
        }
        catch (IOException e) {
            throw new PluginTransformException("Failed to create plugin.", e);
View Full Code Here


    public Plugin getPlugin() {
        return this.plugin;
    }

    private Plugin createPlugin() {
        Plugin plugin = new Plugin(this.pluginDescriptor.getName(), null);
        plugin.setDisplayName(this.pluginDescriptor.getDisplayName());
        plugin.setDescription(this.pluginDescriptor.getDescription());
        plugin.setVersion(this.pluginDescriptor.getVersion());
        Help help = this.pluginDescriptor.getHelp();
        if ((help != null) && !help.getContent().isEmpty()) {
            plugin.setHelpContentType(help.getContentType());
            plugin.setHelp(String.valueOf(help.getContent().get(0)));
        }
        return plugin;
    }
View Full Code Here

        File confluenceBaseOutputDir = new File(baseOutputDir, "confluence");
        File confluenceOutputDir = new File(confluenceBaseOutputDir, pluginName);
        confluenceOutputDir.mkdirs();

        Plugin plugin = descriptorProcessor.getPlugin();
        File confluencePluginOutputFile = generateConfluencePluginPage(resourceTypes, confluenceOutputDir, plugin);
        generateConfluenceResourceTypePages(null, resourceTypes, confluenceOutputDir, plugin);

        boolean publishConfluencePages = (this.confluenceUserName != null) && (this.confluencePassword != null);
        Confluence confluence;
View Full Code Here

        File docbookBaseOutputDir = new File(baseOutputDir, "docbook");
        File docbookOutputDir = new File(docbookBaseOutputDir, descriptorProcessor.getPlugin().getName());
        docbookOutputDir.mkdirs();

        Plugin plugin = descriptorProcessor.getPlugin();
        generateDocbookPluginPage(resourceTypes, docbookOutputDir, plugin);
        generateDocbookResourceTypePages(new ArrayList<ResourceType>(), resourceTypes, docbookOutputDir, plugin);
    }
View Full Code Here

    @ApiParam("Name of the plugin file") @QueryParam("name") String name,
    @Context HttpHeaders headers, @Context UriInfo uriInfo) throws Exception {

        List<Plugin> newOnes = pluginManager.deployUsingContentHandle(caller, name, handle);

        Plugin myPlugin = null;
        for (Plugin p : newOnes) {
            if (p.getPath().equals(name)) {
                myPlugin = p;
                break;
            }
        }

        if (myPlugin == null) {
            //this may happen and is actually not an error... it just means that the plugin most possibly already
            //was installed..
            return withMediaType(Response.ok(PluginRest.list(newOnes)), headers).build();
        } else {
            URI myPluginUri = uriInfo.getBaseUri().resolve(uriInfo.getPath())
                .resolve(Integer.toString(myPlugin.getId()));

            return withMediaType(Response.created(myPluginUri), headers).entity(PluginRest.list(newOnes)).build();
        }
    }
View Full Code Here

    }

    private void registerPluginInternal(String pathToDescriptor, String versionOverride) throws Exception {
        System.out.println("Registering plugin with descriptor [" + pathToDescriptor + "]...");
        String md5 = MessageDigestGenerator.getDigestString(pathToDescriptor);
        Plugin testPlugin = new Plugin(PLUGIN_NAME, "foo.jar", md5);
        testPlugin.setDisplayName(PLUGIN_NAME + ": " + pathToDescriptor);
        PluginDescriptor descriptor = loadPluginDescriptor(pathToDescriptor);
        // if caller passed in their own version, use it - otherwise, use the plugin descriptor version.
        // this allows our tests to reuse descriptors without having to duplicate them
        if (versionOverride != null) {
            testPlugin.setVersion(versionOverride);
        } else {
            testPlugin.setVersion(descriptor.getVersion());
        }
        try {
            pluginMgr.registerPlugin(testPlugin, descriptor, null, true);
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

        return found;
    }

    protected int getPluginId() throws NoResultException {
        Plugin existingPlugin;
        try {
            existingPlugin = (Plugin) em.createNamedQuery(Plugin.QUERY_FIND_BY_NAME).setParameter("name", PLUGIN_NAME)
                .getSingleResult();
            int plugin1Id = existingPlugin.getId();
            return plugin1Id;
        } catch (NoResultException nre) {
            throw nre;
        }
    }
View Full Code Here

        getTransactionManager().begin();

        try {
            try {
                int plugin1Id = getPluginId();
                Plugin plugin1 = em.getReference(Plugin.class, plugin1Id);
                if (null != plugin1) {
                    em.remove(plugin1);
                }
            } catch (NoResultException nre) {
                // ignore, nothing to do
View Full Code Here

    protected void createPlugin(String pluginFileName, String version, String descriptorFileName) throws Exception {
        URL descriptorURL = getDescriptorURL(descriptorFileName);
        PluginDescriptor pluginDescriptor = loadPluginDescriptor(descriptorURL);
        String pluginFilePath = getPluginScannerService().getAgentPluginDir() + "/" + pluginFileName + ".jar";

        Plugin plugin = new Plugin(pluginDescriptor.getName(), pluginFilePath);
        plugin.setDisplayName(pluginDescriptor.getName());
        plugin.setEnabled(true);
        plugin.setDescription(pluginDescriptor.getDescription());
        plugin.setAmpsVersion(getAmpsVersion(pluginDescriptor));
        plugin.setVersion(pluginDescriptor.getVersion());
        plugin.setMD5(MessageDigestGenerator.getDigestString(descriptorURL));

        PluginManagerLocal pluginMgr = LookupUtil.getPluginManager();

        pluginMgr.registerPlugin(plugin, pluginDescriptor, null, true);

        pluginIds.add(plugin.getId());
    }
View Full Code Here

     *
     * @param pluginName
     */
    protected void pluginDeployed(String pluginName) {
        PluginManagerLocal pluginMgr = LookupUtil.getPluginManager();
        Plugin plugin = pluginMgr.getPlugin(pluginName);
        if (plugin != null) {
            this.pluginIds.add(plugin.getId());
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.plugin.Plugin

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.