Package org.rhq.enterprise.server.plugin

Examples of org.rhq.enterprise.server.plugin.ServerPluginManagerLocal


        ServerPlugin plugin = new ServerPlugin(0, descriptor.getName(), jar.getName(), descriptor.getDisplayName(),
            true, PluginStatusType.INSTALLED, descriptor.getDescription(), null, MessageDigestGenerator
                .getDigestString(jar), descriptor.getVersion(), descriptor.getApiVersion(), null, null, type
                .stringify(), System.currentTimeMillis(), System.currentTimeMillis());

        ServerPluginManagerLocal serverPluginsLocal = LookupUtil.getServerPluginManager();
        Map<ServerPluginType, List<PluginKey>> original = serverPluginsLocal.getInstalledServerPluginsGroupedByType();
        serverPluginsLocal.registerServerPlugin(LookupUtil.getSubjectManager().getOverlord(), plugin, jar);

        try {
            Map<ServerPluginType, List<PluginKey>> map = serverPluginsLocal.getInstalledServerPluginsGroupedByType();
            List<PluginKey> pluginKeys = map.get(type);

            if (original.containsKey(type)) {
                assert map.size() == original.size();
                assert pluginKeys.size() == original.get(type).size() + 1;
            } else {
                assert map.size() == original.size() + 1;
                assert pluginKeys.size() == 1;
            }
            boolean got_it = false;
            for (PluginKey pluginKey : pluginKeys) {
                if (pluginKey.getPluginName().equals("TestSimpleGenericPlugin")) {
                    got_it = true;
                    break;
                }
            }
            assert got_it == true;
        } finally {
            // make sure we clean this up, even on error
            serverPluginsLocal.purgeServerPlugin(plugin.getId());
        }

        // test that purge really deleted it
        Map<ServerPluginType, List<PluginKey>> map = serverPluginsLocal.getInstalledServerPluginsGroupedByType();
        List<PluginKey> pluginKeys = map.get(type);

        assert map.size() == original.size();
        if (pluginKeys == null) {
            assert !original.containsKey(type) : "we dont have any plugins of this type, neither should original";
View Full Code Here


    public AbstractPlugin lookupPlugin() {
        if (this.deployment == PluginDeploymentType.AGENT) {
            return LookupUtil.getPluginManager().getPlugin(this.name);
        } else if (this.deployment == PluginDeploymentType.SERVER) {
            PluginKey pluginKey = new PluginKey(this.deployment, this.pluginType, this.name);
            ServerPluginManagerLocal serverPluginsBean = LookupUtil.getServerPluginManager();
            ServerPlugin plugin = serverPluginsBean.getServerPlugin(pluginKey);
            return serverPluginsBean.getServerPluginRelationships(plugin);
        }

        return null;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.plugin.ServerPluginManagerLocal

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.