Search in sources :

Example 1 with SourceValueObjectImpl

use of org.mobicents.protocols.ss7.oam.common.statistics.SourceValueObjectImpl in project smscgateway by RestComm.

the class SmscStatProviderJmx method getSourceValueSet.

@Override
public SourceValueSet getSourceValueSet(String counterDefSetName, String campaignName, int durationInSeconds) {
    if (durationInSeconds >= 60)
        logger.info("getSourceValueSet() - starting - campaignName=" + campaignName);
    else
        logger.debug("getSourceValueSet() - starting - campaignName=" + campaignName);
    long curTimeSeconds = new Date().getTime() / 1000;
    SourceValueSetImpl svs;
    try {
        String[] csl = this.getCounterDefSetList();
        if (!csl[0].equals(counterDefSetName))
            return null;
        svs = new SourceValueSetImpl(smscStatAggregator.getSessionId());
        CounterDefSet cds = getCounterDefSet(counterDefSetName);
        for (CounterDef cd : cds.getCounterDefs()) {
            SourceValueCounterImpl scs = new SourceValueCounterImpl(cd);
            SourceValueObjectImpl svo = null;
            if (cd.getCounterName().equals("MsgInReceivedAll")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedAll());
            } else if (cd.getCounterName().equals("MsgInRejectedAll")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInRejectedAll());
            } else if (cd.getCounterName().equals("MsgInFailedAll")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInFailedAll());
            } else if (cd.getCounterName().equals("MsgInReceivedSs7")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedSs7());
            } else if (cd.getCounterName().equals("MsgInReceivedSs7Mo")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedSs7Mo());
            } else if (cd.getCounterName().equals("MsgInReceivedSs7Hr")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedSs7Hr());
            } else if (cd.getCounterName().equals("HomeRoutingCorrIdFail")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getHomeRoutingCorrIdFail());
            } else if (cd.getCounterName().equals("SmppSecondRateOverlimitFail")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getSmppSecondRateOverlimitFail());
            } else if (cd.getCounterName().equals("SmppMinuteRateOverlimitFail")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getSmppMinuteRateOverlimitFail());
            } else if (cd.getCounterName().equals("SmppHourRateOverlimitFail")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getSmppHourRateOverlimitFail());
            } else if (cd.getCounterName().equals("SmppDayRateOverlimitFail")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getSmppDayRateOverlimitFail());
            } else if (cd.getCounterName().equals("MsgInReceivedSmpp")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedSmpp());
            } else if (cd.getCounterName().equals("MsgInReceivedSip")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedSip());
            } else if (cd.getCounterName().equals("MsgInReceivedAllCumulative")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInReceivedAllCumulative());
            } else if (cd.getCounterName().equals("MsgInHrSriReq")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInHrSriReq());
            } else if (cd.getCounterName().equals("MsgInHrSriPosReq")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInHrSriPosReq());
            } else if (cd.getCounterName().equals("MsgInHrSriHrByPass")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInHrSriHrByPass());
            } else if (cd.getCounterName().equals("MsgInHrSriNegReq")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgInHrSriNegReq());
            } else if (cd.getCounterName().equals("MsgOutTryAll")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutTryAll());
            } else if (cd.getCounterName().equals("MsgOutSentAll")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutSentAll());
            } else if (cd.getCounterName().equals("MsgOutTryAllCumulative")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutTryAllCumulative());
            } else if (cd.getCounterName().equals("MsgOutSentAllCumulative")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutSentAllCumulative());
            } else if (cd.getCounterName().equals("MsgOutFailedAll")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutFailedAll());
            } else if (cd.getCounterName().equals("MsgOutTryAllPerSec")) {
                long cnt = smscStatAggregator.getMsgOutTryAll();
                svo = new SourceValueObjectImpl(this.getName(), 0);
                svo.setValueA(cnt);
                svo.setValueB(curTimeSeconds);
            } else if (cd.getCounterName().equals("MsgOutSentAllPerSec")) {
                long cnt = smscStatAggregator.getMsgOutSentAll();
                svo = new SourceValueObjectImpl(this.getName(), 0);
                svo.setValueA(cnt);
                svo.setValueB(curTimeSeconds);
            } else if (cd.getCounterName().equals("MsgOutTrySs7")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutTrySs7());
            } else if (cd.getCounterName().equals("MsgOutSentSs7")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutSentSs7());
            } else if (cd.getCounterName().equals("MsgOutTrySmpp")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutTrySmpp());
            } else if (cd.getCounterName().equals("MsgOutSentSmpp")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutSentSmpp());
            } else if (cd.getCounterName().equals("MsgOutTrySip")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutTrySip());
            } else if (cd.getCounterName().equals("MsgOutSentSip")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgOutSentSip());
            } else if (cd.getCounterName().equals("MinMessagesInProcess")) {
                Long res = smscStatAggregator.getMinMessagesInProcess(campaignName);
                if (res != null)
                    svo = new SourceValueObjectImpl(this.getName(), res);
            } else if (cd.getCounterName().equals("MaxMessagesInProcess")) {
                Long res = smscStatAggregator.getMaxMessagesInProcess(campaignName);
                if (res != null)
                    svo = new SourceValueObjectImpl(this.getName(), res);
            } else if (cd.getCounterName().equals("SmscDeliveringLag")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getSmscDeliveringLag());
            } else if (cd.getCounterName().equals("MsgPendingInDb")) {
                svo = new SourceValueObjectImpl(this.getName(), smscStatAggregator.getMsgPendingInDbRes());
            }
            if (svo != null)
                scs.addObject(svo);
            svs.addCounter(scs);
        }
    } catch (Throwable e) {
        logger.info("Exception when getSourceValueSet() - campaignName=" + campaignName + " - " + e.getMessage(), e);
        return null;
    }
    if (durationInSeconds >= 60)
        logger.info("getSourceValueSet() - return value - campaignName=" + campaignName);
    else
        logger.debug("getSourceValueSet() - return value - campaignName=" + campaignName);
    return svs;
}
Also used : SourceValueSetImpl(org.mobicents.protocols.ss7.oam.common.statistics.SourceValueSetImpl) CounterDefSet(org.mobicents.protocols.ss7.oam.common.statistics.api.CounterDefSet) SourceValueCounterImpl(org.mobicents.protocols.ss7.oam.common.statistics.SourceValueCounterImpl) CounterDef(org.mobicents.protocols.ss7.oam.common.statistics.api.CounterDef) Date(java.util.Date) SourceValueObjectImpl(org.mobicents.protocols.ss7.oam.common.statistics.SourceValueObjectImpl)

Aggregations

Date (java.util.Date)1 SourceValueCounterImpl (org.mobicents.protocols.ss7.oam.common.statistics.SourceValueCounterImpl)1 SourceValueObjectImpl (org.mobicents.protocols.ss7.oam.common.statistics.SourceValueObjectImpl)1 SourceValueSetImpl (org.mobicents.protocols.ss7.oam.common.statistics.SourceValueSetImpl)1 CounterDef (org.mobicents.protocols.ss7.oam.common.statistics.api.CounterDef)1 CounterDefSet (org.mobicents.protocols.ss7.oam.common.statistics.api.CounterDefSet)1