Package org.wso2.carbon.bam.core.summary

Examples of org.wso2.carbon.bam.core.summary.SummaryPersistenceManager


    @Override
    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(
View Full Code Here


        this.server = server;
    }

    protected void summarizeHourly(BAMCalendar loHour, BAMCalendar hiHour) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            HourDimension hd = spm.getHourDimension(loHour);
            if (hd == null) {
                spm.addHourDimension(loHour);
                hd = spm.getHourDimension(loHour);
            }

            SummaryStatistic stat = spm.getServiceStatHourlySummary(this.getService().getId(), loHour, hiHour);
            if (stat != null) {
                stat.setTypeId(this.getService().getId());
                stat.setTimeDimensionId(hd.getId());
                SummaryPersistenceManager.getInstance().addServiceStatHourlySummary(stat);
            }
            TimeRange retention = BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).getDataRetentionPeriod();

            // do not delete anything if the retention period specified is 0.
            if (retention.getValue() != 0) {

                BAMCalendar delLoHour = BAMCalendar.getInstance(loHour);
                BAMCalendar delHiHour = BAMCalendar.getInstance(hiHour);

                delHiHour.add(retention.getType(), -1 * retention.getValue());
                delLoHour.add(retention.getType(), -1 * retention.getValue());


                spm.deleteServiceData(getService().getId(), delLoHour, delHiHour);
            }
        } catch (BAMException e) {
            if (log.isErrorEnabled()) {
                log.error("Error while running hourly summary generator for service: " + getService().getName()
                        + " of server: " + getServer().getServerURL(), e);
View Full Code Here

        }
    }

    protected void summarizeDaily(BAMCalendar loDay, BAMCalendar hiDay) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            DayDimension dd = spm.getDayDimension(loDay);
            if (dd == null) {
                spm.addDayDimension(loDay);
                dd = spm.getDayDimension(loDay);
            }

            SummaryStatistic stat = spm.getServiceStatDailySummary(this.getService().getId(), loDay, hiDay);
            if (stat != null) {
                stat.setTypeId(this.getService().getId());
                stat.setTimeDimensionId(dd.getId());
                SummaryPersistenceManager.getInstance().addServiceStatDailySummary(stat);
            }
View Full Code Here

        }
    }

    protected void summarizeMonthly(BAMCalendar loMonth, BAMCalendar hiMonth) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            MonthDimension md = spm.getMonthDimension(loMonth);
            if (md == null) {
                spm.addMonthDimension(loMonth);
                md = spm.getMonthDimension(loMonth);
            }

            SummaryStatistic stat = spm.getServiceStatMonthlySummary(this.getService().getId(), loMonth, hiMonth);
            if (stat != null) {
                stat.setTypeId(this.getService().getId());
                stat.setTimeDimensionId(md.getId());
                SummaryPersistenceManager.getInstance().addServiceStatMonthlySummary(stat);
            }
View Full Code Here

        }
    }

    protected void summarizeQuarterly(BAMCalendar loQuarter, BAMCalendar hiQuarter) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            QuarterDimension qd = spm.getQuarterDimension(loQuarter);
            if (qd == null) {
                spm.addQuarterDimension(loQuarter);
                qd = spm.getQuarterDimension(loQuarter);
            }

            SummaryStatistic stat = spm.getServiceStatQuarterlySummary(this.getService().getId(), loQuarter, hiQuarter);
            if (stat != null) {
                stat.setTypeId(this.getService().getId());
                stat.setTimeDimensionId(qd.getId());
                SummaryPersistenceManager.getInstance().addServiceStatQuarterlySummary(stat);
            }
View Full Code Here

        }
    }

    protected void summarizeYearly(BAMCalendar loYear, BAMCalendar hiYear) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            YearDimension qd = spm.getYearDimension(loYear);
            if (qd == null) {
                spm.addYearDimension(loYear);
                qd = spm.getYearDimension(loYear);
            }

            SummaryStatistic stat = spm.getServiceStatYearlySummary(this.getService().getId(), loYear, hiYear);
            if (stat != null) {
                stat.setTypeId(this.getService().getId());
                stat.setTimeDimensionId(qd.getId());
                SummaryPersistenceManager.getInstance().addServiceStatYearlySummary(stat);
            }
