int wildDescrIndex = -1;
Name name = null;
int nNameTokens = 0;
//if there is no such instance - next statement will throw runtime exception
InstanceEnvironment instanceEnvironment= new InstanceEnvironment(instanceName);
//First: add "static" continuations
try
{
name = new Name(dottedName);
nNameTokens = name.getNumParts();
}
catch (Exception e)
{
sLogger.log(Level.FINE, MSG_MALFORMED_DOTTED_NAME, e);
return new String[0];
}
for(int i=0; i<m_mbeanDescr.length; i++) //enumerate all descriptors
{
Object[][] tokens = m_mbeanDescr[i].getDottedTokens();
if(tokens!=null)
{
for(int j=0; j<tokens.length; j++) //enum different dotted patterns presentations
{
if(MBeanNamingDescriptor.isDottedPatternMatch(name, tokens[j], false) && tokens[j].length>nNameTokens)
{
//dotted pattern beginning matches to sample
if(!(tokens[j][nNameTokens] instanceof String)) //wildcard?
{
if(tokens[j].length==nNameTokens+1) //only if wildcard at the end; otherwise - ignore
wildDescrIndex = i;
}
else
{
hs.add(dottedName+"."+tokens[j][nNameTokens]);
}
}
}
}
}
//Now try to add childrens names
String xpath = null;
if(wildDescrIndex>=0)
{
try
{
ConfigMBeanNamingInfo info = new ConfigMBeanNamingInfo(dottedName + ".fake");
xpath = info.getXPath();
}
catch (Exception e)
{
sLogger.log(Level.FINE, MSG_EXCEPTION_DURING_LIST_NAMES, e);
}
}
if(xpath!=null)
{
String attributeName = null;
String elementName= null;
// seek for elemname[@attrname=]
xpath = xpath.trim();
if(xpath.length()>0 && xpath.endsWith("]"))
{
int i = xpath.lastIndexOf('@') + 1;
int j = xpath.indexOf('=',i) ;
if(i>0 && j>i)
{
attributeName = xpath.substring(i,j).trim();
j = xpath.lastIndexOf('[');
if(j>0 && j<i)
{
xpath = xpath.substring(0,j);
j = xpath.lastIndexOf('/');
if(j>0 && j<xpath.length()-2)
{
elementName = xpath.substring(j+1).trim();
xpath = xpath.substring(0,j);
}
}
}
}
if(attributeName!=null && elementName!=null) //is parsed successfully
{
//here we are to call ConfiBeans methods
ConfigContext configContext;
try
{
String fileUrl = instanceEnvironment.getConfigFilePath();
configContext = ConfigFactory.createConfigContext(fileUrl);
ConfigBean bean = ConfigBeansFactory.getConfigBeanByXPath(configContext, xpath);
ConfigBean[] childs = bean.getChildBeansByName(elementName);
for(int i=0; i<childs.length; i++)
{