|
From: <jt...@hy...> - 2007-03-27 23:42:48
|
Author: jtravis Date: 2007-03-27 15:42:45 -0800 (Tue, 27 Mar 2007) New Revision: 3932 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3932 Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/LiveDataHelper.groovy Log: Use categories, and simplify APIs so that we only deal with entity IDs and not resource value objects Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/LiveDataHelper.groovy =================================================================== --- trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/LiveDataHelper.groovy 2007-03-27 23:42:18 UTC (rev 3931) +++ trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/LiveDataHelper.groovy 2007-03-27 23:42:45 UTC (rev 3932) @@ -2,7 +2,6 @@ import org.hyperic.hq.product.PluginNotFoundException import org.hyperic.hq.appdef.shared.AppdefEntityID -import org.hyperic.hq.appdef.shared.AppdefResourceValue import org.hyperic.util.config.ConfigResponse import org.hyperic.hq.livedata.server.session.LiveDataManagerEJBImpl import org.hyperic.hq.livedata.shared.LiveDataResult @@ -17,10 +16,6 @@ private getDataMan() { LiveDataManagerEJBImpl.one } - String[] getCommands(AppdefResourceValue resource) { - dataMan.getCommands(userVal, resource.entityId) - } - String[] getCommands(AppdefEntityID id) { dataMan.getCommands(userVal, id) } @@ -29,19 +24,21 @@ dataMan.getData(userVal, commands) } - LiveDataResult getData(LiveDataCommand command) - { + LiveDataResult getData(AppdefEntityID ent, String command, config) { + def cmd = [ent, command, config as ConfigResponse] as LiveDataCommand + dataMan.getData(userVal, cmd) + } + + LiveDataResult getData(LiveDataCommand command) { dataMan.getData(userVal, command) } /** * Check if a resource supports a command. - * XXX: Would be cool if we could just attach this functionality directly - * to the entity ID or the resource via categories or metaclasses! */ boolean resourceSupports(AppdefEntityID id, String command) { try { - return (dataMan.getCommands(userVal, id) as List).contains(command) + return (id.liveDataCommands as List).contains(command) } catch(PluginNotFoundException e) { return false } |