Support iterating through all elements of a DynamicMap

Expose the plugin name, export name and the Provider on each element
entry. This makes it easier for callers to filter members.

Change-Id: I47f65bf38b8395e776e7fb9283909dc5a5e5e224
This commit is contained in:
Shawn Pearce
2013-05-10 13:00:44 -07:00
parent 82e66ee4e5
commit 878b5a5544
4 changed files with 61 additions and 22 deletions

View File

@@ -21,6 +21,7 @@ import com.google.gerrit.common.Version;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.server.cache.h2.H2CacheImpl;
import com.google.gerrit.server.config.SitePath;
import com.google.gerrit.server.git.WorkQueue;
@@ -208,13 +209,10 @@ final class ShowCaches extends CacheCommand {
private Map<String, Cache<?, ?>> sortedPluginCaches() {
SortedMap<String, Cache<?, ?>> m = Maps.newTreeMap();
for (String plugin : cacheMap.plugins()) {
if ("gerrit".equals(plugin)) {
continue;
}
for (Map.Entry<String, Provider<Cache<?, ?>>> entry :
cacheMap.byPlugin(plugin).entrySet()) {
m.put(cacheNameOf(plugin, entry.getKey()), entry.getValue().get());
for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) {
if (!"gerrit".equals(e.getPluginName())) {
m.put(cacheNameOf(e.getPluginName(), e.getExportName()),
e.getProvider().get());
}
}
return m;