Methods Summary |
---|
public static java.lang.String | XPATH_TO_MASK(java.lang.String xpath)
if(xpath==null || xpath.length()==0)
return xpath;
char[] chrs = xpath.toCharArray();
char[] newchrs = new char[chrs.length*2];
int j = 0;
for(int i=0; i<chrs.length; i++)
{
newchrs[j++] = chrs[i];
if(chrs[i]=='\'")
newchrs[j++] = '\'";
}
return String.valueOf(newchrs, 0, j);
|
private void | checkConsistency()
|
public java.lang.String[] | createDottedNames(java.lang.Object[] params)
if(m_dottedPatterns==null || m_dottedPatterns.length<1)
return null;
String[] names = new String[m_dottedPatterns.length];
for(int i=0; i<m_dottedPatterns.length;i++)
names[i] = formatPattern(m_dottedPatterns[i], params);
return names;
|
public javax.management.ObjectName | createObjectName(java.lang.Object[] params)
return new ObjectName(formatPattern(m_objectPattern, params));
|
public java.lang.String | createXPath(java.lang.Object[] params)
return formatPattern(m_xpathPattern, params);
|
public java.lang.String[] | extractParmList(javax.management.ObjectName objectName)
if(m_objectTokens==null)
return null;
Hashtable ht = objectName.getKeyPropertyList();
ht.put(":",objectName.getDomain()); //add domain name pseudo pair
String[] parmList = new String[m_parmListSize];
for(int i=0; i<m_objectTokens.length; i=i+2)
{
if( m_objectTokens[i+1] instanceof Integer )
{
parmList[((Integer)m_objectTokens[i+1]).intValue()] = (String)ht.get(m_objectTokens[i]);
}
}
return parmList;
|
java.lang.String[] | extractParmList(java.lang.String dottedName)
if(m_dottedTokens==null)
return null;
Name name = new Name(dottedName);
Object[] tokens = findDottedPatternTokens(name);
if(tokens == null)
return null;
int nTokens = name.getNumParts();
if(name.getNumParts()!=tokens.length)
return null;
String[] parmList = new String[m_parmListSize];
for(int i=0; i<nTokens; i++)
{
if( tokens[i] instanceof Integer )
{
parmList[((Integer)tokens[i]).intValue()] = name.getNamePart(i).toString();
}
}
return parmList;
|
public java.lang.String[] | extractParmListFromXPath(java.lang.String xpath)
Object[] tokens = MBeanNamingDescriptor.getXPathTokens(xpath);
if(m_xpathTokens==null || tokens==null || m_parmListSize<=0)
return null;
if(m_xpathTokens.length!= tokens.length)
return null;
String[] parmList = new String[m_parmListSize];
for(int i=0; i<tokens.length; i++)
{
if(m_xpathTokens[i] instanceof Integer)
{
parmList[((Integer)m_xpathTokens[i]).intValue()] = (String)tokens[i];
}
}
return parmList;
|
private java.lang.Object[] | findDottedPatternTokens(Name name)
if(m_dottedTokens!=null)
{
for(int i=0; i<m_dottedTokens.length; i++)
{
if(isDottedPatternMatch(name, m_dottedTokens[i], true))
return m_dottedTokens[i];
}
}
return null;
|
private java.lang.String | formatPattern(java.lang.String pattern, java.lang.Object[] params)
if(pattern==null)
return null;
return MessageFormat.format(pattern, params);
|
private java.lang.Object[] | getDottedNamePatternTokens(java.lang.String dottedPattern)
ArrayList list = new ArrayList();
int idx = 0, idx2 = 0;
if(dottedPattern!=null)
{
while(idx<dottedPattern.length() && (idx2=dottedPattern.indexOf('.", idx))>=0)
{
if(idx == idx2)
list.add("");
else
list.add(dottedPattern.substring(idx,idx2).trim());
idx = idx2+1;
}
if(idx<dottedPattern.length())
list.add(dottedPattern.substring(idx).trim());
Object[] tokens = list.toArray();
replacePlaceholdersToIntegers(tokens);
return tokens;
}
return null;
|
public java.lang.String[] | getDottedPatterns()
return m_dottedPatterns;
|
public java.lang.Object[][] | getDottedTokens()
return m_dottedTokens;
|
private static java.lang.Integer | getIndexForPlaceholder(java.lang.String str)
int len = str.length();
if(len<3 || str.charAt(0)!='{" || str.charAt(len-1)!='}")
return null;
try
{
return Integer.valueOf(str.substring(1,len-1));
}
catch(Throwable e)
{
}
return null;
|
public java.lang.String | getMBeanClassName()
return m_className;
|
private int | getMaxTokenIndex(java.lang.Object[] tokens)
int res = -1;
int current;
for(int i=0; i<tokens.length; i++)
{
if(tokens[i] instanceof Integer &&
res < (current=((Integer)tokens[i]).intValue()))
res = current;
}
return res;
|
public int | getMode()
return m_mode;
|
private java.lang.Object[] | getObjectNamePatternTokens(java.lang.String objectPattern)
if(objectPattern!=null)
{
ObjectName objName = new ObjectName(objectPattern);
Hashtable ht = objName.getKeyPropertyList();
ht.put(":",objName.getDomain()); //add domain name pseudo pair
Enumeration ee = ht.keys();
Object[] tokens = new Object[ht.size()*2];
int i = 0;
while(ee.hasMoreElements())
{
String key = ((String)ee.nextElement());
tokens[i++] = key; //key.trim(); jmx allows to have spaces in keys and values
tokens[i++] = ht.get(key);
}
replacePlaceholdersToIntegers(tokens);
return tokens;
}
return null;
|
public int | getParmListSize()
return m_parmListSize;
|
public java.lang.String | getType()
return m_type;
|
public java.lang.String | getXPathPattern()
return m_xpathPattern;
|
public static java.lang.Object[] | getXPathTokens(java.lang.String xpathPattern)
ArrayList list = new ArrayList();
int idx = 0, idx2 = 0;
if(xpathPattern!=null)
{
while(idx<xpathPattern.length() && (idx2=xpathPattern.indexOf("'", idx))>=0)
{
if(idx != idx2)
list.add(xpathPattern.substring(idx,idx2));
idx = idx2+1;
}
if(idx<xpathPattern.length())
list.add(xpathPattern.substring(idx).trim());
Object[] tokens = list.toArray();
replacePlaceholdersToIntegers(tokens);
return tokens;
}
return null;
|
private static boolean | isDottedPatternMatch(Name name, java.lang.Object[] tokens, boolean bExactMatch)
if(tokens==null)
return false;
int nTokens = name.getNumParts();
if(bExactMatch)
{
if(nTokens!=tokens.length)
return false;
}
else
{
if(nTokens>tokens.length)
return false;
}
for(int i=0; i<nTokens; i++)
{
if( (tokens[i] instanceof String) &&
!name.getNamePart(i).toString().equals((String)tokens[i]))
return false;
}
return true;
|
public boolean | isDottedPatternMatch(Name name)
if(findDottedPatternTokens(name)!=null)
return true;
return false;
|
public boolean | isObjectNamePatternMatch(javax.management.ObjectName objectName)
Hashtable ht = objectName.getKeyPropertyList();
ht.put(":",objectName.getDomain()); //add domain name pseudo pair
return isObjectNamePatternMatch(ht);
|
public boolean | isObjectNamePatternMatch(java.util.Hashtable sample)
if(m_objectTokens.length!=(sample.size()*2))
return false;
for(int i=0; i<m_objectTokens.length; i = i+2)
{
String sampleVal = (String)sample.get(m_objectTokens[i]);
if(sampleVal==null ||
((m_objectTokens[i+1] instanceof String) && !sampleVal.equals((String)m_objectTokens[i+1])) )
return false;
}
return (true);
|
public boolean | isXpathTokensMatch(java.lang.Object[] tokens)
if(m_xpathTokens==null || tokens==null)
return false;
if(m_xpathTokens.length!= tokens.length)
return false;
for(int i=0; i<tokens.length; i++)
{
if( (m_xpathTokens[i] instanceof String) &&
!m_xpathTokens[i].equals(tokens[i]))
return false;
}
return true;
|
private static void | replacePlaceholdersToIntegers(java.lang.Object[] tokens)
for(int i=0; i<tokens.length; i++)
{
Object idx = getIndexForPlaceholder((String)tokens[i]);
if(idx!=null)
tokens[i] = idx;
}
|
private java.lang.String[] | splitDottedPatternsString(java.lang.String names)
if(names==null)
return null;
ArrayList list = new ArrayList();
int idx = 0, idx2 = 0;
while(idx<names.length() && (idx2=names.indexOf(MBeansNaming.PATTERNS_SEPARATOR, idx))>=0)
{
if(idx2!=idx)
list.add(names.substring(idx, idx2));
idx = idx2+1;
}
if(idx2<0)
list.add(names.substring(idx));
return (String[])list.toArray(new String[list.size()]);
|