/**
 * @license
 * Copyright 2017 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.nanos.http;

import foam.core.*;
import foam.dao.DAO;
import foam.dao.AbstractSink;
import foam.nanos.boot.NSpec;
import java.io.PrintWriter;

public class ServicesWebAgent
  implements WebAgent
{
  public ServicesWebAgent() {}

  public void execute(X x) {
    final PrintWriter out  = (PrintWriter) x.get(PrintWriter.class);
          DAO         dao  = (DAO)         x.get("nSpecDAO");

    out.println("<pre>");
    dao.orderBy(NSpec.NAME).select(new AbstractSink() {
      public void put(FObject o, Detachable d) {
        NSpec s = (NSpec) o;
        out.println(s.getName() + (s.getServe() ? " (S)" : ""));
      }
    });
    out.println("</pre>");
  }
}

@@ -415,16 +415,17 @@
 er out  
+ 
 = (Print
@@ -485,16 +485,17 @@
    dao  
+ 
 = (DAO) 
@@ -520,16 +520,56 @@
 ecDAO%22);
+%0A    final int%5B%5D       count = %7B 0, 0 %7D;
 %0A%0A    ou
@@ -797,15 +797,160 @@
     
-%7D%0A    %7D
+  if ( s.getServe() ) count%5B1%5D++;%0A        count%5B0%5D++;%0A      %7D%0A    %7D);%0A    out.println();%0A    out.println(count%5B0%5D + %22 services, %22 + count%5B1%5D + %22 served%22
 );%0A 

Add service counts to ServicesWebAgent.