|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.rhq.plugins.jmx.ObjectNameQueryUtility
public class ObjectNameQueryUtility
A utility class to help in querying object names and utilizing parts of the object name for setting configuration values and changing string messages. A template that you'd build this utility with could look like "foo:name=%myName%,type=myType". This will be "translated" into a valid JMX objectName Query of the form "foo:type=myType,*". It will also detect that we've got a variable defined as "myName" that we'd like to later match to.
We can then find beans with the query and apply their objectName properties to the object and use those found values to rewrite strings or setup configuration properities. For example, we've got a detected object name for the above template "foo:name=bar,type=myType". We set its detected keys against this utility and we now have a variable defined as the key "myName" and the value of "bar". Then I can call formatMessage with "A foo called {myName}" which will be translated into "A foo called bar". This can be useful for naming resources and descriptions using parts of a mapped ObjectName.
| Constructor Summary | |
|---|---|
ObjectNameQueryUtility(String objectNameQueryTemplate)
Builds a mapped query utility object and finds the variables in the supplied object name query template. |
|
ObjectNameQueryUtility(String objectNameQueryTemplate,
Configuration parentConfiguration)
Builds a mapped query utility object and finds the variables in the supplied object name query template. |
|
| Method Summary | |
|---|---|
String |
formatMessage(String message)
Format a message with { |
String |
getQueryTemplate()
|
String |
getTranslatedQuery()
|
Map<String,String> |
getVariableProperties()
|
Map<String,String> |
getVariableValues()
|
boolean |
isContainsExtraKeyProperties(Set<String> strings)
|
void |
resetVariables()
Clears out variables so that a new found bean can be used against the same utility object again. |
boolean |
setMatchedKeyValues(Map<String,String> keyProperties)
Set values for properties from an objectName. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectNameQueryUtility(String objectNameQueryTemplate)
objectNameQueryTemplate - string of form "a:b=%c%,d=e,f=%g%"
public ObjectNameQueryUtility(String objectNameQueryTemplate,
Configuration parentConfiguration)
objectNameQueryTemplate - string of form "a:b=%c%,d=e,f=%g%,h={myParentsH}"parentConfiguration - the config holding the matched values for the object name key property variables| Method Detail |
|---|
public boolean setMatchedKeyValues(Map<String,String> keyProperties)
keyProperties - properties from the found objectName to apply
public String formatMessage(String message)
message - the message to format
public void resetVariables()
public String getQueryTemplate()
public Map<String,String> getVariableProperties()
public Map<String,String> getVariableValues()
public String getTranslatedQuery()
public boolean isContainsExtraKeyProperties(Set<String> strings)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||