Package org.wso2.carbon.bam.util

Examples of org.wso2.carbon.bam.util.TimeRange


            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);
            }
View Full Code Here


                stat.setTimeDimensionId(hd.getId());
                SummaryPersistenceManager.getInstance().addServerStatHourlySummary(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.deleteServerData(getServer().getId(), delLoHour, delHiHour);
            }
        } catch (BAMException e) {
View Full Code Here

                stat.setTypeId(this.getOperation().getOperationID());
                stat.setTimeDimensionId(hd.getId());
                SummaryPersistenceManager.getInstance().addOperationStatHourlySummary(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.deleteOperationData(getOperation().getOperationID(), delLoHour, delHiHour);
            }
        } catch (BAMException e) {
            if (log.isErrorEnabled()) {
View Full Code Here

            stat.setServerId(getServer().getId());
            stat.setDirection(getProxyService().getDirection());

            SummaryPersistenceManager.getInstance().addProxyServiceStatHourlySummary(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.deleteServerProxyServiceUserData(getServer().getId(),
                        getProxyService().getName(), getProxyService().getDirection(), delLoHour, delHiHour);
            }
View Full Code Here

        }
        return persistenceManager;
    }

    public TimeRange getDataRetentionPeriod() throws BAMException {
        TimeRange retention;

        BAMGlobalConfigAdmin configAdmin = new BAMGlobalConfigAdmin(getRegistry());
        try {
            retention = configAdmin.getDataRetentionPeriod();
        } catch (BAMException e) {
            throw new BAMException("Error occurred getting data retention period", e);
        }

        // If the data retention period is not specified or incorrect, use
        // one month as default

        if (retention == null) {
            retention = new TimeRange(BAMCalendar.MONTH, 1);
        }
        return retention;
    }
View Full Code Here

        }
        return retention;
    }

    public TimeRange getDataArchivalPeriod() throws BAMException {
        TimeRange retention;
        BAMGlobalConfigAdmin configAdmin = new BAMGlobalConfigAdmin(getRegistry());

        try {
            retention = configAdmin.getDataArchivalPeriod();
        } catch (BAMException e) {
            throw new BAMException("Error occurred getting data archive period", e);
        }
        // If the data retention period is not specified or incorrect, use
        // one day as default

        if (retention == null) {
            retention = new TimeRange(BAMCalendar.MONTH, 1);
        }
        return retention;
    }
View Full Code Here

            stat.setServerId(getServer().getId());
            stat.setDirection(getEndpoint().getDirection());

            SummaryPersistenceManager.getInstance().addEndpointStatHourlySummary(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.deleteServerEndpointUserData(getServer().getId(),
                        getEndpoint().getName(), getEndpoint().getDirection(), delLoHour, delHiHour);
            }
        } catch (BAMException e) {
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("[" + this.getClass().getSimpleName() + " | " + getTimeString() + "] " + "Archive last ran at:"
                      + BAMCalendar.getInstance(lastTime).getBAMTimestamp());
        }

        TimeRange archival = BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).getDataArchivalPeriod();

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

            nowTime.add(archival.getType(), -1 * archival.getValue());
            lastTime.add(archival.getType(), -1 * archival.getValue());

            MessageDataDO[] datas = client.getMessageArchiveData(lastTime, nowTime);

            for (MessageDataDO data : datas) {
              //  client.archiveMessageData(data);
View Full Code Here

        return server;
    }

    public String getDataRetentionPeriod() throws BAMException {

        TimeRange timeRange = null;
        try {
            timeRange = persistenceManager.getDataRetentionPeriod();
        } catch (BAMException e) {
            throw new BAMException("Error occurred getting DataRetentionPeriod" ,e);
        }
        return timeRange.toString();
    }
View Full Code Here

    public void setDataRetentionPeriod(String timeRange) throws BAMException {
        persistenceManager.updateDataRetentionPeriod(TimeRange.parseTimeRange(timeRange));
    }

    public String getDataArchivalPeriod() throws BAMException {
        TimeRange timeRange = persistenceManager.getDataArchivalPeriod();
        return timeRange.toString();
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.bam.util.TimeRange

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.