Exemplo n.º 1
0
  public void doGet(HttpServletRequest req, HttpServletResponse res) {
    res.setContentType("application/download-xml-file");

    String messageId = req.getParameter("message");

    OMElement report = null;

    try {
      Message m = new Message(messageId);
      m.readMessage();

      report = buildReport(m);

    } catch (LoggerException e) {
      report = omFactory.createOMElement(new QName("NoReportAvailable"));
      report.setText(e.getMessage().replaceAll("<", "&lt;"));
    } catch (ServletException e) {
      report = omFactory.createOMElement(new QName("NoReportAvailable"));
      report.setText(e.getMessage().replaceAll("<", "&lt;"));
    }

    try {
      res.getWriter().write(report.toString());
    } catch (IOException e) {
    }
  }
Exemplo n.º 2
0
  OMElement buildReport(Message m) throws ServletException {
    if (!verifyTables(m)) {
      throw new ServletException("Missing Table");
    }

    System.out.println(index(m));

    HashMap<String, HashMap<String, Object>> mm = m.toHashMap();

    OMElement report = omFactory.createOMElement(new QName("XdsEvsResult"));

    addParm(report, mm, "Test", "other", "Service");
    addParm(report, mm, "Date", "main", "Timestamp");
    addParm(report, mm, "Source", "http", "IP_address_From");

    OMElement ele = omFactory.createOMElement(new QName("Target"));
    ele.setText(localIPAddress());
    report.addChild(ele);

    addParm(report, mm, "Endpoint", "http", "URI_To");
    addParm(report, mm, "Result", "main", "Pass");
    addParm(report, mm, "LogEvent", "main", "MessageId");

    addParm(report, mm, "Error", "error", "Error");

    // System.out.println("errors are:\n" + mm.get("error"));

    return report;
  }
Exemplo n.º 3
0
  String index(Message m) {
    HashMap<String, HashMap<String, Object>> mm = m.toHashMap();
    StringBuffer buf = new StringBuffer();

    for (String key : mm.keySet()) {
      buf.append("\n" + key + "\n" + mm.get(key).keySet());
    }
    return buf.toString();
  }
Exemplo n.º 4
0
 boolean verifyTables(Message m) {
   HashSet<String> tableList = m.getTableList();
   boolean hasMain = tableList.contains("main");
   boolean hasOther = tableList.contains("other");
   boolean hasHttp = tableList.contains("http");
   boolean hasSoap = tableList.contains("soap");
   boolean hasError = tableList.contains("error");
   return hasMain && hasOther && hasHttp && hasSoap && hasError;
 }