/** * Construct a new property pattern * * @param pattern the object name that might be a pattern */ public PropertyPattern(ObjectName pattern) { isPropertyPattern = pattern.isPropertyPattern(); if (isPropertyPattern) { Hashtable patternKPList = pattern.getKeyPropertyList(); int length = patternKPList.size(); propertyKeys = new Object[length]; propertyValues = new Object[length]; int i = 0; for (Iterator iterator = patternKPList.entrySet().iterator(); iterator.hasNext(); i++) { Map.Entry entry = (Map.Entry) iterator.next(); propertyKeys[i] = entry.getKey(); propertyValues[i] = entry.getValue(); } } else canonicalKeyPropertyString = pattern.getCanonicalKeyPropertyListString(); }
/** * Takes the properties from the given Object Name and convert * special characters back * * @param pObjectName Given Object Name * * @return Hashtable with the back converted properties in it * and will contain a "*" as key if the given object * name is a property pattern for queries. **/ public static Hashtable getProperties( ObjectName pObjectName ) { Hashtable lReturn = reverseProperties( pObjectName.getKeyPropertyList() ); if( pObjectName.isPropertyPattern() ) { lReturn.put( "*", "*" ); } return lReturn; }
/** * Takes the properties from the given Object Name and convert * special characters back * * @param pObjectName Given Object Name * * @return String with the original Object Name String representation and * when a property pattern Object Name for queries it contains a ",*" * at the end. **/ public static String getString( ObjectName pObjectName ) { String lReturn = pObjectName.getDomain() + ":" + reverseString( pObjectName.getKeyPropertyList() ); if( pObjectName.isPropertyPattern() ) { lReturn = lReturn + ",*"; } return lReturn; }
if (name.isPropertyPattern())
/** * Constructs a <code>ObjectName</code> instance based upon a * <code>javax.management.ObjectName</code> instance. * * @param objectName The JMX <code>ObjectName</code> instance to base this instance on. */ public ObjectName(javax.management.ObjectName objectName) { canonicalKeyPropertyListString = objectName.getCanonicalKeyPropertyListString(); canonicalName = objectName.getCanonicalName(); domain = objectName.getDomain(); keyPropertyList = objectName.getKeyPropertyList(); keyPropertyListString = objectName.getKeyPropertyListString(); pattern = objectName.isPattern(); propertyPattern = objectName.isPropertyPattern(); }
/** * Constructs a <code>ObjectName</code> instance based upon a * <code>javax.management.ObjectName</code> instance. * * @param objectName The JMX <code>ObjectName</code> instance to base this instance on. */ public ObjectName(javax.management.ObjectName objectName) { canonicalKeyPropertyListString = objectName.getCanonicalKeyPropertyListString(); canonicalName = objectName.getCanonicalName(); domain = objectName.getDomain(); keyPropertyList = objectName.getKeyPropertyList(); keyPropertyListString = objectName.getKeyPropertyListString(); pattern = objectName.isPattern(); propertyPattern = objectName.isPropertyPattern(); }
/** * Constructs a <code>ObjectName</code> instance based upon a * <code>javax.management.ObjectName</code> instance. * * @param objectName The JMX <code>ObjectName</code> instance to base this instance on. */ public ObjectName(javax.management.ObjectName objectName) { canonicalKeyPropertyListString = objectName.getCanonicalKeyPropertyListString(); canonicalName = objectName.getCanonicalName(); domain = objectName.getDomain(); keyPropertyList = objectName.getKeyPropertyList(); keyPropertyListString = objectName.getKeyPropertyListString(); pattern = objectName.isPattern(); propertyPattern = objectName.isPropertyPattern(); }
public static ObjectName removeProperty( final ObjectName objectName, final String key) { ObjectName nameWithoutKey = objectName; if (objectName.getKeyProperty(key) != null) { final String domain = objectName.getDomain(); final Hashtable<String, String> props = TypeCast.asHashtable(objectName.getKeyPropertyList()); props.remove(key); if (objectName.isPropertyPattern()) { nameWithoutKey = newObjectNamePattern(domain, nameWithoutKey.getKeyPropertyListString()); } else { try { nameWithoutKey = new ObjectName(domain, props); } catch (Exception e) { throw new RuntimeException(e); } } } return (nameWithoutKey); }
if( n0.isPropertyPattern() ) else if( n1.isPropertyPattern() )
return false; if (queryName.isPropertyPattern()) {
if (objectName.isPropertyPattern())
if (pattern.isPropertyPattern())
private AgentMonitorMBean[] createStringMonitors(String str) throws MalformedObjectNameException { String[] strTab = split(str, ";"); //System.out.println("- " + Arrays.asList(strTab)); MyStringMonitor[] gauges = new MyStringMonitor[strTab.length]; for (int i = 0; i < strTab.length; i++) { try { ObjectName oName = new ObjectName(strTab[i]); Hashtable h = oName.getKeyPropertyList(); gauges[i] = new MyStringMonitor((i + 1)); // set String monitor params gauges[i].setObservedAttribute((String) remove(h, "observedAttribute")); gauges[i].setGranularityPeriod(Long.parseLong((String) remove(h, "granularityPeriod"))); gauges[i].setStringToCompare((String) remove(h, "stringToCompare")); gauges[i].setNotifyDiffer(Boolean.valueOf((String) remove(h, "notifyDiffer")).booleanValue()); gauges[i].setNotifyMatch(Boolean.valueOf((String) remove(h, "notifyMatch")).booleanValue()); if (oName.isPropertyPattern()) gauges[i].setPattern(new ObjectName(oName.getDomain() + ":" + asString(h) + ",*")); else gauges[i].setPattern(new ObjectName(oName.getDomain(), h)); } catch (Exception e) { throw new IllegalStateException( "String monitor \"" + strTab[i] + "\" is invalid. " + e.toString() + ". " + CONST.STRING_SYNTAX); } } return gauges; }
counters[j].setOffset(Long.valueOf((String) remove(h, "offset"))); counters[j].setDifferenceMode(Boolean.valueOf((String) remove(h, "differenceMode")).booleanValue()); if (oName.isPropertyPattern()) counters[j].setPattern(new ObjectName(oName.getDomain() + ":" + asString(h) + ",*")); else
Double.valueOf((String) remove(h, "lowThreshold"))); gauges[j].setDifferenceMode(Boolean.valueOf((String) remove(h, "differenceMode")).booleanValue()); if (oName.isPropertyPattern()) gauges[j].setPattern(new ObjectName(oName.getDomain() + ":" + asString(h) + ",*")); else