Package org.rhq.enterprise.server.plugin.pc

Examples of org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer


            for (Class<? extends AbstractTypeServerPluginContainer> cls : pluginContainerClasses) {
                try {
                    Constructor<? extends AbstractTypeServerPluginContainer> ctor = cls
                        .getConstructor(MasterServerPluginContainer.class);
                    AbstractTypeServerPluginContainer container = ctor.newInstance(this);
                    serverPluginContainers.add(container);
                } catch (Exception e) {
                    LOG.error("Failed to instantiate server plugin container class: " + cls.getName(), e);
                }
            }
View Full Code Here


        // this also checks to see if the plugin configuration has changed since it was last loaded
        MasterServerPluginContainer master = LookupUtil.getServerPluginService().getMasterPluginContainer();
        if (master != null) {
            for (ServerPlugin installedPlugin : installedPlugins) {
                PluginKey key = PluginKey.createServerPluginKey(installedPlugin.getType(), installedPlugin.getName());
                AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(key);
                if (pc != null && pc.isPluginLoaded(key)) {
                    boolean needToReloadPlugin = false;
                    boolean currentlyEnabled = pc.isPluginEnabled(key);
                    if (installedPlugin.isEnabled() != currentlyEnabled) {
                        log.info("Detected a state change to plugin [" + key + "]. It will now be "
                            + ((installedPlugin.isEnabled()) ? "[enabled]" : "[disabled]"));
                        needToReloadPlugin = true;
                    } else {
                        Long pluginLoadTime = pc.getPluginLoadTime(key);
                        if (pluginLoadTime != null) {
                            long configChangeTimestamp = serverPluginsManager
                                .getLastConfigurationChangeTimestamp(installedPlugin.getId());
                            if (configChangeTimestamp > pluginLoadTime) {
                                // since the last time the plugin was loaded, its configuration has changed, reload it to pick up the new config
                                log.info("Detected a config change to plugin [" + key + "]. It will be reloaded and "
                                    + ((installedPlugin.isEnabled()) ? "[enabled]" : "[disabled]"));
                                needToReloadPlugin = true;
                            }
                        }
                    }
                    if (needToReloadPlugin) {
                        pc.reloadPlugin(key, installedPlugin.isEnabled());
                    }
                }
            }
        }
View Full Code Here

        ServerPluginServiceMBean serverPluginService = LookupUtil.getServerPluginService();
        MasterServerPluginContainer master = serverPluginService.getMasterPluginContainer();
        boolean success = true; // assume everything will be ok

        if (master != null) {
            AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginKey);
            if (pc != null) {
                try {
                    pc.reloadPlugin(pluginKey, true);
                    try {
                        pc.schedulePluginJobs(pluginKey);
                    } catch (Exception e) {
                        // note that we still will report this plugin as enabled - its running
                        // in the plugin container, its just that we couldn't schedule its jobs
                        log.warn("Failed to schedule jobs for plugin [" + pluginKey + "]", e);
                    }
View Full Code Here

        ServerPluginServiceMBean serverPluginService = LookupUtil.getServerPluginService();
        MasterServerPluginContainer master = serverPluginService.getMasterPluginContainer();
        boolean success = true; // assume everything will be ok

        if (master != null) {
            AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginKey);
            if (pc != null) {
                try {
                    pc.unschedulePluginJobs(pluginKey);
                } catch (Exception e) {
                    // even though we can't unschedule jobs, keep going, assume success if the PC disabled it
                    log.warn("Failed to unschedule jobs for plugin [" + pluginKey + "]", e);
                }
                try {
                    pc.reloadPlugin(pluginKey, false);
                } catch (Exception e) {
                    log.warn("Failed to disable server plugin [" + pluginKey + "]", e);
                    success = false;
                }
            }
View Full Code Here

        ServerPluginServiceMBean serverPluginService = LookupUtil.getServerPluginService();
        MasterServerPluginContainer master = serverPluginService.getMasterPluginContainer();
        boolean success = true; // assume everything will be ok

        if (master != null) {
            AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginKey);
            if (pc != null) {
                try {
                    pc.unschedulePluginJobs(pluginKey);
                } catch (Exception e) {
                    log.warn("Failed to unschedule jobs for server plugin [" + pluginKey + "]", e);
                }
                try {
                    pc.unloadPlugin(pluginKey);
                } catch (Exception e) {
                    log.warn("Failed to unload server plugin [" + pluginKey + "]", e);
                    success = false;
                }
            }
View Full Code Here

    public List<ControlDefinition> getServerPluginControlDefinitions(PluginKey pluginKey) throws Exception {

        ServerPluginServiceMBean serverPluginService = LookupUtil.getServerPluginService();
        MasterServerPluginContainer master = serverPluginService.getMasterPluginContainer();
        if (master != null) {
            AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginKey);
            if (pc != null) {
                ServerPluginEnvironment env = pc.getPluginManager().getPluginEnvironment(pluginKey.getPluginName());
                List<ControlDefinition> defs;
                defs = ServerPluginDescriptorMetadataParser.getControlDefinitions(env.getPluginDescriptor());
                return defs;
            } else {
                throw new Exception("There is no known plugin named [" + pluginKey + "]");
View Full Code Here

        Configuration params) throws Exception {

        ServerPluginServiceMBean serverPluginService = LookupUtil.getServerPluginService();
        MasterServerPluginContainer master = serverPluginService.getMasterPluginContainer();
        if (master != null) {
            AbstractTypeServerPluginContainer pc = master.getPluginContainerByPlugin(pluginKey);
            if (pc != null) {
                ControlResults results = pc.invokePluginControl(pluginKey, controlName, params);
                return results;
            } else {
                throw new Exception("There is no known plugin named [" + pluginKey + "]. Cannot invoke [" + controlName
                    + "]");
            }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.plugin.pc.AbstractTypeServerPluginContainer

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.