Author: rmorgan Date: 2007-03-22 15:50:12 -0800 (Thu, 22 Mar 2007) New Revision: 3827 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3827 Modified: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShellEntityFetcher.java trunk/src/org/hyperic/hq/bizapp/server/session/LiveDataBossEJBImpl.java trunk/src/org/hyperic/hq/livedata/agent/commands/LiveData_args.java trunk/src/org/hyperic/hq/livedata/agent/server/LiveDataCommandsServer.java trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java trunk/src/org/hyperic/hq/product/LiveDataPluginManager.java Log: Cleanup LiveData plugin loading. Modified: trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShellEntityFetcher.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShellEntityFetcher.java 2007-03-22 23:11:24 UTC (rev 3826) +++ trunk/src/org/hyperic/hq/bizapp/client/shell/ClientShellEntityFetcher.java 2007-03-22 23:50:12 UTC (rev 3827) @@ -1176,6 +1176,7 @@ public String[] getLiveDataCommands(AppdefEntityID id) throws RemoteException, NamingException, ClientShellAuthenticationException, PluginException, + PermissionException, SessionTimeoutException, SessionNotFoundException { LiveDataBoss boss; Modified: trunk/src/org/hyperic/hq/bizapp/server/session/LiveDataBossEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/bizapp/server/session/LiveDataBossEJBImpl.java 2007-03-22 23:11:24 UTC (rev 3826) +++ trunk/src/org/hyperic/hq/bizapp/server/session/LiveDataBossEJBImpl.java 2007-03-22 23:50:12 UTC (rev 3827) @@ -97,7 +97,7 @@ * @ejb:interface-method */ public String[] getLiveDataCommands(int sessionId, AppdefEntityID id) - throws PluginException, + throws PluginException, PermissionException, SessionTimeoutException, SessionNotFoundException { AuthzSubjectValue subject = _manager.getSubject(sessionId); Modified: trunk/src/org/hyperic/hq/livedata/agent/commands/LiveData_args.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/agent/commands/LiveData_args.java 2007-03-22 23:11:24 UTC (rev 3826) +++ trunk/src/org/hyperic/hq/livedata/agent/commands/LiveData_args.java 2007-03-22 23:50:12 UTC (rev 3827) @@ -33,7 +33,7 @@ public class LiveData_args extends AgentRemoteValue { - private static final String PARAM_PLUGIN = "plugin"; + private static final String PARAM_TYPE = "type"; private static final String PARAM_COMMAND = "command"; private static final String PARAM_CONFIG = "config"; @@ -44,7 +44,7 @@ public LiveData_args(AgentRemoteValue val) throws AgentRemoteException { - String type = val.getValue(PARAM_PLUGIN); + String type = val.getValue(PARAM_TYPE); String command = val.getValue(PARAM_COMMAND); String configStr = val.getValue(PARAM_CONFIG); @@ -74,13 +74,13 @@ e.getMessage()); } - super.setValue(PARAM_PLUGIN, type); + super.setValue(PARAM_TYPE, type); super.setValue(PARAM_COMMAND, command); super.setValue(PARAM_CONFIG, configStr); } - public String getPlugin() { - return getValue(PARAM_PLUGIN); + public String getType() { + return getValue(PARAM_TYPE); } public String getCommand() { Modified: trunk/src/org/hyperic/hq/livedata/agent/server/LiveDataCommandsServer.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/agent/server/LiveDataCommandsServer.java 2007-03-22 23:11:24 UTC (rev 3826) +++ trunk/src/org/hyperic/hq/livedata/agent/server/LiveDataCommandsServer.java 2007-03-22 23:50:12 UTC (rev 3827) @@ -88,10 +88,11 @@ public LiveData_result cmdGetData(LiveData_args args) throws AgentRemoteException { - _log.info("Asked to invoke cmdGetData for " + args.getPlugin()); + _log.info("Asked to invoke cmdGetData for " + args.getType()); try { - JSONArray o = _manager.getData(args.getPlugin(), args.getCommand(), + JSONArray o = _manager.getData(args.getType(), + args.getCommand(), args.getConfig()); LiveData_result res = new LiveData_result(); res.setResult(o.toString()); Modified: trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java 2007-03-22 23:11:24 UTC (rev 3826) +++ trunk/src/org/hyperic/hq/livedata/server/session/LiveDataManagerEJBImpl.java 2007-03-22 23:50:12 UTC (rev 3827) @@ -38,6 +38,8 @@ import org.hyperic.hq.appdef.shared.AgentNotFoundException; import org.hyperic.hq.appdef.shared.AppdefEntityNotFoundException; import org.hyperic.hq.appdef.shared.ConfigManagerLocal; +import org.hyperic.hq.appdef.shared.AppdefEntityValue; +import org.hyperic.hq.appdef.shared.AppdefResourceTypeValue; import org.hyperic.hq.appdef.server.session.ConfigManagerEJBImpl; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.authz.shared.AuthzSubjectValue; @@ -91,14 +93,6 @@ public void ejbRemove() {} public void setSessionContext(SessionContext ctx) {} - private String getPluginName(AppdefEntityID id) - throws AppdefEntityNotFoundException - { - ConfigManagerLocal cManager = ConfigManagerEJBImpl.getOne(); - // XXX: Seems this method should not be in the config manager. - return cManager.getPluginName(id); - } - /** * Live data subsystem uses measurement configs. */ @@ -130,11 +124,13 @@ { LiveDataClient client = new LiveDataClient(AgentConnectionUtil.getClient(id)); - String plugin = getPluginName(id); ConfigResponse config = getMeasurementConfig(subject, id); - return client.getData(plugin, command, config); + AppdefEntityValue val = new AppdefEntityValue(id, subject); + AppdefResourceTypeValue tVal = val.getResourceTypeValue(); + + return client.getData(tVal.getName(), command, config); } /** @@ -143,11 +139,13 @@ * @ejb:interface-method */ public String[] getCommands(AuthzSubjectValue subject, AppdefEntityID id) - throws PluginException + throws PluginException, PermissionException { try { - String plugin = getPluginName(id); - return _manager.getCommands(plugin); + AppdefEntityValue val = new AppdefEntityValue(id, subject); + AppdefResourceTypeValue tVal = val.getResourceTypeValue(); + + return _manager.getCommands(tVal.getName()); } catch (AppdefEntityNotFoundException e) { throw new PluginNotFoundException("No plugin found for " + id, e); } Modified: trunk/src/org/hyperic/hq/product/LiveDataPluginManager.java =================================================================== --- trunk/src/org/hyperic/hq/product/LiveDataPluginManager.java 2007-03-22 23:11:24 UTC (rev 3826) +++ trunk/src/org/hyperic/hq/product/LiveDataPluginManager.java 2007-03-22 23:50:12 UTC (rev 3827) @@ -41,28 +41,16 @@ return ProductPlugin.TYPE_LIVE_DATA; } - private LiveDataPlugin getLiveDataPlugin(String plugin) - throws PluginException + private LiveDataPlugin getLiveDataPlugin(String type) + throws PluginNotFoundException { - ProductPluginManager mgr = (ProductPluginManager)getParent(); - ProductPlugin pp = mgr.getProductPlugin(plugin); - - //XXX: fix me, this only works for platforms. - LiveDataPlugin p = - (LiveDataPlugin)pp.getPlugin(ProductPlugin.TYPE_LIVE_DATA, - pp.getTypeInfo()); - if (p == null) { - throw new PluginException("Live data plugin for " + - pp.getTypeInfo() + " not found."); - } - return p; + return (LiveDataPlugin)getPlugin(type); } - public JSONArray getData(String plugin, String command, - ConfigResponse config) + public JSONArray getData(String type, String command, ConfigResponse config) throws PluginException { - LiveDataPlugin p = getLiveDataPlugin(plugin); + LiveDataPlugin p = getLiveDataPlugin(type); Object o = p.getData(command, config); try { @@ -72,10 +60,10 @@ } } - public String[] getCommands(String plugin) + public String[] getCommands(String type) throws PluginException { - LiveDataPlugin p = getLiveDataPlugin(plugin); + LiveDataPlugin p = getLiveDataPlugin(type); return p.getCommands(); } } |