Package org.rhq.core.clientapi.descriptor.plugin

Examples of org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor


     *
     * @param pluginName name of the plugin whose descriptor is to be returned.
     * @return the descriptor or null if not available
     */
    public PluginDescriptor getPluginDescriptor(String pluginName) {
        PluginDescriptor descriptor = this.descriptorsByPlugin.get(pluginName);
        if (descriptor == null) {
            PluginMetadataParser parser = this.parsersByPlugin.get(pluginName);
            if (parser != null) {
                descriptor = parser.getDescriptor();
            }
View Full Code Here


            // we have to do it all over again over all plugins because we need to support the injection extension model
            // that is, <runs-inside> - new plugins coming online might have injected types in previously loaded plugins
            HashMap<ResourceType, String> disabledTypes = new HashMap<ResourceType, String>();
            for (Map.Entry<String, PluginMetadataParser> entry : parsersByPlugin.entrySet()) {
                PluginMetadataParser parser = entry.getValue();
                PluginDescriptor pluginDescriptor = parser.getDescriptor();
                Set<ResourceType> rootTypes = parser.getRootResourceTypes();
                String hierarchyStart = pluginDescriptor.getName();
                for (ResourceType rootType : rootTypes) {
                    findDisabledResourceTypes(hierarchyStart, rootType, disabledTypes);
                }
                if (disabledTypes.size() == totalToBeDisabled) {
                    break; // we found them all, no need to look at any more plugins
View Full Code Here

        if (!pluginXmlFile.exists()) {
            log.info("'" + pluginXmlFile + "' does not exist - nothing to do.");
            return;
        }

        PluginDescriptor pluginDescriptor = parsePluginDescriptor(pluginXmlFile);
        PluginDescriptorProcessor descriptorProcessor = new PluginDescriptorProcessor(pluginDescriptor);
        Set<ResourceType> resourceTypes;
        try {
            resourceTypes = descriptorProcessor.processPluginDescriptor();
        } catch (InvalidPluginDescriptorException e) {
            throw new PluginDocGeneratorException("Failed to process plugin descriptor.", e);
        }

        String pluginName = pluginDescriptor.getName();
        log.info("Generating plugin docs for " + pluginName + " plugin...");
        File baseOutputDir = new File(projectBaseDir.getParentFile(), OUTPUT_DIR_PATH);

        generateConfluenceContent(descriptorProcessor, resourceTypes, baseOutputDir);
        generateDocbookContent(descriptorProcessor, resourceTypes, baseOutputDir);
View Full Code Here

            unmarshaller.setSchema(pluginSchema);

            ValidationEventCollector validationEventCollector = new ValidationEventCollector();
            unmarshaller.setEventHandler(validationEventCollector);

            PluginDescriptor pluginDescriptor = (PluginDescriptor) unmarshaller.unmarshal(is);

            for (ValidationEvent event : validationEventCollector.getEvents()) {
                log.debug("Plugin [" + pluginDescriptor.getName() + "] descriptor messages {Severity: "
                    + event.getSeverity() + ", Message: " + event.getMessage() + ", Exception: "
                    + event.getLinkedException() + "}");
            }

            return pluginDescriptor;
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 "MetadataTest.xml";
    }

    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);
View Full Code Here

     * of registering the plugins.
     */
    private String preprocessPlugin(DeploymentInfo deploymentInfo) throws Exception {
        File pluginFile = new File(deploymentInfo.url.getFile());
        ensureDeploymentIsValid(pluginFile);
        PluginDescriptor descriptor = getPluginDescriptor(deploymentInfo);
        String pluginName = descriptor.getName();
        boolean initialDeploy = !this.deploymentInfos.containsKey(pluginName);
        ComparableVersion version;
        version = AgentPluginDescriptorUtil.getPluginVersion(pluginFile, descriptor);
        if (initialDeploy) {
            log.info("Discovered agent plugin [" + pluginName + "]");
View Full Code Here

        return pluginName;
    }

    private PluginDescriptor getPluginDescriptor(DeploymentInfo di) throws Exception {
        try {
            PluginDescriptor pluginDescriptor = AgentPluginDescriptorUtil.loadPluginDescriptorFromUrl(di.url);
            return pluginDescriptor;
        } catch (Exception e) {
            throw new Exception("Failed to parse descriptor found in plugin [" + di.url + "]", e);
        }
    }
View Full Code Here

    }

    private PluginDependencyGraph buildDependencyGraph() {
        PluginDependencyGraph dependencyGraph = new PluginDependencyGraph();
        for (String pluginName : this.deploymentInfos.keySet()) {
            PluginDescriptor descriptor = this.metadataManager.getPluginDescriptor(pluginName);
            AgentPluginDescriptorUtil.addPluginToDependencyGraph(dependencyGraph, descriptor);
        }
        return dependencyGraph;
    }
View Full Code Here

    private DeploymentRunnable getServiceIfExists(String pluginName, Map<String, DeploymentRunnable> runnableMap) {

        DeploymentRunnable result = runnableMap.get(pluginName);
        if (result == null) {
            DeploymentInfo deploymentInfo = this.deploymentInfos.get(pluginName);
            PluginDescriptor descriptor = this.metadataManager.getPluginDescriptor(pluginName);
            CannedGroupAddition addition = PluginAdditionsReader.getCannedGroupsAddition(deploymentInfo.url, pluginName);
            if ((null != deploymentInfo) && (null != descriptor)) {
                result = new DeploymentRunnable(pluginName, deploymentInfo, descriptor, addition);
                runnableMap.put(pluginName, result);
            }
View Full Code Here

TOP

Related Classes of org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor

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.