View Full Code Here

        this.setServer(server);
    }

    protected void summarizeHourly(BAMCalendar loHour, BAMCalendar hiHour) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            HourDimension hd = spm.getHourDimension(loHour);
            if (hd == null) {
                spm.addHourDimension(loHour);
                hd = spm.getHourDimension(loHour);
            }

            //TODO: flag
            MediationSummaryStatistic stat = spm.getSequenceStatHourlySummary(getServer().getId(),
                    getSequence().getName(), getSequence().getDirection(), loHour, hiHour);
            stat.setName(getSequence().getName());
            stat.setTimeDimensionId(hd.getId());
            stat.setServerId(getServer().getId());
            stat.setDirection(getSequence().getDirection());

            SummaryPersistenceManager.getInstance().addSequenceStatHourlySummary(stat);

            TimeRange retention = BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).getDataRetentionPeriod();

            // do not delete anything if the retention period specified is 0.
            if (retention.getValue() != 0) {

                BAMCalendar delLoHour = BAMCalendar.getInstance(loHour);
                BAMCalendar delHiHour = BAMCalendar.getInstance(hiHour);

                delHiHour.add(retention.getType(), -1 * retention.getValue());
                delLoHour.add(retention.getType(), -1 * retention.getValue());


                spm.deleteServerSequenceUserData(getServer().getId(),
                        getSequence().getName(), getSequence().getDirection(), delLoHour, delHiHour);
            }
        } catch (BAMException e) {
            if (log.isErrorEnabled()) {
                log.error("Error while running hourly summary generator for sequence: " + getSequence()
View Full Code Here

    }


    protected void summarizeDaily(BAMCalendar loDay, BAMCalendar hiDay) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            DayDimension dd = spm.getDayDimension(loDay);
            if (dd == null) {
                spm.addDayDimension(loDay);
                dd = spm.getDayDimension(loDay);
            }

            MediationSummaryStatistic stat = spm.getSequenceStatDailySummary(getServer().getId(),
                    getSequence().getName(), getSequence().getDirection(), loDay, hiDay);
            stat.setName(getSequence().getName());
            stat.setTimeDimensionId(dd.getId());
            stat.setServerId(getServer().getId());
            stat.setDirection(getSequence().getDirection());
View Full Code Here

        }
    }

    protected void summarizeMonthly(BAMCalendar loMonth, BAMCalendar hiMonth) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            MonthDimension md = spm.getMonthDimension(loMonth);
            if (md == null) {
                spm.addMonthDimension(loMonth);
                md = spm.getMonthDimension(loMonth);
            }

            MediationSummaryStatistic stat = spm.getSequenceStatMonthlySummary(getServer().getId(),
                    getSequence().getName(), getSequence().getDirection(), loMonth, hiMonth);
            stat.setName(getSequence().getName());
            stat.setTimeDimensionId(md.getId());
            stat.setServerId(getServer().getId());
            stat.setDirection(getSequence().getDirection());
View Full Code Here

        }
    }

    protected void summarizeQuarterly(BAMCalendar loQuarter, BAMCalendar hiQuarter) {
        try {
            SummaryPersistenceManager spm = SummaryPersistenceManager.getInstance();

            QuarterDimension qd = spm.getQuarterDimension(loQuarter);
            if (qd == null) {
                spm.addQuarterDimension(loQuarter);
                qd = spm.getQuarterDimension(loQuarter);
            }

            MediationSummaryStatistic stat = spm.getSequenceStatQuarterlySummary(getServer().getId(),
                    getSequence().getName(), getSequence().getDirection(), loQuarter, hiQuarter);
            stat.setName(getSequence().getName());
            stat.setTimeDimensionId(qd.getId());
            stat.setServerId(getServer().getId());
            stat.setDirection(getSequence().getDirection());
View Full Code Here

TOP

Related Classes of org.wso2.carbon.bam.core.summary.SummaryPersistenceManager

Copyright © 2018 www.massapicom. 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.