[Mc4j-cvs] mc4j/src/org/mc4j/console/dashboard/match MatchExecutor.java,1.1,1.2
Brought to you by:
ghinkl
From: Greg H. <gh...@us...> - 2004-04-08 20:43:54
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/match In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5745/src/org/mc4j/console/dashboard/match Modified Files: MatchExecutor.java Log Message: Allow for the name of dashboard to be context looked up base on context attributes. Added the object name properties as content entries. Index: MatchExecutor.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/match/MatchExecutor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MatchExecutor.java 7 Apr 2004 02:52:33 -0000 1.1 --- MatchExecutor.java 8 Apr 2004 20:30:43 -0000 1.2 *************** *** 19,29 **** package org.mc4j.console.dashboard.match; - import java.util.List; - import java.util.Iterator; import java.util.ArrayList; - import org.mc4j.console.dashboard.Dashboard; import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.connection.ConnectionNode; /** --- 19,32 ---- package org.mc4j.console.dashboard.match; import java.util.ArrayList; + import java.util.Hashtable; + import java.util.Iterator; + import java.util.List; + import java.util.Map; import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.connection.ConnectionNode; + import org.mc4j.console.dashboard.Dashboard; + import org.mc4j.console.dashboard.context.ContextHelper; /** *************** *** 61,64 **** --- 64,89 ---- if (beanConditionListMatch(conditionList, mBeanNode)) { dashboard.putContext(beanMatch.getId(), mBeanNode); + + // For single types, experimenting with placing their object name attributes in context + Hashtable objectNameProps = mBeanNode.getObjectName().getKeyPropertyList(); + for(Iterator iterator2 = objectNameProps.entrySet().iterator(); iterator2.hasNext(); ) { + Map.Entry entry = (Map.Entry) iterator2.next(); + + String key = (String)entry.getKey(); + String value = (String)entry.getValue(); + dashboard.putContext(key, value); + } + + String currentName = dashboard.getName(); + String newName = null; + try { + newName = (String) ContextHelper.getValue(currentName,dashboard.getContextStarter()); + } catch (Exception e) { + // This is ok, just assume its not a context lookup + } + if (newName != null) { + dashboard.setDisplayName(newName); + } + return true; } *************** *** 111,114 **** --- 136,149 ---- dashboard.putContext(beanMatch.getId(), mBeanNode); beanMatched = true; + // For single types, experimenting with placing their object name attributes in context + Hashtable objectNameProps = mBeanNode.getObjectName().getKeyPropertyList(); + for(Iterator iterator2 = objectNameProps.entrySet().iterator(); iterator2.hasNext(); ) { + Map.Entry entry = (Map.Entry) iterator2.next(); + + String key = (String)entry.getKey(); + String value = (String)entry.getValue(); + dashboard.putContext(key, value); + } + } } |