Examples of MonthDimension


Examples of org.wso2.carbon.bam.common.dataobjects.dimensions.MonthDimension

    protected void summarizeMonthly(BAMCalendar start, BAMCalendar end) {
        long regBandwidth = 0;
        long regHistoryBandwidth=0;
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();
            MonthDimension md = spm.getMonthDimension(start);
            if (md == null) {
                spm.addMonthDimension(start);
                md = spm.getMonthDimension(start);
            }
           
            //Get the usage
            BandwidthUsageValue[] usages;
            usages = client.getStub().getRegistryBandwidthUsageForMonthlySummary(
                    tenant.getId(), start, end);
            if((usages != null) && (usages[0] != null)){
                regBandwidth = usages[0].getRegistryBandwidth();
                regHistoryBandwidth = usages[0].getRegistryHistoryBandwidth();
                if(regBandwidth < 0){
                    //reg bandwidth should be not null, non-negative
                    regBandwidth = 0;
                }
                if(regHistoryBandwidth < 0){
                    //reg history bandwidth should be not null, non-negative
                    regHistoryBandwidth = 0;
                }
            }
           
            //Write the summary
            client.getStub().addRegistryBandwidthUsageMonthlySummary(tenant.getId(), md.getId(),
                    UsageConstants.REGISTRY_CONTENT_BANDWIDTH, regBandwidth, regHistoryBandwidth);
        } catch (Exception e) {
            String msg = "Unable to run Registry Usage monthly summary for domain "
                    + tenant.getDomain();
            log.error(msg, e);
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.