Examples of BAMSummaryGenerationDSClient


Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

            }
        }
    }

    protected Calendar getLatestYearlySummaryTime() throws BAMException {
      BAMSummaryGenerationDSClient client = BAMUtil.getBAMSummaryGenerationDSClient();
        try {
            return client.getLatestEndpointStatSummaryPeriod(getTimeInterval(), endpoint);
        } finally {
            client.cleanup();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

            client.cleanup();
        }
    }

    protected Calendar getLatestQuarterlySummaryTime() throws BAMException {
      BAMSummaryGenerationDSClient client = BAMUtil.getBAMSummaryGenerationDSClient();
        try {
            return client.getLatestEndpointStatSummaryPeriod(getTimeInterval(), endpoint);
        } finally {
            client.cleanup();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

            client.cleanup();
        }
    }

    protected Calendar getLatestMonthlySummaryTime() throws BAMException {
      BAMSummaryGenerationDSClient client = BAMUtil.getBAMSummaryGenerationDSClient();
        try {
            return client.getLatestEndpointStatSummaryPeriod(getTimeInterval(), endpoint);
        } finally {
            client.cleanup();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

            client.cleanup();
        }
    }

    protected Calendar getLatestDailySummaryTime() throws BAMException {
      BAMSummaryGenerationDSClient client = BAMUtil.getBAMSummaryGenerationDSClient();
        try {
            return client.getLatestEndpointStatSummaryPeriod(getTimeInterval(), endpoint);
        } finally {
            client.cleanup();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

            client.cleanup();
        }
    }

    protected Calendar getLatestHourlySummaryTime() throws BAMException {
      BAMSummaryGenerationDSClient client = BAMUtil.getBAMSummaryGenerationDSClient();
        try {
            return client.getLatestEndpointStatSummaryPeriod(getTimeInterval(), endpoint);
        } finally {
            client.cleanup();
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

        }
  }

  public MediationSummaryStatistic getEndpointStatHourlySummary(int serverId, String endpoint,
      String direction, BAMCalendar startTime, BAMCalendar endTime) throws BAMException {
    BAMSummaryGenerationDSClient client = null;
    try {
      client = BAMUtil.getBAMSummaryGenerationDSClient();;
      String endpointString;
      double[] doubles;
            int[] intsThisHour;
            int[] intsPrevHour;
      double doubleVal;
      int intVal;

      MediationSummaryStatistic statistic = new MediationSummaryStatistic();

      endpointString = createMediationKeyString(ENDPOINT, direction, MAX_PROCESSING_TIME, endpoint);
      doubles = client
          .getMediationStatHourlySummaryDouble(serverId, endpointString, startTime, endTime);
      doubleVal = BAMMath.max(doubles);
      statistic.setMaxProcessingTime(doubleVal);

      endpointString = createMediationKeyString(ENDPOINT, direction, MIN_PROCESSING_TIME, endpoint);
      doubles = client
          .getMediationStatHourlySummaryDouble(serverId, endpointString, startTime, endTime);
      doubleVal = BAMMath.min(doubles);
      statistic.setMinProcessingTime(doubleVal);

      endpointString = createMediationKeyString(ENDPOINT, direction, AVG_PROCESSING_TIME, endpoint);
      doubles = client.getMediationStatHourlySummaryDouble(serverId, endpointString, startTime, endTime);
      doubleVal = BAMMath.avg(doubles);
      statistic.setAvgProcessingTime(doubleVal);

//      endpointString = createMediationKeyString(ENDPOINT, direction, CUMULATIVE_COUNT, endpoint);
//      ints = client.getMediationStatHourlySummaryInt(serverId, endpointString, startTime, endTime);
//      intVal = BAMMath.max(ints) - BAMMath.min(ints);
//      statistic.setCount(intVal);
//
//      endpointString = createMediationKeyString(ENDPOINT, direction, FAULT_COUNT, endpoint);
//      ints = client.getMediationStatHourlySummaryInt(serverId, endpointString, startTime, endTime);
//      intVal = BAMMath.max(ints) - BAMMath.min(ints);
//      statistic.setFaultCount(intVal);

      BAMCalendar prevStartTime = BAMCalendar.getInstance(startTime);
      prevStartTime.add(BAMCalendar.HOUR, -24);
            BAMCalendar prevEndTime = BAMCalendar.getInstance(endTime);
            prevEndTime.add(BAMCalendar.HOUR, -1);

      endpointString = createMediationKeyString(ENDPOINT, direction, CUMULATIVE_COUNT, endpoint);
            intsThisHour = client.getDataForMediationMaxCount(serverId, endpointString, startTime, endTime);
            intsPrevHour = client.getDataForMediationMaxCount(serverId, endpointString, prevStartTime, prevEndTime);

            intVal = BAMMath.max(intsThisHour) - BAMMath.max(intsPrevHour);
      statistic.setCount(intVal >=0 ? intVal : BAMMath.max(intsThisHour));

      if (BAMMath.max(intsThisHour) <= 0){
        statistic.setAllZeros();
      } else {
      endpointString = createMediationKeyString(ENDPOINT, direction, FAULT_COUNT, endpoint);
              intsThisHour = client.getDataForMediationMaxCount(serverId, endpointString, startTime, endTime);
              intsPrevHour = client.getDataForMediationMaxCount(serverId, endpointString, prevStartTime, prevEndTime);
        intVal = BAMMath.max(intsThisHour) - BAMMath.max(intsPrevHour);
        statistic.setFaultCount(intVal >=0 ? intVal : BAMMath.max(intsThisHour));
      }

      return statistic;

    } catch (Exception e) {
      throw new BAMException("Could not retrieve hourly summary for serverId: " + serverId
          + "endpoint: " + endpoint + direction + " start time: " + startTime.getBAMTimestamp(), e);
    } finally {
      if (client != null) {
          client.cleanup();
      }
    }
  }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

    }
  }

  public void deleteServerEndpointUserData(int serverId, String endpoint, String direction,
      BAMCalendar startTime, BAMCalendar endTime) throws BAMException {
        BAMSummaryGenerationDSClient client = null;
    try {
      client = BAMUtil.getBAMSummaryGenerationDSClient();
      String endpointString;

      endpointString = createMediationKeyString(ENDPOINT, direction, MAX_PROCESSING_TIME, endpoint);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, MIN_PROCESSING_TIME, endpoint);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, AVG_PROCESSING_TIME, endpoint);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, CUMULATIVE_COUNT, endpoint);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, FAULT_COUNT, endpoint);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, COUNT, endpoint);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, ID, null);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

      endpointString = createMediationKeyString(ENDPOINT, direction, ERROR, null);
      client.deleteServerUserData(serverId, endpointString, startTime, endTime);

    } catch (Exception e) {
      throw new BAMException("Could not delete hourly summary for serverId: " + serverId + "endpoint: "
          + endpoint + direction + " end time: " + endTime.getBAMTimestamp(), e);
    } finally {
      if (client != null) {
          client.cleanup();
      }
    }
  }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

    }
  }

  public MediationSummaryStatistic getEndpointStatDailySummary(int serverId, String endpoint,
      String direction, BAMCalendar startTime, BAMCalendar endTime) throws BAMException {
        BAMSummaryGenerationDSClient client = null;
    try {
      client = BAMUtil.getBAMSummaryGenerationDSClient();
      return client.getEndpointStatDailySummary(serverId, endpoint, direction, startTime, endTime);
    } catch (Exception e) {
      throw new BAMException("Could not retrieve daily summary for serverId: " + serverId
          + "endpoint: " + endpoint + direction + " start time: " + startTime.getBAMTimestamp(), e);
    } finally {
      if (client != null) {
          client.cleanup();
      }
    }
  }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

    }
  }

  public MediationSummaryStatistic getEndpointStatMonthlySummary(int serverId, String endpoint,
      String direction, BAMCalendar startTime, BAMCalendar endTime) throws BAMException {
        BAMSummaryGenerationDSClient client = null;
    try {
      client = BAMUtil.getBAMSummaryGenerationDSClient();

      return client.getEndpointStatMonthlySummary(serverId, endpoint, direction, startTime, endTime);
    } catch (Exception e) {
      throw new BAMException("Could not retrieve monthly summary for serverId: " + serverId
          + "endpoint: " + endpoint + direction + " start time: " + startTime.getBAMTimestamp(), e);
    } finally {
      if (client != null) {
          client.cleanup();
      }
    }
  }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMSummaryGenerationDSClient

    }
  }

  public MediationSummaryStatistic getEndpointStatQuarterlySummary(int serverId, String endpoint,
      String direction, BAMCalendar startTime, BAMCalendar endTime) throws BAMException {
        BAMSummaryGenerationDSClient client = null;
    try {
            client = BAMUtil.getBAMSummaryGenerationDSClient();
      return client.getEndpointStatQuarterlySummary(serverId, endpoint, direction, startTime, endTime);
    } catch (Exception e) {
      throw new BAMException("Could not retrieve quarterly summary for serverId: " + serverId
          + "endpoint: " + endpoint + direction + " start time: " + startTime.getBAMTimestamp(), e);
    } finally {
      if (client != null) {
          client.cleanup();
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.