Author: rmannibucau Date: Tue Jul 30 07:29:00 2013 New Revision: 1508328 URL: http://svn.apache.org/r1508328 Log: adding basic plugin API
Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HomeHandler.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/Plugin.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginDecoratorHandler.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXHandler.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXPlugin.java commons/sandbox/monitoring/trunk/reporting/src/main/resources/META-INF/services/ commons/sandbox/monitoring/trunk/reporting/src/main/resources/META-INF/services/org.apache.commons.monitoring.reporting.web.plugin.Plugin Modified: commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/configuration/Configuration.java commons/sandbox/monitoring/trunk/pom.xml commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/template/Templates.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringController.java commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HtmlHandler.java commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/home.vm commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/page.vm Modified: commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/configuration/Configuration.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/configuration/Configuration.java?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/configuration/Configuration.java (original) +++ commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/configuration/Configuration.java Tue Jul 30 07:29:00 2013 @@ -97,6 +97,10 @@ public final class Configuration { return Boolean.parseBoolean(getProperty(key.key, "false")); } + public static boolean is(final String key, final boolean defaultValue) { + return Boolean.parseBoolean(getProperty(key, Boolean.toString(defaultValue))); + } + public static String getProperty(final String key, final String defaultValue) { return PROPERTIES.getProperty(key, defaultValue); } Modified: commons/sandbox/monitoring/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/pom.xml?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/pom.xml (original) +++ commons/sandbox/monitoring/trunk/pom.xml Tue Jul 30 07:29:00 2013 @@ -81,6 +81,7 @@ <exclude>.gitignore</exclude> <exclude>**/webapp/resources/js/*.js</exclude> <exclude>**/webapp/resources/css/*.css</exclude> + <exclude>**/META-INF/services/*</exclude> </excludes> </configuration> <executions> Modified: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/template/Templates.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/template/Templates.java?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/template/Templates.java (original) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/template/Templates.java Tue Jul 30 07:29:00 2013 @@ -16,6 +16,7 @@ */ package org.apache.commons.monitoring.reporting.template; +import org.apache.commons.monitoring.reporting.web.plugin.PluginRepository; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; @@ -63,6 +64,10 @@ public final class Templates { context.put("base", base); context.put("mapping", mapping); context.put("currentTemplate", template); + context.put("plugins", PluginRepository.PLUGIN_INFO); + if (context.get("templateId") == null) { + context.put("templateId", template.replace(".vm", "")); + } final Template velocityTemplate = Velocity.getTemplate("/templates/page.vm", "UTF-8"); velocityTemplate.merge(context, writer); Modified: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringController.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringController.java?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringController.java (original) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringController.java Tue Jul 30 07:29:00 2013 @@ -21,10 +21,11 @@ import org.apache.commons.monitoring.rep import org.apache.commons.monitoring.reporting.web.handler.ClearHandler; import org.apache.commons.monitoring.reporting.web.handler.FilteringHandler; import org.apache.commons.monitoring.reporting.web.handler.Handler; -import org.apache.commons.monitoring.reporting.web.handler.HtmlHandler; +import org.apache.commons.monitoring.reporting.web.handler.HomeHandler; import org.apache.commons.monitoring.reporting.web.handler.Renderer; import org.apache.commons.monitoring.reporting.web.handler.ReportHandler; import org.apache.commons.monitoring.reporting.web.handler.ResetHandler; +import org.apache.commons.monitoring.reporting.web.plugin.PluginRepository; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -54,7 +55,8 @@ public class MonitoringController implem } private void initHandlers() { - defaultHandler = new HtmlHandler("home.vm"); + defaultHandler = new HomeHandler(); + handlers.put("/", defaultHandler); handlers.put("/home", defaultHandler); handlers.put("/report", new ReportHandler(Format.Defaults.HTML)); @@ -64,6 +66,12 @@ public class MonitoringController implem handlers.put("/clear", new ClearHandler()); handlers.put("/reset", new ResetHandler()); handlers.put("/resources/css/monitoring.css", FilteringHandler.INSTANCE); // filtered to get the right base for pictures + + for (final PluginRepository.PluginInfo plugin : PluginRepository.PLUGIN_INFO) { + if (plugin.getHandler() != null && plugin.getUrl() != null) { + handlers.put("/" + plugin.getUrl(), plugin.getHandler()); + } + } } private void initTemplates() { Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HomeHandler.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HomeHandler.java?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HomeHandler.java (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HomeHandler.java Tue Jul 30 07:29:00 2013 @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.monitoring.reporting.web.handler; + +import org.apache.commons.monitoring.reporting.template.Templates; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.Map; + +public class HomeHandler implements Handler { + private final HomeRenderer renderer; + + public HomeHandler() { + this.renderer = new HomeRenderer(); + } + + @Override + public Renderer handle(final HttpServletRequest request, final HttpServletResponse response) { + return renderer; + } + + protected static class HomeRenderer implements Renderer { + @Override + public void render(final PrintWriter writer, final Map<String, ?> params) { + Templates.htmlRender(writer, "home.vm", params); + } + } +} Modified: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HtmlHandler.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HtmlHandler.java?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HtmlHandler.java (original) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/handler/HtmlHandler.java Tue Jul 30 07:29:00 2013 @@ -43,7 +43,7 @@ public class HtmlHandler implements Hand } @Override - public void render(PrintWriter writer, Map<String, ?> params) { + public void render(final PrintWriter writer, final Map<String, ?> params) { Templates.htmlRender(writer, template, params); } } Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/Plugin.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/Plugin.java?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/Plugin.java (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/Plugin.java Tue Jul 30 07:29:00 2013 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.monitoring.reporting.web.plugin; + +import org.apache.commons.monitoring.reporting.web.handler.Handler; + +public interface Plugin { + /** + * @return plugin name. + */ + String name(); + + /** + * @return the handler to call when mappings() are matched. + */ + Class<? extends Handler> handler(); + + /** + * @return the mapping of the handler if not null. Note: it shouldn't start with '/'. + */ + String[] mappings(); +} Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginDecoratorHandler.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginDecoratorHandler.java?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginDecoratorHandler.java (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginDecoratorHandler.java Tue Jul 30 07:29:00 2013 @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.monitoring.reporting.web.plugin; + +import org.apache.commons.monitoring.reporting.web.handler.Handler; +import org.apache.commons.monitoring.reporting.web.handler.Renderer; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +public class PluginDecoratorHandler implements Handler { + private final Handler delegate; + private final String plugin; + + public PluginDecoratorHandler(final Handler handler, final String name) { + delegate = handler; + plugin = name; + } + + @Override + public Renderer handle(final HttpServletRequest request, final HttpServletResponse response) { + return new PluginDecoratorRenderer(delegate.handle(request, response), plugin); + } + + private static class PluginDecoratorRenderer implements Renderer { + private final Renderer delegate; + private final String plugin; + + public PluginDecoratorRenderer(final Renderer handle, final String name) { + delegate = handle; + plugin = name; + } + + @Override + public void render(final PrintWriter writer, final Map<String, ?> params) { + final Map<String, Object> map = new HashMap<String, Object>(); + if (params != null && !params.isEmpty()) { + map.putAll(params); + } + map.put("templateId", plugin); + + delegate.render(writer, map); + } + } +} Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/PluginRepository.java Tue Jul 30 07:29:00 2013 @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.monitoring.reporting.web.plugin; + +import org.apache.commons.monitoring.MonitoringException; +import org.apache.commons.monitoring.configuration.Configuration; +import org.apache.commons.monitoring.reporting.web.handler.Handler; + +import java.util.Collection; +import java.util.ServiceLoader; +import java.util.concurrent.CopyOnWriteArrayList; + +public class PluginRepository { + public static Collection<PluginInfo> PLUGIN_INFO = new CopyOnWriteArrayList<PluginInfo>(); + + static { + for (final Plugin plugin : ServiceLoader.load(Plugin.class, Plugin.class.getClassLoader())) { + final String name = plugin.name(); + if (name == null) { + throw new IllegalArgumentException("plugin name can't be null"); + } + if (!Configuration.is(name + ".activated", true)) { + continue; + } + + final String[] mappings = plugin.mappings(); + final Class<? extends Handler> handler = plugin.handler(); + if (mappings != null && handler != null) { + try { + final Handler handlerInstance = new PluginDecoratorHandler(handler.newInstance(), name); + for (final String mapping : mappings) { + PLUGIN_INFO.add(new PluginInfo(mapping, handlerInstance, name)); + } + } catch (final Exception e) { + throw new MonitoringException(e); + } + } + } + } + + public static class PluginInfo { + private final String url; + private final Handler handler; + private final String name; + + public PluginInfo(final String url, final Handler handler, final String name) { + this.url = url; + this.handler = handler; + this.name = name; + } + + public String getUrl() { + return url; + } + + public Handler getHandler() { + return handler; + } + + public String getName() { + return name; + } + } +} Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXHandler.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXHandler.java?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXHandler.java (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXHandler.java Tue Jul 30 07:29:00 2013 @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.monitoring.reporting.web.plugin.jmx; + +import org.apache.commons.monitoring.reporting.web.handler.Handler; +import org.apache.commons.monitoring.reporting.web.handler.Renderer; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.Map; + +public class JMXHandler implements Handler { + @Override + public Renderer handle(final HttpServletRequest request, final HttpServletResponse response) { + return new Renderer() { + @Override + public void render(final PrintWriter writer, final Map<String, ?> params) { + writer.write("TODO"); + } + }; + } +} Added: commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXPlugin.java URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXPlugin.java?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXPlugin.java (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/java/org/apache/commons/monitoring/reporting/web/plugin/jmx/JMXPlugin.java Tue Jul 30 07:29:00 2013 @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.monitoring.reporting.web.plugin.jmx; + +import org.apache.commons.monitoring.reporting.web.handler.Handler; +import org.apache.commons.monitoring.reporting.web.plugin.Plugin; + +public class JMXPlugin implements Plugin { + @Override + public String name() { + return "JMX"; + } + + @Override + public Class<? extends Handler> handler() { + return JMXHandler.class; + } + + @Override + public String[] mappings() { + return new String[] { "jmx" }; + } +} Added: commons/sandbox/monitoring/trunk/reporting/src/main/resources/META-INF/services/org.apache.commons.monitoring.reporting.web.plugin.Plugin URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/resources/META-INF/services/org.apache.commons.monitoring.reporting.web.plugin.Plugin?rev=1508328&view=auto ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/resources/META-INF/services/org.apache.commons.monitoring.reporting.web.plugin.Plugin (added) +++ commons/sandbox/monitoring/trunk/reporting/src/main/resources/META-INF/services/org.apache.commons.monitoring.reporting.web.plugin.Plugin Tue Jul 30 07:29:00 2013 @@ -0,0 +1 @@ +org.apache.commons.monitoring.reporting.web.plugin.jmx.JMXPlugin Modified: commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/home.vm URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/home.vm?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/home.vm (original) +++ commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/home.vm Tue Jul 30 07:29:00 2013 @@ -23,6 +23,9 @@ <div> <ul> <li><a href="$mapping/report">Report</a> (<a href="$mapping/report.xml">xml</a>, <a href="$mapping/report.json">json</a>, <a href="$mapping/report.csv">csv</a>)</li> + #foreach ( $plugin in $plugins ) + <li><a href="$mapping/$plugin.url">$plugin.name</a></li> + #end </ul> </div> </div> \ No newline at end of file Modified: commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/page.vm URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/page.vm?rev=1508328&r1=1508327&r2=1508328&view=diff ============================================================================== --- commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/page.vm (original) +++ commons/sandbox/monitoring/trunk/reporting/src/main/resources/templates/page.vm Tue Jul 30 07:29:00 2013 @@ -36,20 +36,29 @@ <a class="brand" href="http://commons.apache.org/sandbox/commons-monitoring/">Commons Monitoring</a> <div class="nav-collapse"> <ul class="nav"> - #if ( $currentTemplate == "home.vm") + #if ( $templateId == "home") <li class="active"> #else <li> #end <a href="$mapping/">Home</a> </li> - #if ( $currentTemplate == "report.vm") + #if ( $templateId == "report") <li class="active"> #else <li> #end <a href="$mapping/report">Report</a> </li> + #foreach ( $plugin in $plugins ) + #if ( $templateId == $plugin.name ) + <li class="active"> + #else + <li> + #end + <a href="$mapping/$plugin.url">$plugin.name</a> + </li> + #end </ul> <ul class="nav pull-right"> <li><a href="http://www.apache.org/">ASF</a></li>