From: <rm...@hy...> - 2008-11-12 21:40:43
|
Author: rmorgan Date: 2008-11-12 13:40:33 -0800 (Wed, 12 Nov 2008) New Revision: 11761 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=11761 Modified: trunk/src/org/hyperic/hq/hqu/rendit/RenditServer.java Log: Wrap HQU plugin loading within a session. [HHQ-2639] [merge from 3.2, 4.0] Modified: trunk/src/org/hyperic/hq/hqu/rendit/RenditServer.java =================================================================== --- trunk/src/org/hyperic/hq/hqu/rendit/RenditServer.java 2008-11-12 21:39:36 UTC (rev 11760) +++ trunk/src/org/hyperic/hq/hqu/rendit/RenditServer.java 2008-11-12 21:40:33 UTC (rev 11761) @@ -45,6 +45,8 @@ import org.hyperic.hq.hqu.server.session.UIPlugin; import org.hyperic.hq.hqu.server.session.UIPluginManagerEJBImpl; import org.hyperic.hq.hqu.shared.UIPluginManagerLocal; +import org.hyperic.hq.hibernate.SessionManager; +import org.hyperic.hq.hibernate.SessionManager.SessionRunner; import org.hyperic.util.Runnee; public class RenditServer { @@ -117,10 +119,36 @@ /** * Loads a plugin into the rendit system, verifying the version numbers, * etc. + * + * @param path Path to the plugin + */ + public PluginWrapper loadPlugin(final File path) + throws PluginLoadException + { + final PluginWrapper[] w = new PluginWrapper[1]; + try { + SessionManager.runInSession(new SessionRunner() { + public String getName() { + return "SessionMBeanBase"; + } + + public void run() throws Exception { + w[0] = loadPluginInternal(path); + } + }); + } catch (Exception e) { + throw new PluginLoadException(e.getMessage()); + } + return w[0]; + } + + /** + * Loads a plugin into the rendit system, verifying the version numbers, + * etc. * * @param path Path to the plugin */ - public PluginWrapper loadPlugin(final File path) + private PluginWrapper loadPluginInternal(final File path) throws PluginLoadException { final PluginWrapper plugin = new PluginWrapper(path, getSysDir(), |