From: <ma...@rh...> - 2009-03-31 05:47:55
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [3565] [RHQ-1884] rename the overseer to a more descriptive "plugin lifecycle listener" - this checkin also introduces the new pom under plugins/validate-all-plugins that will validate all the currently building RHQ plugins.</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3565</dd> <dt>Author</dt> <dd>mazz</dd> <dt>Date</dt> <dd>2009-03-31 00:47:44 -0500 (Tue, 31 Mar 2009)</dd> </dl> <h3>Log Message</h3> <pre>[RHQ-1884] rename the overseer to a more descriptive "plugin lifecycle listener" - this checkin also introduces the new pom under plugins/validate-all-plugins that will validate all the currently building RHQ plugins.</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoreclientapisrcmainjavaorgrhqcoreclientapiagentmetadataPluginMetadataManagerjava">rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java</a></li> <li><a href="#rhqtrunkmodulescoreclientapisrcmainjavaorgrhqcoreclientapiagentmetadataPluginMetadataParserjava">rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java</a></li> <li><a href="#rhqtrunkmodulescoreclientapisrcmainresourcesrhqpluginxsd">rhq/trunk/modules/core/client-api/src/main/resources/rhq-plugin.xsd</a></li> <li><a href="#rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcpluginPluginManagerjava">rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java</a></li> <li><a href="#rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcpluginPluginValidatorjava">rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java</a></li> <li><a href="#rhqtrunkmoduleshelperspluginGensrcmainjavaorgrhqhelperspluginGenPluginGenjava">rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java</a></li> <li><a href="#rhqtrunkmoduleshelperspluginGensrcmainjavaorgrhqhelperspluginGenPropsjava">rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java</a></li> <li><a href="#rhqtrunkmoduleshelperspluginGensrcmainresourcescomponentftl">rhq/trunk/modules/helpers/pluginGen/src/main/resources/component.ftl</a></li> <li><a href="#rhqtrunkmoduleshelperspluginGensrcmainresourcesdescriptorftl">rhq/trunk/modules/helpers/pluginGen/src/main/resources/descriptor.ftl</a></li> <li><a href="#rhqtrunkmodulespluginsdatabasesrcmainresourcesMETAINFrhqpluginxml">rhq/trunk/modules/plugins/database/src/main/resources/META-INF/rhq-plugin.xml</a></li> <li><a href="#rhqtrunkmodulespluginsmysqlsrcmainresourcesMETAINFrhqpluginxml">rhq/trunk/modules/plugins/mysql/src/main/resources/META-INF/rhq-plugin.xml</a></li> <li><a href="#rhqtrunkmodulespluginsoraclesrcmainresourcesMETAINFrhqpluginxml">rhq/trunk/modules/plugins/oracle/src/main/resources/META-INF/rhq-plugin.xml</a></li> <li><a href="#rhqtrunkmodulespluginspomxml">rhq/trunk/modules/plugins/pom.xml</a></li> <li><a href="#rhqtrunkmodulespluginspostgressrcmainresourcesMETAINFrhqpluginxml">rhq/trunk/modules/plugins/postgres/src/main/resources/META-INF/rhq-plugin.xml</a></li> <li><a href="#rhqtrunkpomxml">rhq/trunk/pom.xml</a></li> </ul> <h3>Added Paths</h3> <ul> <li><a href="#rhqtrunkmodulescorepluginapisrcmainjavaorgrhqcorepluginapipluginPluginLifecycleListenerjava">rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java</a></li> <li><a href="#rhqtrunkmodulespluginsdatabasesrcmainjavaorgrhqpluginsdatabaseDatabasePluginLifecycleListenerjava">rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginLifecycleListener.java</a></li> <li><a href="#rhqtrunkmodulespluginsmysqlsrcmainjavaorgrhqpluginsmysqlMySqlPluginLifecycleListenerjava">rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginLifecycleListener.java</a></li> <li><a href="#rhqtrunkmodulespluginsoraclesrcmainjavaorgrhqpluginsoracleOraclePluginLifecycleListenerjava">rhq/trunk/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OraclePluginLifecycleListener.java</a></li> <li><a href="#rhqtrunkmodulespluginspostgressrcmainjavaorgrhqpluginspostgresPostgresPluginLifecycleListenerjava">rhq/trunk/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresPluginLifecycleListener.java</a></li> <li>rhq/trunk/modules/plugins/validate-all-plugins/</li> <li><a href="#rhqtrunkmodulespluginsvalidateallpluginspomxml">rhq/trunk/modules/plugins/validate-all-plugins/pom.xml</a></li> </ul> <h3>Removed Paths</h3> <ul> <li><a href="#rhqtrunkmodulescorepluginapisrcmainjavaorgrhqcorepluginapipluginPluginOverseerjava">rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginOverseer.java</a></li> <li><a href="#rhqtrunkmodulespluginsdatabasesrcmainjavaorgrhqpluginsdatabaseDatabasePluginOverseerjava">rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginOverseer.java</a></li> <li><a href="#rhqtrunkmodulespluginsmysqlsrcmainjavaorgrhqpluginsmysqlMySqlPluginOverseerjava">rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginOverseer.java</a></li> <li><a href="#rhqtrunkmodulespluginsoraclesrcmainjavaorgrhqpluginsoracleOraclePluginOverseerjava">rhq/trunk/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OraclePluginOverseer.java</a></li> <li><a href="#rhqtrunkmodulespluginspostgressrcmainjavaorgrhqpluginspostgresPostgresPluginOverseerjava">rhq/trunk/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresPluginOverseer.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoreclientapisrcmainjavaorgrhqcoreclientapiagentmetadataPluginMetadataManagerjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -82,9 +82,9 @@ </span><span class="cx"> return TEST_PLATFORM_TYPE; } </span><span class="rem">- public String getPluginOverseerClass(String pluginName) { </span><span class="add">+ public String getPluginLifecycleListenerClass(String pluginName) { </span><span class="cx"> PluginMetadataParser parser = this.parsersByPlugin.get(pluginName); </span><span class="rem">- return (parser != null) ? parser.getPluginOverseerClass() : null; </span><span class="add">+ return (parser != null) ? parser.getPluginLifecycleListenerClass() : null; </span><span class="cx"> } public String getDiscoveryClass(ResourceType resourceType) { </span></pre></div> <a id="rhqtrunkmodulescoreclientapisrcmainjavaorgrhqcoreclientapiagentmetadataPluginMetadataParserjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -89,9 +89,9 @@ </span><span class="cx"> parseDescriptor(); } </span><span class="rem">- public String getPluginOverseerClass() { </span><span class="add">+ public String getPluginLifecycleListenerClass() { </span><span class="cx"> String pkg = this.pluginDescriptor.getPackage(); </span><span class="rem">- String clazz = this.pluginDescriptor.getOverseer(); </span><span class="add">+ String clazz = this.pluginDescriptor.getPluginLifecycleListener(); </span><span class="cx"> return getFullyQualifiedComponentClassName(pkg, clazz); } </span></pre></div> <a id="rhqtrunkmodulescoreclientapisrcmainresourcesrhqpluginxsd"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/client-api/src/main/resources/rhq-plugin.xsd (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/client-api/src/main/resources/rhq-plugin.xsd 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/core/client-api/src/main/resources/rhq-plugin.xsd 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -135,7 +135,7 @@ </span><span class="cx"> </xs:documentation> </xs:annotation> </xs:attribute> </span><span class="rem">- <xs:attribute name="overseer" type="rhq:classNameType" use="optional"> </span><span class="add">+ <xs:attribute name="pluginLifecycleListener" type="rhq:classNameType" use="optional"> </span><span class="cx"> <xs:annotation> <xs:documentation> A class that performs global initialization and shutdown of the plugin. If specified, </span></pre></div> <a id="rhqtrunkmodulescorepluginapisrcmainjavaorgrhqcorepluginapipluginPluginLifecycleListenerjavafromrev3564rhqtrunkmodulescorepluginapisrcmainjavaorgrhqcorepluginapipluginPluginOverseerjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java (from rev 3564, rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginOverseer.java) (0 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java (rev 0) +++ rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -0,0 +1,57 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation, and/or the GNU Lesser + * General Public License, version 2.1, also as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License and the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License + * and the GNU Lesser General Public License along with this program; + * if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.rhq.core.pluginapi.plugin; + +/** + * Performs global initialization and shutdown of a plugin. This class will + * be notified when the plugin is loaded and unloaded. This provides a place + * for plugin developers to allocate global resources needed by all plugin components and + * a place to clean up those resources. + * + * @author John Mazzitelli + */ +public interface PluginLifecycleListener { + /** + * When a plugin is being loaded, this method will be called. + * When this is called, no plugin resource or discovery components have been instantiated + * or invoked yet. This is merely called to notify the plugin that it is about to be + * placed into service and its components will soon be asked to discovery and manage + * resources. + * + * @param context a context with information about the runtime plugin environment + * + * @throws Exception if the plugin finds that it should not be loaded, an exception should be thrown. + * If thrown, this plugin will not be loaded and will be considered disabled. If + * other plugins are dependent on this failed plugin, those other plugins will + * fail to operate correctly. + */ + void initialize(PluginContext context) throws Exception; + + /** + * When the plugin container shuts down and it unloads the plugin, this method will be called. + * This provides an opportunity for the plugin to clean up any global resources it has previously + * allocated. After this method is called, invocations of this plugin's discovery or + * resource components will no longer occur. + */ + void shutdown(); +} </span></pre></div> <a id="rhqtrunkmodulescorepluginapisrcmainjavaorgrhqcorepluginapipluginPluginOverseerjava"></a> <div class="delfile"><h4>Deleted: rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginOverseer.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginOverseer.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginOverseer.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -1,57 +0,0 @@ </span><span class="rem">-/* - * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation, and/or the GNU Lesser - * General Public License, version 2.1, also as published by the Free - * Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License and the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.rhq.core.pluginapi.plugin; - -/** - * Performs global initialization and shutdown of a plugin. This class will - * be notified when the plugin is loaded and unloaded. This provides a place - * for plugin developers to allocate global resources needed by all plugin components and - * a place to clean up those resources. - * - * @author John Mazzitelli - */ -public interface PluginOverseer { - /** - * When a plugin is being loaded, this method will be called. - * When this is called, no plugin resource or discovery components have been instantiated - * or invoked yet. This is merely called to notify the plugin that it is about to be - * placed into service and its components will soon be asked to discovery and manage - * resources. - * - * @param context a context with information about the runtime plugin environment - * - * @throws Exception if the plugin finds that it should not be loaded, an exception should be thrown. - * If thrown, this plugin will not be loaded and will be considered disabled. If - * other plugins are dependent on this failed plugin, those other plugins will - * fail to operate correctly. - */ - void initialize(PluginContext context) throws Exception; - - /** - * When the plugin container shuts down and it unloads the plugin, this method will be called. - * This provides an opportunity for the plugin to clean up any global resources it has previously - * allocated. After this method is called, invocations of this plugin's discovery or - * resource components will no longer occur. - */ - void shutdown(); -} </span></pre></div> <a id="rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcpluginPluginManagerjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginManager.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -44,7 +44,7 @@ </span><span class="cx"> import org.rhq.core.pc.ContainerService; import org.rhq.core.pc.PluginContainerConfiguration; import org.rhq.core.pluginapi.plugin.PluginContext; </span><span class="rem">-import org.rhq.core.pluginapi.plugin.PluginOverseer; </span><span class="add">+import org.rhq.core.pluginapi.plugin.PluginLifecycleListener; </span><span class="cx"> import org.rhq.core.system.SystemInfo; import org.rhq.core.system.SystemInfoFactory; import org.rhq.core.util.exception.ThrowableUtil; </span><span class="lines">@@ -74,9 +74,9 @@ </span><span class="cx"> /** * Cached instances of objects used to initialize and shutdown individual plugins. </span><span class="rem">- * Only plugins that declare their own overseers will have objects in this cache. </span><span class="add">+ * Only plugins that declare their own lifecycle listener will have objects in this cache. </span><span class="cx"> */ </span><span class="rem">- private Map<String, PluginOverseer> pluginOverseerCache; </span><span class="add">+ private Map<String, PluginLifecycleListener> pluginLifecycleListenerCache; </span><span class="cx"> private PluginMetadataManager metadataManager; private PluginContainerConfiguration configuration; </span><span class="lines">@@ -91,7 +91,7 @@ </span><span class="cx"> public void initialize() { loadedPluginEnvironments = new HashMap<String, PluginEnvironment>(); loadedPlugins = new ArrayList<String>(); </span><span class="rem">- pluginOverseerCache = new HashMap<String, PluginOverseer>(); </span><span class="add">+ pluginLifecycleListenerCache = new HashMap<String, PluginLifecycleListener>(); </span><span class="cx"> metadataManager = new PluginMetadataManager(); PluginFinder finder = configuration.getPluginFinder(); </span><span class="lines">@@ -195,19 +195,19 @@ </span><span class="cx"> // We want to shut them down in the reverse order that we initialized them. Collections.reverse(this.loadedPlugins); for (String pluginName : this.loadedPlugins) { </span><span class="rem">- PluginOverseer overseer = this.pluginOverseerCache.get(pluginName); - if (overseer != null) { </span><span class="add">+ PluginLifecycleListener listener = this.pluginLifecycleListenerCache.get(pluginName); + if (listener != null) { </span><span class="cx"> try { ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader( this.loadedPluginEnvironments.get(pluginName).getPluginClassLoader()); try { </span><span class="rem">- overseer.shutdown(); </span><span class="add">+ listener.shutdown(); </span><span class="cx"> } finally { Thread.currentThread().setContextClassLoader(originalCL); } } catch (Throwable t) { </span><span class="rem">- log.warn("Failed to get overseer to shutdown [" + pluginName + "]. Cause: " </span><span class="add">+ log.warn("Failed to get lifecycle listener to shutdown [" + pluginName + "]. Cause: " </span><span class="cx"> + ThrowableUtil.getAllMessages(t)); } } </span><span class="lines">@@ -224,8 +224,8 @@ </span><span class="cx"> this.loadedPlugins.clear(); this.loadedPlugins = null; </span><span class="rem">- this.pluginOverseerCache.clear(); - this.pluginOverseerCache = null; </span><span class="add">+ this.pluginLifecycleListenerCache.clear(); + this.pluginLifecycleListenerCache = null; </span><span class="cx"> this.metadataManager = null; } </span><span class="lines">@@ -292,7 +292,7 @@ </span><span class="cx"> String pluginName = pluginEnvironment.getPluginName(); // tell the plugin we have loaded it </span><span class="rem">- PluginOverseer overseer = getPluginOverseer(pluginName, pluginEnvironment, pluginDescriptor); </span><span class="add">+ PluginLifecycleListener overseer = getPluginLifecycleListener(pluginName, pluginEnvironment, pluginDescriptor); </span><span class="cx"> if (overseer != null) { PluginContext context = createPluginContext(pluginName); ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); </span><span class="lines">@@ -300,11 +300,11 @@ </span><span class="cx"> try { overseer.initialize(context); } catch (Throwable t) { </span><span class="rem">- throw new PluginContainerException("Overseer failed to initialize plugin", t); </span><span class="add">+ throw new PluginContainerException("Plugin Lifecycle Listener failed to initialize plugin", t); </span><span class="cx"> } finally { Thread.currentThread().setContextClassLoader(originalCL); } </span><span class="rem">- this.pluginOverseerCache.put(pluginName, overseer); </span><span class="add">+ this.pluginLifecycleListenerCache.put(pluginName, overseer); </span><span class="cx"> } // everything is loaded and initialized </span><span class="lines">@@ -316,41 +316,41 @@ </span><span class="cx"> } /** </span><span class="rem">- * This will create a new {@link PluginOverseer} instance for that is used to - * initialize and shutdown a particular plugin. If there is no plugin overseer </span><span class="add">+ * This will create a new {@link PluginLifecycleListener} instance for that is used to + * initialize and shutdown a particular plugin. If there is no plugin lifecycle listener </span><span class="cx"> * configured for the given plugin, <code>null</code> is returned. * * The new object will be loaded in the plugin's specific classloader. * </span><span class="rem">- * @param pluginName the name of the plugin whose {@link PluginOverseer} is to be retrieved </span><span class="add">+ * @param pluginName the name of the plugin whose {@link PluginLifecycleListener} is to be retrieved </span><span class="cx"> * @param pluginEnvironment the environment in which the plugin will execute * @param pluginDescriptor the plugin's descriptor * * @return a new object loaded in the proper plugin classloader that can initialize/shutdown the plugin, </span><span class="rem">- * or <code>null</code> if there is no plugin overseer to be associated with the given plugin </span><span class="add">+ * or <code>null</code> if there is no plugin lifecycle listener to be associated with the given plugin </span><span class="cx"> * * @throws PluginContainerException if failed to create the instance */ </span><span class="rem">- private PluginOverseer getPluginOverseer(String pluginName, PluginEnvironment pluginEnvironment, </span><span class="add">+ private PluginLifecycleListener getPluginLifecycleListener(String pluginName, PluginEnvironment pluginEnvironment, </span><span class="cx"> PluginDescriptor pluginDescriptor) throws PluginContainerException { </span><span class="rem">- PluginOverseer instance = pluginOverseerCache.get(pluginName); </span><span class="add">+ PluginLifecycleListener instance = pluginLifecycleListenerCache.get(pluginName); </span><span class="cx"> if (instance == null) { </span><span class="rem">- String className = getPluginOverseerClass(pluginDescriptor); </span><span class="add">+ String className = getPluginLifecycleListenerClass(pluginDescriptor); </span><span class="cx"> if (className != null) { </span><span class="rem">- log.debug("Creating plugin overseer [" + className + "] for plugin [" + pluginName + "]"); - instance = (PluginOverseer) instantiateClass(pluginEnvironment, className); - log.debug("Created plugin overseer [" + className + "] for plugin [" + pluginName + "]"); </span><span class="add">+ log.debug("Creating plugin lifecycle listener [" + className + "] for plugin [" + pluginName + "]"); + instance = (PluginLifecycleListener) instantiateClass(pluginEnvironment, className); + log.debug("Created plugin lifecycle listener [" + className + "] for plugin [" + pluginName + "]"); </span><span class="cx"> } } return instance; } </span><span class="rem">- private String getPluginOverseerClass(PluginDescriptor pluginDescriptor) { - String className = pluginDescriptor.getOverseer(); </span><span class="add">+ private String getPluginLifecycleListenerClass(PluginDescriptor pluginDescriptor) { + String className = pluginDescriptor.getPluginLifecycleListener(); </span><span class="cx"> if (className != null) { String pkg = pluginDescriptor.getPackage(); if ((className.indexOf('.') == -1) && (pkg != null)) { </span></pre></div> <a id="rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcpluginPluginValidatorjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginValidator.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -42,7 +42,7 @@ </span><span class="cx"> import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; import org.rhq.core.pluginapi.measurement.MeasurementFacet; import org.rhq.core.pluginapi.operation.OperationFacet; </span><span class="rem">-import org.rhq.core.pluginapi.plugin.PluginOverseer; </span><span class="add">+import org.rhq.core.pluginapi.plugin.PluginLifecycleListener; </span><span class="cx"> /** * A utility to test a set of plugins are valid. </span><span class="lines">@@ -211,23 +211,23 @@ </span><span class="cx"> } } </span><span class="rem">- String overseerClass = mm.getPluginOverseerClass(resourceType.getPlugin()); </span><span class="add">+ String overseerClass = mm.getPluginLifecycleListenerClass(resourceType.getPlugin()); </span><span class="cx"> if (overseerClass != null) { try { Class overseerClazz = Class.forName(overseerClass, false, pluginEnvironment .getPluginClassLoader()); if (overseerClazz != null) { </span><span class="rem">- if (!PluginOverseer.class.isAssignableFrom(overseerClazz)) { </span><span class="add">+ if (!PluginLifecycleListener.class.isAssignableFrom(overseerClazz)) { </span><span class="cx"> success = false; </span><span class="rem">- LOG.error("Overseer class [" + overseerClass + "] for plugin [" </span><span class="add">+ LOG.error("Plugin Lifecycle Listener class [" + overseerClass + "] for plugin [" </span><span class="cx"> + resourceType.getPlugin() + "] does not implement " </span><span class="rem">- + PluginOverseer.class.toString()); </span><span class="add">+ + PluginLifecycleListener.class.toString()); </span><span class="cx"> } } } catch (Exception e) { success = false; </span><span class="rem">- LOG.error("Cannot find overseer class [" + overseerClass + "] for plugin [" </span><span class="add">+ LOG.error("Cannot find Plugin Lifecycle Listener class [" + overseerClass + "] for plugin [" </span><span class="cx"> + resourceType.getPlugin() + "]"); } } </span></pre></div> <a id="rhqtrunkmoduleshelperspluginGensrcmainjavaorgrhqhelperspluginGenPluginGenjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/PluginGen.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -64,7 +64,7 @@ </span><span class="cx"> BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Props props = askQuestions(br, new Props()); </span><span class="rem">- if (props==null) { </span><span class="add">+ if (props == null) { </span><span class="cx"> // abort by user return; } </span><span class="lines">@@ -80,7 +80,7 @@ </span><span class="cx"> done = true; else { Props child = askQuestions(br, props); </span><span class="rem">- if (child==null) { </span><span class="add">+ if (child == null) { </span><span class="cx"> // abort by user return; } </span><span class="lines">@@ -165,7 +165,7 @@ </span><span class="cx"> props.setParentType(caps(parentProps.getComponentClass())); } else if (name.equals("UsesExternalJarsInPlugin") && parentProps.getName() != null) { // Skip this one on children </span><span class="rem">- } else if (name.equals("UseOverseerApi") && parentProps.getName() != null) { </span><span class="add">+ } else if (name.equals("UsePluginLifecycleListenerApi") && parentProps.getName() != null) { </span><span class="cx"> // Skip this one on children } else if (name.equals("Pkg")) { // Always skip this - we postprocess it </span><span class="lines">@@ -181,7 +181,7 @@ </span><span class="cx"> } answer = br.readLine(); </span><span class="rem">- if (answer==null) { </span><span class="add">+ if (answer == null) { </span><span class="cx"> System.out.println("EOL .. aborting"); return null; } </span><span class="lines">@@ -194,7 +194,8 @@ </span><span class="cx"> setter = Props.class.getMethod(setterName, String.class); if (isBool) { </span><span class="rem">- if (answer.toLowerCase(Locale.getDefault()).startsWith("y") || answer.toLowerCase(Locale.getDefault()).startsWith("j")) { </span><span class="add">+ if (answer.toLowerCase(Locale.getDefault()).startsWith("y") + || answer.toLowerCase(Locale.getDefault()).startsWith("j")) { </span><span class="cx"> setter.invoke(props, true); } } else { </span></pre></div> <a id="rhqtrunkmoduleshelperspluginGensrcmainjavaorgrhqhelperspluginGenPropsjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/helpers/pluginGen/src/main/java/org/rhq/helpers/pluginGen/Props.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -64,8 +64,8 @@ </span><span class="cx"> private boolean usesExternalJarsInPlugin; /** Does it support manuall add of children ? */ private boolean manualAddOfChildren; </span><span class="rem">- /** Does it use the overseer api ? */ - private boolean useOverseerApi; </span><span class="add">+ /** Does it use the PluginLifecycleListener api ? */ + private boolean usePluginLifecycleListenerApi; </span><span class="cx"> /** Embedded children */ private Set<Props> children = new HashSet<Props>(); </span><span class="lines">@@ -222,12 +222,12 @@ </span><span class="cx"> return this.pkg; } </span><span class="rem">- public boolean isUseOverseerApi() { - return useOverseerApi; </span><span class="add">+ public boolean isUsePluginLifecycleListenerApi() { + return usePluginLifecycleListenerApi; </span><span class="cx"> } </span><span class="rem">- public void setUseOverseerApi(boolean useOverseerApi) { - this.useOverseerApi = useOverseerApi; </span><span class="add">+ public void setUsePluginLifecycleListenerApi(boolean usePluginLifecycleListenerApi) { + this.usePluginLifecycleListenerApi = usePluginLifecycleListenerApi; </span><span class="cx"> } @Override </span><span class="lines">@@ -252,7 +252,7 @@ </span><span class="cx"> sb.append(", deleteChildren=").append(deleteChildren); sb.append(", usesExternalJarsInPlugin=").append(usesExternalJarsInPlugin); sb.append(", manualAddOfChildren=").append(manualAddOfChildren); </span><span class="rem">- sb.append(", useOverseerApi=").append(useOverseerApi); </span><span class="add">+ sb.append(", usePluginLifecycleListenerApi=").append(usePluginLifecycleListenerApi); </span><span class="cx"> sb.append(", children=").append(children); sb.append('}'); return sb.toString(); </span></pre></div> <a id="rhqtrunkmoduleshelperspluginGensrcmainresourcescomponentftl"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/helpers/pluginGen/src/main/resources/component.ftl (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/helpers/pluginGen/src/main/resources/component.ftl 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/helpers/pluginGen/src/main/resources/component.ftl 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -60,9 +60,9 @@ </span><span class="cx"> import org.rhq.core.pluginapi.operation.OperationFacet; import org.rhq.core.pluginapi.operation.OperationResult; </#if> </span><span class="rem">-<#if props.useOverseerApi> </span><span class="add">+<#if props.usePluginLifecycleListenerApi> </span><span class="cx"> import org.rhq.core.pluginapi.plugin.PluginContext; </span><span class="rem">-import org.rhq.core.pluginapi.plugin.PluginOverseer; </span><span class="add">+import org.rhq.core.pluginapi.plugin.PluginLifecycleListener; </span><span class="cx"> </#if> </span><span class="lines">@@ -82,8 +82,8 @@ </span><span class="cx"> <#if props.deleteChildren> , DeleteResourceFacet </#if> </span><span class="rem">-<#if props.useOverseerApi> -, PluginOverseer </span><span class="add">+<#if props.usePluginLifecycleListenerApi> +, PluginLifecycleListener </span><span class="cx"> </#if> { private final Log log = LogFactory.getLog(this.getClass()); </span><span class="lines">@@ -97,10 +97,10 @@ </span><span class="cx"> EventContext eventContext; </#if> </span><span class="rem">- <#if props.useOverseerApi> </span><span class="add">+ <#if props.usePluginLifecycleListenerApi> </span><span class="cx"> /** * Callback when the plugin is created </span><span class="rem">- * @see org.rhq.core.pluginapi.plugin.PluginOverseer#initialize(PluginContext) </span><span class="add">+ * @see org.rhq.core.pluginapi.plugin.PluginLifecycleListener#initialize(PluginContext) </span><span class="cx"> */ public void initialize(PluginContext context) throws Exception { </span><span class="lines">@@ -108,7 +108,7 @@ </span><span class="cx"> /** * Callback when the plugin is unloaded </span><span class="rem">- * @see org.rhq.core.pluginapi.plugin.PluginOverseer#shutdown() </span><span class="add">+ * @see org.rhq.core.pluginapi.plugin.PluginLifecycleListener#shutdown() </span><span class="cx"> */ public void shutdown() { </span></pre></div> <a id="rhqtrunkmoduleshelperspluginGensrcmainresourcesdescriptorftl"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/helpers/pluginGen/src/main/resources/descriptor.ftl (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/helpers/pluginGen/src/main/resources/descriptor.ftl 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/helpers/pluginGen/src/main/resources/descriptor.ftl 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -22,8 +22,8 @@ </span><span class="cx"> <?xml version="1.0"?> <plugin name="${props.name}" displayName="${props.name}Plugin" </span><span class="rem">-<#if props.useOverseerApi> - overseer="${props.componentClass}" </span><span class="add">+<#if props.usePluginLifecycleListenerApi> + pluginLifecycleListener="${props.componentClass}" </span><span class="cx"> </#if> package="${props.pkg}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" </span></pre></div> <a id="rhqtrunkmodulespluginsdatabasesrcmainjavaorgrhqpluginsdatabaseDatabasePluginLifecycleListenerjavafromrev3564rhqtrunkmodulespluginsdatabasesrcmainjavaorgrhqpluginsdatabaseDatabasePluginOverseerjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginLifecycleListener.java (from rev 3564, rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginOverseer.java) (0 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginLifecycleListener.java (rev 0) +++ rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginLifecycleListener.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -0,0 +1,71 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.plugins.database; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.Enumeration; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.core.pluginapi.plugin.PluginContext; +import org.rhq.core.pluginapi.plugin.PluginLifecycleListener; +import org.rhq.core.util.exception.ThrowableUtil; + +/** + * This is a plugin lifecycle listener object for database plugins. It is used to + * deregister any JDBC drivers that happened to have been + * cached by the plugin. This is needed to avoid leaking perm gen + * memory when a plugin's classloader is destroyed because + * java.sql.DriverManager will maintain references that prevent the + * plugin's classloader and its resources from being garbaged collected. + * + * All database plugins should have their own class that does this but + * due to the odd way java.sql.DriverManager caches drivers, plugins that + * extend the database plugin cannot simply reuse or subclass this object. + * + * @author John Mazzitelli + */ +public class DatabasePluginLifecycleListener implements PluginLifecycleListener { + + private final Log log = LogFactory.getLog(DatabasePluginLifecycleListener.class); + + public void initialize(PluginContext context) throws Exception { + // no-op + } + + public void shutdown() { + // so we do not cause our classloader to leak perm gen, we need to de-register + // any and all JDBC drivers this plugin registered + Enumeration<Driver> drivers = DriverManager.getDrivers(); + while (drivers.hasMoreElements()) { + try { + Driver driver = drivers.nextElement(); + DriverManager.deregisterDriver(driver); + log.debug("Deregistered JDBC driver: " + driver.getClass()); + } catch (Exception e) { + log.warn("Failed to deregister JDBC drivers - memory might leak" + ThrowableUtil.getAllMessages(e)); + } + } + + log.debug(this.getClass().getSimpleName() + " completed shutdown."); + return; + } +} </span></pre></div> <a id="rhqtrunkmodulespluginsdatabasesrcmainjavaorgrhqpluginsdatabaseDatabasePluginOverseerjava"></a> <div class="delfile"><h4>Deleted: rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginOverseer.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginOverseer.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/plugins/database/src/main/java/org/rhq/plugins/database/DatabasePluginOverseer.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -1,71 +0,0 @@ </span><span class="rem">-/* - * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.plugins.database; - -import java.sql.Driver; -import java.sql.DriverManager; -import java.util.Enumeration; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.core.pluginapi.plugin.PluginContext; -import org.rhq.core.pluginapi.plugin.PluginOverseer; -import org.rhq.core.util.exception.ThrowableUtil; - -/** - * This is an overseer object for database plugins. It is used to - * deregister any JDBC drivers that happened to have been - * cached by the plugin. This is needed to avoid leaking perm gen - * memory when a plugin's classloader is destroyed because - * java.sql.DriverManager will maintain references that prevent the - * plugin's classloader and its resources from being garbaged collected. - * - * All database plugins should have their own class that does this but - * due to the odd way java.sql.DriverManager caches drivers, plugins that - * extend the database plugin cannot simply reuse or subclass this object. - * - * @author John Mazzitelli - */ -public class DatabasePluginOverseer implements PluginOverseer { - - private final Log log = LogFactory.getLog(DatabasePluginOverseer.class); - - public void initialize(PluginContext context) throws Exception { - // no-op - } - - public void shutdown() { - // so we do not cause our classloader to leak perm gen, we need to de-register - // any and all JDBC drivers this plugin registered - Enumeration<Driver> drivers = DriverManager.getDrivers(); - while (drivers.hasMoreElements()) { - try { - Driver driver = drivers.nextElement(); - DriverManager.deregisterDriver(driver); - log.debug("Deregistered JDBC driver: " + driver.getClass()); - } catch (Exception e) { - log.warn("Failed to deregister JDBC drivers - memory might leak" + ThrowableUtil.getAllMessages(e)); - } - } - - log.debug(this.getClass().getSimpleName() + " completed shutdown."); - return; - } -} </span></pre></div> <a id="rhqtrunkmodulespluginsdatabasesrcmainresourcesMETAINFrhqpluginxml"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/plugins/database/src/main/resources/META-INF/rhq-plugin.xml (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/database/src/main/resources/META-INF/rhq-plugin.xml 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/plugins/database/src/main/resources/META-INF/rhq-plugin.xml 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -4,7 +4,7 @@ </span><span class="cx"> displayName="Abstract Database" description="Abstract plugin supporting concrete database plugins" package="org.rhq.plugins.database" </span><span class="rem">- overseer="DatabasePluginOverseer" </span><span class="add">+ pluginLifecycleListener="DatabasePluginLifecycleListener" </span><span class="cx"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"> </plugin> \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulespluginsmysqlsrcmainjavaorgrhqpluginsmysqlMySqlPluginLifecycleListenerjavafromrev3564rhqtrunkmodulespluginsmysqlsrcmainjavaorgrhqpluginsmysqlMySqlPluginOverseerjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginLifecycleListener.java (from rev 3564, rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginOverseer.java) (0 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginLifecycleListener.java (rev 0) +++ rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginLifecycleListener.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -0,0 +1,56 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.plugins.mysql; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.Enumeration; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.core.pluginapi.plugin.PluginContext; +import org.rhq.core.pluginapi.plugin.PluginLifecycleListener; +import org.rhq.core.util.exception.ThrowableUtil; + +public class MySqlPluginLifecycleListener implements PluginLifecycleListener { + private final Log log = LogFactory.getLog(MySqlPluginLifecycleListener.class); + + public void initialize(PluginContext context) throws Exception { + // no-op + } + + public void shutdown() { + // so we do not cause our classloader to leak perm gen, we need to de-register + // any and all JDBC drivers this plugin registered + Enumeration<Driver> drivers = DriverManager.getDrivers(); + while (drivers.hasMoreElements()) { + try { + Driver driver = drivers.nextElement(); + DriverManager.deregisterDriver(driver); + log.debug("Deregistered JDBC driver: " + driver.getClass()); + } catch (Exception e) { + log.warn("Failed to deregister JDBC drivers - memory might leak" + ThrowableUtil.getAllMessages(e)); + } + } + + log.debug(this.getClass().getSimpleName() + " completed shutdown."); + return; + } +} </span></pre></div> <a id="rhqtrunkmodulespluginsmysqlsrcmainjavaorgrhqpluginsmysqlMySqlPluginOverseerjava"></a> <div class="delfile"><h4>Deleted: rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginOverseer.java (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginOverseer.java 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/plugins/mysql/src/main/java/org/rhq/plugins/mysql/MySqlPluginOverseer.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -1,56 +0,0 @@ </span><span class="rem">-/* - * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.plugins.mysql; - -import java.sql.Driver; -import java.sql.DriverManager; -import java.util.Enumeration; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.rhq.core.pluginapi.plugin.PluginContext; -import org.rhq.core.pluginapi.plugin.PluginOverseer; -import org.rhq.core.util.exception.ThrowableUtil; - -public class MySqlPluginOverseer implements PluginOverseer { - private final Log log = LogFactory.getLog(MySqlPluginOverseer.class); - - public void initialize(PluginContext context) throws Exception { - // no-op - } - - public void shutdown() { - // so we do not cause our classloader to leak perm gen, we need to de-register - // any and all JDBC drivers this plugin registered - Enumeration<Driver> drivers = DriverManager.getDrivers(); - while (drivers.hasMoreElements()) { - try { - Driver driver = drivers.nextElement(); - DriverManager.deregisterDriver(driver); - log.debug("Deregistered JDBC driver: " + driver.getClass()); - } catch (Exception e) { - log.warn("Failed to deregister JDBC drivers - memory might leak" + ThrowableUtil.getAllMessages(e)); - } - } - - log.debug(this.getClass().getSimpleName() + " completed shutdown."); - return; - } -} </span></pre></div> <a id="rhqtrunkmodulespluginsmysqlsrcmainresourcesMETAINFrhqpluginxml"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/plugins/mysql/src/main/resources/META-INF/rhq-plugin.xml (3564 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/mysql/src/main/resources/META-INF/rhq-plugin.xml 2009-03-31 03:24:21 UTC (rev 3564) +++ rhq/trunk/modules/plugins/mysql/src/main/resources/META-INF/rhq-plugin.xml 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -3,7 +3,7 @@ </span><span class="cx"> <plugin name="MySql" displayName="MySql Database" package="org.rhq.plugins.mysql" </span><span class="rem">- overseer="MySqlPluginOverseer" </span><span class="add">+ pluginLifecycleListener="MySqlPluginLifecycleListener" </span><span class="cx"> description="Management and monitoring of MySql versions 8.2 and higher" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin" </span></pre></div> <a id="rhqtrunkmodulespluginsoraclesrcmainjavaorgrhqpluginsoracleOraclePluginLifecycleListenerjavafromrev3564rhqtrunkmodulespluginsoraclesrcmainjavaorgrhqpluginsoracleOraclePluginOverseerjava"></a> <div class="copfile"><h4>Copied: rhq/trunk/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OraclePluginLifecycleListener.java (from rev 3564, rhq/trunk/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OraclePluginOverseer.java) (0 => 3565)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OraclePluginLifecycleListener.java (rev 0) +++ rhq/trunk/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OraclePluginLifecycleListener.java 2009-03-31 05:47:44 UTC (rev 3565) </span><span class="lines">@@ -0,0 +1,56 @@ </span><span class="add">+/* + * RHQ Management Platform + * Copyright (C) 2005-2008 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +package org.rhq.plugins.oracle; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.Enumeration; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.core.pluginapi.plugin.PluginContext; +import org.rhq.core.pluginapi.plugin.PluginLifecycleListener; +import org.rhq.core.util.exception.ThrowableUtil; + +public class OraclePluginLifecycleListener implements PluginLifecycleListener { + private final Log log = LogFactory.getLog(OraclePluginLifecycleListener.class); + + public void initialize(PluginContext context) throws Exception { + // no-op + } + + public void shutdown() { + // so we do not cause our classloader to leak perm gen, we need to de-register + // any and all JDBC drivers this plugin registered + Enumeration<Driver> drivers = DriverManager.getDrivers(); + while (drivers.hasMoreElements()) { + try { + Driver driver = drivers.nextElement(); + DriverManager.deregisterDriver(driver); + log.debug("Deregistered JDBC driver: " + driver.getClass()); + } catch (Exception e) { + log.warn("Failed to deregister JDBC drivers - memory might leak" + ThrowableUtil.getAllMessages(e)); + } + } + + log.debug(this.getClass().getSimpleName() + " completed shutdown."); + return; + } +} </span></pre></div> <a id="rhqtrunkmodulespluginsoraclesrcmainjavaorgrhqpluginsoracleOraclePluginOverseerjava"... [truncated message content] |