SOLR-3330: add option to include the original 'ref' nodes

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1327775 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2012-04-19 01:46:16 +00:00
parent cd016ccf42
commit 86408dccf7
1 changed files with 16 additions and 3 deletions

View File

@ -87,7 +87,8 @@ public class SolrInfoMBeanHandler extends RequestHandlerBase {
cats = normalize(cats);
// Only the changes
rsp.add("solr-mbeans", getDiff(ref,cats));
boolean showAll = req.getParams().getBool("all", false);
rsp.add("solr-mbeans", getDiff(ref,cats, showAll));
}
else {
rsp.add("solr-mbeans", cats);
@ -162,7 +163,11 @@ public class SolrInfoMBeanHandler extends RequestHandlerBase {
return cats;
}
protected NamedList<NamedList<NamedList<Object>>> getDiff(NamedList<NamedList<NamedList<Object>>> ref, NamedList<NamedList<NamedList<Object>>> now) {
protected NamedList<NamedList<NamedList<Object>>> getDiff(
NamedList<NamedList<NamedList<Object>>> ref,
NamedList<NamedList<NamedList<Object>>> now,
boolean includeAll ) {
NamedList<NamedList<NamedList<Object>>> changed = new NamedList<NamedList<NamedList<Object>>>();
// Cycle through each category
@ -192,13 +197,21 @@ public class SolrInfoMBeanHandler extends RequestHandlerBase {
// System.out.println( "NOW: " + now_txt );
// Calculate the differences
cat.add(name, diffNamedList(ref_bean,now_bean));
NamedList diff = diffNamedList(ref_bean,now_bean);
diff.add( "_changed_", true ); // flag the changed thing
cat.add(name, diff);
}
else if(includeAll) {
cat.add(name, ref_bean);
}
}
if(cat.size()>0) {
changed.add(category, cat);
}
}
else if(includeAll) {
changed.add(category, ref_cat);
}
}
}
return changed;