package org.apache.jsp.service;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.RunningService;
import org.ofbiz.service.engine.GenericEngine;
import java.sql.Timestamp;
import org.ofbiz.security.*;
import org.ofbiz.entity.*;
import org.ofbiz.base.util.*;
import org.ofbiz.webapp.pseudotag.*;

public final class services_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/WEB-INF/ofbiz.tld");
  }

  private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_ofbiz_url;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _jspx_tagPool_ofbiz_url = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
  }

  public void _jspDestroy() {
    _jspx_tagPool_ofbiz_url.release();
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");
      response.addHeader("X-Powered-By", "JSP/2.0");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      org.ofbiz.security.Security security = null;
      synchronized (request) {
        security = (org.ofbiz.security.Security) _jspx_page_context.getAttribute("security", PageContext.REQUEST_SCOPE);
        if (security == null){
          throw new java.lang.InstantiationException("bean security not found within scope");
        }
      }
      out.write('\r');
      out.write('\n');
      org.ofbiz.service.LocalDispatcher dispatcher = null;
      synchronized (request) {
        dispatcher = (org.ofbiz.service.LocalDispatcher) _jspx_page_context.getAttribute("dispatcher", PageContext.REQUEST_SCOPE);
        if (dispatcher == null){
          throw new java.lang.InstantiationException("bean dispatcher not found within scope");
        }
      }
      out.write("\r\n");
      out.write("\r\n");
if(security.hasPermission("WEBTOOLS_VIEW", session)) {
      out.write("\r\n");
      out.write("\r\n");
      out.write("<div class=\"head2\">Service Log</div>\r\n");
      out.write("<a href=\"");
      if (_jspx_meth_ofbiz_url_0(_jspx_page_context))
        return;
      out.write("\" class=\"buttontext\">[Refresh]</a>&nbsp;\r\n");
      out.write("<a href=\"");
      if (_jspx_meth_ofbiz_url_1(_jspx_page_context))
        return;
      out.write("\" class=\"buttontext\">[Job List]</a>&nbsp;\r\n");
      out.write("<a href=\"");
      if (_jspx_meth_ofbiz_url_2(_jspx_page_context))
        return;
      out.write("\" class=\"buttontext\">[Thread List]</a>&nbsp;\r\n");
      out.write("<a href=\"");
      if (_jspx_meth_ofbiz_url_3(_jspx_page_context))
        return;
      out.write("\" class=\"buttontext\">[Schedule Job]</a>\r\n");
      out.write("<br/>\r\n");
      out.write("\r\n");
      out.write("<br/>\r\n");
      out.write("<table cellpadding=\"2\" cellspacing=\"0\" border=\"1\" width=\"100%\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td><div class=\"tableheadtext\">Service Name</div></td>\r\n");
      out.write("    <td><div class=\"tableheadtext\">Dispatcher Name</div></td>\r\n");
      out.write("    <td><div class=\"tableheadtext\">Mode</div></td>\r\n");
      out.write("    <td><div class=\"tableheadtext\">Start Time</div></td>\r\n");
      out.write("\t<td><div class=\"tableheadtext\">End Time</div></td>\r\n");
      out.write("    ");
      out.write("\r\n");
      out.write("  </tr>\r\n");
      out.write("  ");


    Map log = ServiceDispatcher.getServiceLogMap();
    if (log != null) {
        Iterator i = log.keySet().iterator();
        while (i.hasNext()) {
            RunningService rs = (RunningService) i.next();
  
      out.write("\r\n");
      out.write("  ");

      int mode = rs.getMode();
      String modeStr = "";
      if (mode == GenericEngine.SYNC_MODE) {
          modeStr = "SYNC";
      } else {
          modeStr = "ASYNC";
      }

      String serviceName = rs.getModelService().name;
      String localName = rs.getLocalName();
      Timestamp startTime = rs.getStartStamp();
      Timestamp endTime = rs.getEndStamp();
  
      out.write("\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td><div class=\"tabletext\">");
      out.print(UtilFormatOut.checkNull(serviceName,"&nbsp;"));
      out.write("</div></td>\r\n");
      out.write("    <td><div class=\"tabletext\">");
      out.print(UtilFormatOut.checkNull(localName, "&nbsp;"));
      out.write("</div></td>\r\n");
      out.write("    <td><div class=\"tabletext\">");
      out.print(UtilFormatOut.checkNull(modeStr,"[none]"));
      out.write("</div></td>\r\n");
      out.write("    <td><div class=\"tabletext\">");
      out.print(startTime);
      out.write("</div></td>\r\n");
      out.write("    ");
if (endTime != null) {
      out.write("\r\n");
      out.write("    <td><div class=\"tabletext\">");
      out.print(endTime);
      out.write("</div></td>\r\n");
      out.write("    ");
}else{
      out.write("\r\n");
      out.write("    <td><div class=\"tabletext\">[running]</div></td>\r\n");
      out.write("    ");
}
      out.write("\r\n");
      out.write("    ");
      out.write("\r\n");
      out.write("  </tr>\r\n");
      out.write("  ");

        }
    }
  
      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
}else{
      out.write("\r\n");
      out.write("  <hr>\r\n");
      out.write("  <div>You do not have permission to use this page.</div>\r\n");
}
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }

  private boolean _jspx_meth_ofbiz_url_0(PageContext _jspx_page_context)
          throws Throwable {
    PageContext pageContext = _jspx_page_context;
    JspWriter out = _jspx_page_context.getOut();
    //  ofbiz:url
    org.ofbiz.webapp.taglib.UrlTag _jspx_th_ofbiz_url_0 = (org.ofbiz.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url.get(org.ofbiz.webapp.taglib.UrlTag.class);
    _jspx_th_ofbiz_url_0.setPageContext(_jspx_page_context);
    _jspx_th_ofbiz_url_0.setParent(null);
    int _jspx_eval_ofbiz_url_0 = _jspx_th_ofbiz_url_0.doStartTag();
    if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
        out = _jspx_page_context.pushBody();
        _jspx_th_ofbiz_url_0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
        _jspx_th_ofbiz_url_0.doInitBody();
      }
      do {
        out.write("/serviceList");
        int evalDoAfterBody = _jspx_th_ofbiz_url_0.doAfterBody();
        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
          break;
      } while (true);
      if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
        out = _jspx_page_context.popBody();
    }
    if (_jspx_th_ofbiz_url_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return true;
    _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_0);
    return false;
  }

  private boolean _jspx_meth_ofbiz_url_1(PageContext _jspx_page_context)
          throws Throwable {
    PageContext pageContext = _jspx_page_context;
    JspWriter out = _jspx_page_context.getOut();
    //  ofbiz:url
    org.ofbiz.webapp.taglib.UrlTag _jspx_th_ofbiz_url_1 = (org.ofbiz.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url.get(org.ofbiz.webapp.taglib.UrlTag.class);
    _jspx_th_ofbiz_url_1.setPageContext(_jspx_page_context);
    _jspx_th_ofbiz_url_1.setParent(null);
    int _jspx_eval_ofbiz_url_1 = _jspx_th_ofbiz_url_1.doStartTag();
    if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
        out = _jspx_page_context.pushBody();
        _jspx_th_ofbiz_url_1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
        _jspx_th_ofbiz_url_1.doInitBody();
      }
      do {
        out.write("/jobList");
        int evalDoAfterBody = _jspx_th_ofbiz_url_1.doAfterBody();
        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
          break;
      } while (true);
      if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
        out = _jspx_page_context.popBody();
    }
    if (_jspx_th_ofbiz_url_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return true;
    _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_1);
    return false;
  }

  private boolean _jspx_meth_ofbiz_url_2(PageContext _jspx_page_context)
          throws Throwable {
    PageContext pageContext = _jspx_page_context;
    JspWriter out = _jspx_page_context.getOut();
    //  ofbiz:url
    org.ofbiz.webapp.taglib.UrlTag _jspx_th_ofbiz_url_2 = (org.ofbiz.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url.get(org.ofbiz.webapp.taglib.UrlTag.class);
    _jspx_th_ofbiz_url_2.setPageContext(_jspx_page_context);
    _jspx_th_ofbiz_url_2.setParent(null);
    int _jspx_eval_ofbiz_url_2 = _jspx_th_ofbiz_url_2.doStartTag();
    if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
        out = _jspx_page_context.pushBody();
        _jspx_th_ofbiz_url_2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
        _jspx_th_ofbiz_url_2.doInitBody();
      }
      do {
        out.write("/threadList");
        int evalDoAfterBody = _jspx_th_ofbiz_url_2.doAfterBody();
        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
          break;
      } while (true);
      if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
        out = _jspx_page_context.popBody();
    }
    if (_jspx_th_ofbiz_url_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return true;
    _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_2);
    return false;
  }

  private boolean _jspx_meth_ofbiz_url_3(PageContext _jspx_page_context)
          throws Throwable {
    PageContext pageContext = _jspx_page_context;
    JspWriter out = _jspx_page_context.getOut();
    //  ofbiz:url
    org.ofbiz.webapp.taglib.UrlTag _jspx_th_ofbiz_url_3 = (org.ofbiz.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url.get(org.ofbiz.webapp.taglib.UrlTag.class);
    _jspx_th_ofbiz_url_3.setPageContext(_jspx_page_context);
    _jspx_th_ofbiz_url_3.setParent(null);
    int _jspx_eval_ofbiz_url_3 = _jspx_th_ofbiz_url_3.doStartTag();
    if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
      if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
        out = _jspx_page_context.pushBody();
        _jspx_th_ofbiz_url_3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
        _jspx_th_ofbiz_url_3.doInitBody();
      }
      do {
        out.write("/scheduleJob");
        int evalDoAfterBody = _jspx_th_ofbiz_url_3.doAfterBody();
        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
          break;
      } while (true);
      if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
        out = _jspx_page_context.popBody();
    }
    if (_jspx_th_ofbiz_url_3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return true;
    _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_3);
    return false;
  }
}
