Examples of PluginDependencyGraph


Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

                pluginName = getPluginName(ar);               
                plugins.put(pluginName, ar);
            }
        }
       
        PluginDependencyGraph pdg = new PluginDependencyGraph();
       
        buildRequiredPlugins(this, plugins, pdg);
       
        for(String pn : pdg.getAllDependencies(myPluginName)) {
            Archive<?> p = plugins.get(pn);
            add(p, REQUIRED_PLUGINS_PATH, ZipExporter.class);
        }
       
        return this;
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

        }

        Set<String> pluginsToBeRegistered = new HashSet<String>(this.namesOfPluginsToBeRegistered);
        log.info("Deploying [" + pluginsToBeRegistered.size() + "] new or updated agent plugins: "
            + pluginsToBeRegistered);
        PluginDependencyGraph dependencyGraph = buildDependencyGraph();
        StringBuilder errorBuffer = new StringBuilder();
        if (!dependencyGraph.isComplete(errorBuffer)) {
            log.error(errorBuffer.toString());
            if (log.isDebugEnabled()) {
                log.debug(dependencyGraph.toString());
            }
            // reduce the graph down to only those plugins and their deps that exist and only register those
            dependencyGraph = dependencyGraph.reduceGraph();
            pluginsToBeRegistered.retainAll(dependencyGraph.getPlugins());
        }
        if (pluginsToBeRegistered.size() > 0) {
            registerPlugins(dependencyGraph, pluginsToBeRegistered);
        }
        log.info("Plugin metadata updates are complete for [" + pluginsToBeRegistered.size() + "] plugins: "
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

        }
        return false;
    }

    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

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

        if (pluginIds == null || pluginIds.size() == 0) {
            return; // nothing to do
        }

        // we need to make sure that if a plugin is enabled, all of its dependencies are enabled
        PluginDependencyGraph graph = getPluginMetadataManager().buildDependencyGraph();
        List<Plugin> allPlugins = getInstalledPlugins();
        Set<String> pluginsThatNeedToBeEnabled = new HashSet<String>();

        for (Integer pluginId : pluginIds) {
            Plugin plugin = getPluginFromListById(allPlugins, pluginId.intValue());
            if (plugin != null) {
                Collection<String> dependencyNames = graph.getAllDependencies(plugin.getName());
                for (String dependencyName : dependencyNames) {
                    Plugin dependencyPlugin = getPluginFromListByName(allPlugins, dependencyName);
                    if (dependencyPlugin != null && !dependencyPlugin.isEnabled()
                        && !pluginIds.contains(Integer.valueOf(dependencyPlugin.getId()))) {
                        pluginsThatNeedToBeEnabled.add(dependencyPlugin.getDisplayName()); // this isn't enabled and isn't getting enabled, but it needs to be
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

        if (pluginIds == null || pluginIds.size() == 0) {
            return; // nothing to do
        }

        // we need to make sure that if a plugin is disabled, no other plugins that depend on it are enabled
        PluginDependencyGraph graph = getPluginMetadataManager().buildDependencyGraph();
        List<Plugin> allPlugins = getInstalledPlugins();
        Set<String> pluginsThatNeedToBeDisabled = new HashSet<String>();

        for (Integer pluginId : pluginIds) {
            Plugin plugin = getPluginFromListById(allPlugins, pluginId.intValue());
            if (plugin != null) {
                Collection<String> dependentNames = graph.getAllDependents(plugin.getName());
                for (String dependentName : dependentNames) {
                    Plugin dependentPlugin = getPluginFromListByName(allPlugins, dependentName);
                    if (dependentPlugin != null && dependentPlugin.isEnabled()
                        && !pluginIds.contains(Integer.valueOf(dependentPlugin.getId()))) {
                        pluginsThatNeedToBeDisabled.add(dependentPlugin.getDisplayName()); // this isn't disabled and isn't getting disabled, but it needs to be
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

    public void deletePlugins(Subject subject, List<Integer> pluginIds) throws Exception {
        if (pluginIds.isEmpty()) {
            return;
        }

        PluginDependencyGraph graph = getPluginMetadataManager().buildDependencyGraph();
        List<Plugin> allPlugins = getInstalledPlugins();
        Set<String> pluginsToDelete = new HashSet<String>();

        for (Integer pluginId : pluginIds) {
            Plugin plugin = getPluginFromListById(allPlugins, pluginId.intValue());
            if (plugin != null && plugin.getStatus().equals(PluginStatusType.INSTALLED)) {
                Collection<String> dependentNames = graph.getAllDependents(plugin.getName());
                for (String dependentName : dependentNames) {
                    Plugin dependentPlugin = getPluginFromListByName(allPlugins, dependentName);
                    if (dependentPlugin != null && dependentPlugin.isEnabled()
                        && !pluginIds.contains(Integer.valueOf(dependentPlugin.getId()))) {
                        pluginsToDelete.add(dependentPlugin.getDisplayName());
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

        // build our empty class loader manager - we use it to create and manage our plugin's classloaders
        Map<String, URL> pluginNamesUrls = new HashMap<String, URL>();
        // Save descriptors for later use, so we don't need to parse them twice.
        Map<URL, PluginDescriptor> descriptors = new HashMap<URL, PluginDescriptor>();
        PluginDependencyGraph graph = new PluginDependencyGraph();
        boolean createResourceCL = pluginContainerConfiguration.isCreateResourceClassloaders();
        this.classLoaderManager = new ClassLoaderManager(pluginNamesUrls, graph, rootCL, tmpDir, createResourceCL);

        if (finder == null) {
            log.warn("No plugin finder was specified in the plugin container configuration - this should only occur within test environments.");
            return;
        }

        try {
            Collection<URL> pluginUrls = finder.findPlugins();

            // first, we need to parse all descriptors so we can build the dependency graph
            for (URL url : pluginUrls) {
                log.debug("Plugin found at: " + url);
                try {
                    PluginDescriptor descriptor = AgentPluginDescriptorUtil.loadPluginDescriptorFromUrl(url);
                    if (!disabledPlugins.contains(descriptor.getName())) {
                        AgentPluginDescriptorUtil.addPluginToDependencyGraph(graph, descriptor);
                        pluginNamesUrls.put(descriptor.getName(), url);
                        descriptors.put(url, descriptor);
                    } else {
                        log.info("Not loading disabled plugin: " + url);
                    }
                } catch (Throwable t) {
                    // probably due to invalid XML syntax in the deployment descriptor - the plugin will be ignored
                    log.error("Plugin at [" + url + "] could not be loaded and will therefore not be deployed.", t);
                    continue;
                }
            }

            // our graph is complete, get the order that we have to deploy the plugins
            List<String> deploymentOrder = graph.getDeploymentOrder();

            // now deploy the plugins in the proper order, making sure we build the proper classloaders
            for (String nextPlugin : deploymentOrder) {
                URL pluginUrl = pluginNamesUrls.get(nextPlugin);
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

        ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
            ClassLoaderManager clm = this.pluginContainer.getPluginManager().getClassLoaderManager();
            PluginDependencyGraph graph = clm.getPluginDependencyGraph();
            deploymentOrder = graph.getDeploymentOrder();
            for (String pluginName : deploymentOrder) {
                List<String> deps = graph.getPluginDependencies(pluginName);
                if (deps == null || deps.size() == 0) {
                    deps = new ArrayList<String>(Arrays.asList("<none>"));
                }
                dependencies.put(pluginName, deps);
            }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

    public void loadPluginDescriptors() throws Exception {
        PluginDescriptor descriptor = loadPluginDescriptor(DESCRIPTOR);
        outputAllTypes();
        assertTypes();

        PluginDependencyGraph graph = new PluginDependencyGraph();
        AgentPluginDescriptorUtil.addPluginToDependencyGraph(graph, descriptor);
        assert graph.isComplete(null);
    }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginDependencyGraph

    public void loadPluginDescriptors() throws Exception {
        PluginDescriptor descriptor = loadPluginDescriptor(DESCRIPTOR);
        outputAllTypes();
        assertTypes();

        PluginDependencyGraph graph = new PluginDependencyGraph();
        AgentPluginDescriptorUtil.addPluginToDependencyGraph(graph, descriptor);
        assert graph.isComplete(null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.