예제 #1
0
파일: Handler.java 프로젝트: LyneLiu/cat
  private TransactionReport getHourlyReport(Payload payload) {
    String domain = payload.getDomain();
    String ipAddress = payload.getIpAddress();
    ModelRequest request =
        new ModelRequest(domain, payload.getDate())
            .setProperty("type", payload.getType())
            .setProperty("ip", ipAddress);

    if (m_service.isEligable(request)) {
      ModelResponse<TransactionReport> response = m_service.invoke(request);
      TransactionReport report = response.getModel();

      if (payload.getPeriod().isLast()) {
        Date start = new Date(payload.getDate());
        Date end = new Date(payload.getDate() + TimeHelper.ONE_HOUR);

        if (Constants.ALL.equals(domain)) {
          report = m_reportService.queryTransactionReport(domain, start, end);
        }
        Set<String> domains =
            m_reportService.queryAllDomainNames(start, end, TransactionAnalyzer.ID);
        Set<String> domainNames = report.getDomainNames();

        domainNames.addAll(domains);
      }
      return report;
    } else {
      throw new RuntimeException(
          "Internal error: no eligable transaction service registered for " + request + "!");
    }
  }
예제 #2
0
파일: Handler.java 프로젝트: LyneLiu/cat
  private TransactionReport getTransactionGraphReport(Model model, Payload payload) {
    String domain = payload.getDomain();
    String ipAddress = payload.getIpAddress();
    String name = payload.getName();
    ModelRequest request =
        new ModelRequest(domain, payload.getDate()) //
            .setProperty("type", payload.getType()) //
            .setProperty("name", payload.getName()) //
            .setProperty("ip", ipAddress);

    if (name == null || name.length() == 0) {
      request.setProperty("name", "*");
      request.setProperty("all", "true");
      name = Constants.ALL;
    }
    ModelResponse<TransactionReport> response = m_service.invoke(request);
    TransactionReport report = response.getModel();
    return report;
  }
예제 #3
0
  @Override
  protected ProblemReport merge(
      ModelRequest request, List<ModelResponse<ProblemReport>> responses) {
    if (responses.size() == 0) {
      return null;
    }
    ProblemReportMerger merger = new ProblemReportMerger(new ProblemReport(request.getDomain()));

    for (ModelResponse<ProblemReport> response : responses) {
      if (response != null) {
        ProblemReport model = response.getModel();

        if (model != null) {
          model.accept(merger);
        }
      }
    }

    return merger.getProblemReport();
  }