Package org.rhq.core.domain.plugin

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


    }

    @Override
    public void purgePlugins(List<Plugin> plugins) {
        for(Plugin p : plugins) {
            Plugin inDb = entityManager.find(Plugin.class, p.getId());
            inDb.getServersAcknowledgedDelete().clear();
            entityManager.remove(inDb);
        }

        if (log.isDebugEnabled()) {
            log.debug("The following plugins were purged from the database: " + plugins);
View Full Code Here


        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

        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

        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

    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    @Override
    public boolean installPluginJar(Plugin newPlugin, PluginDescriptor pluginDescriptor, File pluginFile)
        throws Exception {

        Plugin existingPlugin = getPlugin(newPlugin.getName());
        boolean newOrUpdated = (null == existingPlugin);

        if (existingPlugin != null) {
            Plugin obsolete = AgentPluginDescriptorUtil.determineObsoletePlugin(newPlugin, existingPlugin);
            if (obsolete == existingPlugin) { // yes, use == for reference equality
                newOrUpdated = true;
            }
            newPlugin.setId(existingPlugin.getId());
            newPlugin.setEnabled(existingPlugin.isEnabled());
View Full Code Here

        // to entityManager.merge that plugin POJO, it would null out that blob column.
        if (plugin.getId() == 0) {
            entityManager.persist(plugin);
        } else {
            // update all the fields except content
            Plugin pluginEntity = entityManager.getReference(Plugin.class, plugin.getId());
            pluginEntity.setName(plugin.getName());
            pluginEntity.setPath(plugin.getPath());
            pluginEntity.setDisplayName(plugin.getDisplayName());
            pluginEntity.setEnabled(plugin.isEnabled());
            pluginEntity.setStatus(plugin.getStatus());
            pluginEntity.setMd5(plugin.getMD5());
            pluginEntity.setVersion(plugin.getVersion());
            pluginEntity.setAmpsVersion(plugin.getAmpsVersion());
            pluginEntity.setDeployment(plugin.getDeployment());
            pluginEntity.setDescription(plugin.getDescription());
            pluginEntity.setHelp(plugin.getHelp());
            pluginEntity.setMtime(plugin.getMtime());

            try {
                entityManager.flush(); // make sure we push this out to the DB now
            } catch (Exception e) {
                throw new Exception("Failed to update a plugin that matches [" + plugin + "]");
View Full Code Here

        try {
            em = LookupUtil.getEntityManager();
            Query q = em.createNamedQuery(Plugin.QUERY_FIND_BY_NAME);
            q.setParameter("name", pluginName);
            Plugin plugin = (Plugin) q.getSingleResult();

            // we know our plugins are in a subdirectory within our downloads location
            return getFileContents(new File("rhq-plugins", plugin.getPath()).getPath());
        } finally {
            if (em != null) {
                em.close();
            }
        }
View Full Code Here

    private void processPluginChange(String newPlugin) {
        selectedPlugin = newPlugin;

        try {
            Plugin plugin = LookupUtil.getPluginManager().getPlugin(selectedPlugin);
            if (null == plugin) {
                return;
            }

            List<ResourceType> types = LookupUtil.getResourceTypeManager().getResourceTypesByPlugin(plugin.getName());

            List<String> typeNames = new ArrayList<String>();
            for (ResourceType type : types) {
                typeNames.add(type.getName());
            }
View Full Code Here

        metadataManager.setDisabledResourceTypes(pluginContainerConfiguration.getDisabledResourceTypes());
        updateLoadedPlugins = new UpdateLoadedPlugins() {
            PluginTransformer transformer = new PluginTransformer();

            public void execute(PluginDescriptor pluginDescriptor, URL pluginURL) {
                Plugin plugin = transformer.toPlugin(pluginDescriptor, pluginURL);
                loadedPlugins.add(plugin);
            }
        };

        PluginFinder finder = pluginContainerConfiguration.getPluginFinder();
View Full Code Here

    private Set<Plugin> getPluginsInReport(Set<Resource> resources) {
        Set<Plugin> plugins = new HashSet<Plugin>();
        for (Resource resource : resources) {
            String name = resource.getResourceType().getPlugin();
            plugins.add(new Plugin(name, "/plugins/" + name));
            plugins.addAll(getPluginsInReport(resource.getChildResources()));
        }
        return plugins;
    }
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.