Author: sshafroi
Date: 2008-08-25 15:59:12 +0200 (Mon, 25 Aug 2008)
New Revision: 6790
Modified:
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java
Log:
cleanup tabs interpreter function (for debuging)
Modified:
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java
===================================================================
---
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java
2008-08-25 13:54:06 UTC (rev 6789)
+++
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java
2008-08-25 13:59:12 UTC (rev 6790)
@@ -121,7 +121,6 @@
} catch (ParserConfigurationException ex) {
LOG.error(ERR_DOC_BUILDER_CREATION,ex);
}
- instance.addInterpreterFunctions();
}
return instance;
}
@@ -604,20 +603,31 @@
}
}
- private void addInterpreterFunctions() {
+ static {
Interpreter.addFunction("tabs", new Interpreter.Function() {
public String execute(Interpreter.Context ctx) {
String res = "";
- for (String s : tabsByKey.keySet()) {
- res += "View: " + s + "\n";
- res += tabsByKey.get(s).toString();
- res += "\n";
+ try{
+ INSTANCES_LOCK.readLock().lock();
+ for(Site site : INSTANCES.keySet()) {
+ res += "Site: " + site.getName() + "\n";
+ SearchTabFactory factory = INSTANCES.get(site);
+ for (String s : factory.tabsByKey.keySet()) {
+ res += " View: " + s + "\n";
+ res += " " +
factory.tabsByKey.get(s).toString();
+ res += "\n";
+ }
+ res += "\n";
+ }
+
+ }finally{
+ INSTANCES_LOCK.readLock().unlock();
}
return res;
+ }
- }
public String describe() {
- return "Print out the tabs in tabsByKey.";
+ return "Print out the tabs in tabsByKey for each site.";
}
});
}
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits