This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.hc.webconsole-1.1.0
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-webconsole.git

commit 94a819a50831f27de939a6ade071cc8982cc468d
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Jan 10 14:44:31 2014 +0000

    SLING-3278 : Provide a HealthCheckExecutor service. Change API to execute 
checks based on tags, add service reference to HealthCheckMetadata
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck/webconsole@1557138
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/HealthCheckWebconsolePlugin.java          | 55 +++++++---------------
 1 file changed, 16 insertions(+), 39 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
 
b/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
index 48f48ee..e8dd07e 100644
--- 
a/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
+++ 
b/src/main/java/org/apache/sling/hc/webconsole/impl/HealthCheckWebconsolePlugin.java
@@ -29,9 +29,7 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
@@ -41,9 +39,6 @@ import org.apache.sling.hc.api.Result;
 import org.apache.sling.hc.api.ResultLog;
 import org.apache.sling.hc.api.execution.HealthCheckExecutionResult;
 import org.apache.sling.hc.api.execution.HealthCheckExecutor;
-import org.apache.sling.hc.util.HealthCheckFilter;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 
 /** Webconsole plugin to execute health check services */
 @Component
@@ -68,18 +63,6 @@ public class HealthCheckWebconsolePlugin extends HttpServlet 
{
     @Reference
     private HealthCheckExecutor healthCheckExecutor;
 
-    private BundleContext bundleContext;
-
-    @Activate
-    protected void activate(final BundleContext bc) {
-        this.bundleContext = bc;
-    }
-
-    @Deactivate
-    protected void deactivate() {
-        this.bundleContext = null;
-    }
-
     /** Serve static resource if applicable, and return true in that case */
     private boolean getStaticResource(final HttpServletRequest req, final 
HttpServletResponse resp)
    throws ServletException, IOException {
@@ -126,32 +109,26 @@ public class HealthCheckWebconsolePlugin extends 
HttpServlet {
 
         // Execute health checks only if tags are specified (even if empty)
         if (tags != null) {
-            final HealthCheckFilter filter = new 
HealthCheckFilter(this.bundleContext);
-            try {
-                final ServiceReference[] refs = 
filter.getTaggedHealthCheckServiceReferences(tags.split(","));
-                Collection<HealthCheckExecutionResult> results = 
healthCheckExecutor.execute(refs);
+            Collection<HealthCheckExecutionResult> results = 
healthCheckExecutor.execute(tags.split(","));
 
-                pw.println("<table class='content healthcheck' cellpadding='0' 
cellspacing='0' width='100%'>");
-                int total = 0;
-                int failed = 0;
-                for (final HealthCheckExecutionResult exR : results) {
-
-                    final Result r = exR.getHealthCheckResult();
-                    total++;
-                    if (!r.isOk()) {
-                        failed++;
-                    }
-                    if (!quiet || !r.isOk()) {
-                        renderResult(pw, exR, debug);
-                    }
+            pw.println("<table class='content healthcheck' cellpadding='0' 
cellspacing='0' width='100%'>");
+            int total = 0;
+            int failed = 0;
+            for (final HealthCheckExecutionResult exR : results) {
 
+                final Result r = exR.getHealthCheckResult();
+                total++;
+                if (!r.isOk()) {
+                    failed++;
                 }
-                final WebConsoleHelper c = new 
WebConsoleHelper(resp.getWriter());
-                c.titleHtml("Summary", total + " HealthCheck executed, " + 
failed + " failures");
-                pw.println("</table>");
-            } finally {
-                filter.dispose();
+                if (!quiet || !r.isOk()) {
+                    renderResult(pw, exR, debug);
+                }
+
             }
+            final WebConsoleHelper c = new WebConsoleHelper(resp.getWriter());
+            c.titleHtml("Summary", total + " HealthCheck executed, " + failed 
+ " failures");
+            pw.println("</table>");
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to