4 new revisions:

Revision: 3193761e58ed
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 14 07:52:57 2013
Log:      UnstructuredSSResponse allowing optional paramater
http://code.google.com/p/jss7/source/detail?r=3193761e58ed

Revision: 12b1badb840a
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 14 12:25:13 2013
Log:      Simulator fix: storing config data into "data" folder
http://code.google.com/p/jss7/source/detail?r=12b1badb840a

Revision: 1ff1bbc4ef6c
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 14 12:54:58 2013
Log:      Adding "Statistics" project
http://code.google.com/p/jss7/source/detail?r=1ff1bbc4ef6c

Revision: 2ca4d1959fb1
Author:   Sergey Vetyutnev <[email protected]>
Date:     Thu Aug 15 07:32:26 2013
Log:      Merge remote-tracking branch 'origin/cap42'
http://code.google.com/p/jss7/source/detail?r=2ca4d1959fb1

==============================================================================
Revision: 3193761e58ed
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 14 07:52:57 2013
Log:      UnstructuredSSResponse allowing optional paramater
http://code.google.com/p/jss7/source/detail?r=3193761e58ed

Modified:
/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/MAPDialogSupplementaryImpl.java /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/MAPServiceSupplementaryImpl.java

=======================================
--- /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/MAPDialogSupplementaryImpl.java Mon May 20 13:09:00 2013 +++ /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/MAPDialogSupplementaryImpl.java Wed Aug 14 07:52:57 2013
@@ -190,16 +190,18 @@
oc.setLocalOperationCode((long) MAPOperationCode.unstructuredSS_Notify);
         invoke.setOperationCode(oc);

- UnstructuredSSRequestImpl req = new UnstructuredSSRequestImpl(ussdDataCodingScheme, ussdString, alertingPatter, msisdn);
-        AsnOutputStream aos = new AsnOutputStream();
-        req.encodeData(aos);
+        if (ussdString != null) {
+ UnstructuredSSRequestImpl req = new UnstructuredSSRequestImpl(ussdDataCodingScheme, ussdString, alertingPatter, msisdn);
+            AsnOutputStream aos = new AsnOutputStream();
+            req.encodeData(aos);

- Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter();
-        p.setTagClass(req.getTagClass());
-        p.setPrimitive(req.getIsPrimitive());
-        p.setTag(req.getTag());
-        p.setData(aos.toByteArray());
-        invoke.setParameter(p);
+ Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter();
+            p.setTagClass(req.getTagClass());
+            p.setPrimitive(req.getIsPrimitive());
+            p.setTag(req.getTag());
+            p.setData(aos.toByteArray());
+            invoke.setParameter(p);
+        }

         Long invokeId;
         try {
@@ -226,16 +228,18 @@
oc.setLocalOperationCode((long) MAPOperationCode.unstructuredSS_Request);
         returnResult.setOperationCode(oc);

- UnstructuredSSResponseImpl req = new UnstructuredSSResponseImpl(ussdDataCodingScheme, ussdString);
-        AsnOutputStream aos = new AsnOutputStream();
-        req.encodeData(aos);
+        if (ussdString != null) {
+ UnstructuredSSResponseImpl req = new UnstructuredSSResponseImpl(ussdDataCodingScheme, ussdString);
+            AsnOutputStream aos = new AsnOutputStream();
+            req.encodeData(aos);

- Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter();
-        p.setTagClass(req.getTagClass());
-        p.setPrimitive(req.getIsPrimitive());
-        p.setTag(req.getTag());
-        p.setData(aos.toByteArray());
-        returnResult.setParameter(p);
+ Parameter p = this.mapProviderImpl.getTCAPProvider().getComponentPrimitiveFactory().createParameter();
+            p.setTagClass(req.getTagClass());
+            p.setPrimitive(req.getIsPrimitive());
+            p.setTag(req.getTag());
+            p.setData(aos.toByteArray());
+            returnResult.setParameter(p);
+        }

this.sendReturnResultLastComponent((ReturnResultLast) returnResult);
     }
=======================================
--- /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/MAPServiceSupplementaryImpl.java Mon Jun 3 09:03:39 2013 +++ /map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/service/supplementary/MAPServiceSupplementaryImpl.java Wed Aug 14 07:52:57 2013
@@ -266,21 +266,20 @@
private void unstructuredSSResponse(Parameter parameter, MAPDialogSupplementaryImpl mapDialogImpl, Long invokeId)
             throws MAPParsingComponentException {

-        if (parameter == null)
-            throw new MAPParsingComponentException(
- "Error while decoding UnstructuredSSResponseIndication: Parameter is mandatory but not found",
-                    MAPParsingComponentExceptionReason.MistypedParameter);
+        UnstructuredSSResponseImpl ind = new UnstructuredSSResponseImpl();

- if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive())
-            throw new MAPParsingComponentException(
- "Error while decoding UnstructuredSSResponseIndication: Bad tag or tagClass or parameter is primitive, received tag=" - + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter);
+        if (parameter != null) {
+ if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive())
+                throw new MAPParsingComponentException(
+ "Error while decoding UnstructuredSSResponseIndication: Bad tag or tagClass or parameter is primitive, received tag=" + + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter);
+
+            byte[] buf = parameter.getData();
+            AsnInputStream ais = new AsnInputStream(buf);

-        byte[] buf = parameter.getData();
-        AsnInputStream ais = new AsnInputStream(buf);
+            ind.decodeData(ais, buf.length);
+        }

-        UnstructuredSSResponseImpl ind = new UnstructuredSSResponseImpl();
-        ind.decodeData(ais, buf.length);
         ind.setInvokeId(invokeId);
         ind.setMAPDialog(mapDialogImpl);


==============================================================================
Revision: 12b1badb840a
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 14 12:25:13 2013
Log:      Simulator fix: storing config data into "data" folder
http://code.google.com/p/jss7/source/detail?r=12b1badb840a

Modified:
/tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/MainCore.java /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/level1/M3uaMan.java /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/level2/SccpMan.java /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/management/TesterHost.java /tools/simulator/gui/src/main/java/org/mobicents/protocols/ss7/tools/simulatorgui/ConnectionForm.java

=======================================
--- /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/MainCore.java Mon May 20 13:09:00 2013 +++ /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/MainCore.java Wed Aug 14 12:25:13 2013
@@ -22,6 +22,7 @@

 package org.mobicents.protocols.ss7.tools.simulator;

+import java.io.File;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.rmi.registry.LocateRegistry;
@@ -72,11 +73,11 @@
  */
 public class MainCore {

-    public static TesterHost mainGui(String appName) throws Exception {
-        TesterHost host = new TesterHost(appName);
-
-        return host;
-    }
+//    public static TesterHost mainGui(String appName) throws Exception {
+//        TesterHost host = new TesterHost(appName);
+//
+//        return host;
+//    }

     public static void main(String[] args) throws Exception {

@@ -186,7 +187,10 @@
         }

         // Tester host initializing
-        TesterHost host = new TesterHost(appName);
+ String sim_home = System.getProperty(TesterHost.SIMULATOR_HOME_VAR);
+        if (sim_home != null)
+            sim_home += File.separator + "data";
+        TesterHost host = new TesterHost(appName, sim_home);

         JMXConnectorServer cs = null;
         Registry reg = null;
=======================================
--- /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/level1/M3uaMan.java Mon May 20 13:09:00 2013 +++ /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/level1/M3uaMan.java Wed Aug 14 12:25:13 2013
@@ -393,14 +393,12 @@
         try {
             this.isSctpConnectionUp = false;
             this.isM3uaConnectionActive = false;
- this.initM3ua(this.testerHost.getConfigurationData().getM3uaConfigurationData().getStorePcapTrace(), - this.testerHost.getConfigurationData().getM3uaConfigurationData().getIsSctpServer(), this.testerHost - .getConfigurationData().getM3uaConfigurationData().getLocalHost(), this.testerHost - .getConfigurationData().getM3uaConfigurationData().getLocalPort(), this.testerHost - .getConfigurationData().getM3uaConfigurationData().getRemoteHost(), this.testerHost - .getConfigurationData().getM3uaConfigurationData().getRemotePort(), this.testerHost - .getConfigurationData().getM3uaConfigurationData().getIpChannelType(), this.testerHost
-                            
.getConfigurationData().getM3uaConfigurationData().getSctpExtraHostAddressesArray());
+ this.initM3ua(this.testerHost.getConfigurationData().getM3uaConfigurationData().getStorePcapTrace(), this.testerHost.getConfigurationData() + .getM3uaConfigurationData().getIsSctpServer(), this.testerHost.getConfigurationData().getM3uaConfigurationData().getLocalHost(), + this.testerHost.getConfigurationData().getM3uaConfigurationData().getLocalPort(), this.testerHost.getConfigurationData() + .getM3uaConfigurationData().getRemoteHost(), this.testerHost.getConfigurationData().getM3uaConfigurationData().getRemotePort(), + this.testerHost.getConfigurationData().getM3uaConfigurationData().getIpChannelType(), this.testerHost.getConfigurationData() + .getM3uaConfigurationData().getSctpExtraHostAddressesArray(), this.testerHost.getPersistDir()); this.testerHost.sendNotif(SOURCE_NAME, "M3UA has been started", "", Level.INFO);
             return true;
         } catch (Throwable e) {
@@ -452,13 +450,14 @@
     }

private void initM3ua(boolean storePcapTrace, boolean isSctpServer, String localHost, int localPort, String remoteHost, - int remotePort, IpChannelType ipChannelType, String[] extraHostAddresses) throws Exception { + int remotePort, IpChannelType ipChannelType, String[] extraHostAddresses, String persistDir) throws Exception {

         this.stopM3ua();

         // init SCTP stack
         this.sctpManagement = new ManagementImpl("SimSCTPServer_" + name);
         // set 8 threads for delivering messages
+        this.sctpManagement.setPersistDir(persistDir);
         this.sctpManagement.setWorkerThreads(8);
         this.sctpManagement.setSingleThread(false);
         this.sctpManagement.setConnectDelay(10000);
@@ -469,6 +468,7 @@

         // init M3UA stack
this.m3uaMgmt = new M3UAManagementProxyImpl("SimM3uaServer_" + name);
+        this.m3uaMgmt.setPersistDir(persistDir);
         this.m3uaMgmt.setTransportManagement(this.sctpManagement);
         this.m3uaMgmt.start();
         this.m3uaMgmt.removeAllResourses();
=======================================
--- /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/level2/SccpMan.java Mon May 20 13:09:00 2013 +++ /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/level2/SccpMan.java Wed Aug 14 12:25:13 2013
@@ -275,7 +275,7 @@
.getConfigurationData().getSccpConfigurationData().getRemoteSpc(), this.testerHost .getConfigurationData().getSccpConfigurationData().getLocalSpc(), this.testerHost .getConfigurationData().getSccpConfigurationData().getNi(), this.testerHost.getConfigurationData()
-                            
.getSccpConfigurationData().getCallingPartyAddressDigits());
+ .getSccpConfigurationData().getCallingPartyAddressDigits(), this.testerHost.getPersistDir()); this.testerHost.sendNotif(SOURCE_NAME, "SCCP has been started", "", Level.INFO);
             return true;
         } catch (Throwable e) {
@@ -320,10 +320,11 @@
         }
     }

- private void initSccp(Mtp3UserPart mtp3UserPart, int remoteSsn, int localSsn, int dpc, int opc, int ni,
-            String callingPartyAddressDigits) throws Exception {
+ private void initSccp(Mtp3UserPart mtp3UserPart, int remoteSsn, int localSsn, int dpc, int opc, int ni, String callingPartyAddressDigits, String persistDir)
+            throws Exception {

         this.sccpStack = new SccpStackImpl("TestingSccp");
+        this.sccpStack.setPersistDir(persistDir);

         this.sccpStack.setMtp3UserPart(1, mtp3UserPart);
         this.sccpStack.start();
=======================================
--- /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/management/TesterHost.java Mon May 20 13:09:00 2013 +++ /tools/simulator/core/src/main/java/org/mobicents/protocols/ss7/tools/simulator/management/TesterHost.java Wed Aug 14 12:25:13 2013
@@ -89,6 +89,8 @@
     private static final String PERSIST_FILE_NAME = "simulator2.xml";
     private static final String CONFIGURATION_DATA = "configurationData";

+    public static String SIMULATOR_HOME_VAR = "SIMULATOR_HOME";
+
     private final String appName;
     private String persistDir = null;
     private final TextBuilder persistFile = TextBuilder.newInstance();
@@ -122,8 +124,9 @@

     // testers

-    public TesterHost(String appName) {
+    public TesterHost(String appName, String persistDir) {
         this.appName = appName;
+        this.persistDir = persistDir;

         this.m3ua = new M3uaMan(appName);
         this.m3ua.setTesterHost(this);
@@ -694,9 +697,9 @@
         return persistDir;
     }

-    public void setPersistDir(String persistDir) {
-        this.persistDir = persistDir;
-    }
+//    public void setPersistDir(String persistDir) {
+//        this.persistDir = persistDir;
+//    }

     public void markStore() {
         needStore = true;
=======================================
--- /tools/simulator/gui/src/main/java/org/mobicents/protocols/ss7/tools/simulatorgui/ConnectionForm.java Mon May 20 13:09:00 2013 +++ /tools/simulator/gui/src/main/java/org/mobicents/protocols/ss7/tools/simulatorgui/ConnectionForm.java Wed Aug 14 12:25:13 2013
@@ -28,6 +28,7 @@
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
 import java.io.PrintWriter;

 import javax.management.JMX;
@@ -162,7 +163,11 @@

     private void startLocal(String appName) {
         // creating a testerHost
-        TesterHost host = new TesterHost(appName);
+
+        String sim_home = System.getenv(TesterHost.SIMULATOR_HOME_VAR);
+        if (sim_home != null)
+            sim_home += File.separator + "data";
+        TesterHost host = new TesterHost(appName, sim_home);

         // starting the main form
         SimulatorGuiForm frame = new SimulatorGuiForm();

==============================================================================
Revision: 1ff1bbc4ef6c
Author:   Sergey Vetyutnev <[email protected]>
Date:     Wed Aug 14 12:54:58 2013
Log:      Adding "Statistics" project
http://code.google.com/p/jss7/source/detail?r=1ff1bbc4ef6c

Added:
 /statistics/pom.xml
/statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatCounterCollection.java /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollection.java /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollector.java /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollectorMax.java /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollectorMin.java /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollectorType.java /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StringLongMap.java
Modified:
 /pom.xml
 /tools/simulator/bootstrap/src/main/assembly/descriptor.xml
 /tools/simulator/pom.xml

=======================================
--- /dev/null
+++ /statistics/pom.xml Wed Aug 14 12:54:58 2013
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+       <packaging>jar</packaging>
+
+       <parent>
+               <artifactId>ss7-parent</artifactId>
+               <groupId>org.mobicents.protocols.ss7</groupId>
+               <version>2.1.0-SNAPSHOT</version>
+       </parent>
+
+       <groupId>org.mobicents.protocols.ss7.statistics</groupId>
+       <artifactId>statistics</artifactId>
+       <name>Mobicents SS7 :: Statistics :: ${pom.artifactId}</name>
+
+       <dependencies>
+               <dependency>
+                       <groupId>javolution</groupId>
+                       <artifactId>javolution</artifactId>
+               </dependency>
+       </dependencies>
+
+       <!-- -->
+       <build>
+               <plugins>
+                       <plugin>
+                               <artifactId>maven-eclipse-plugin</artifactId>
+                               <groupId>org.mobicents.tools</groupId>
+                               <version>
+                                       
${mobicents.tools.mavenplugin.eclipse.version}
+                               </version>
+                               <inherited>false</inherited>
+                               <executions />
+                               <configuration>
+                                       <classpathExcludes>
+                                               
<exclude>xml-apis:xml-apis</exclude>
+                                               <exclude>jtidy:jtidy</exclude>
+                                       </classpathExcludes>
+                                       <resolveTransitiveDependencies>
+                                               true
+                                       </resolveTransitiveDependencies>
+                                       <eclipseProjectName>
+                                               statistics
+                                       </eclipseProjectName>
+                               </configuration>
+                       </plugin>
+               </plugins>
+               <finalName>mobicents-statistics-${pom.version}</finalName>
+       </build>
+
+</project>
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatCounterCollection.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,92 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import javolution.util.FastMap;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public class StatCounterCollection {
+
+    private String name;
+    private StatDataCollectorType type;
+ private FastMap<String, StatDataCollector> coll = new FastMap<String, StatDataCollector>();
+
+    public StatCounterCollection(String name, StatDataCollectorType type) {
+        this.name = name;
+        this.type = type;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void clearDeadCampaignes(Date lastTime) {
+        ArrayList<String> toDel = new ArrayList<String>();
+        for (String s : coll.keySet()) {
+            StatDataCollector d = coll.get(s);
+            if (d.getSessionStartTime().before(lastTime)) {
+                toDel.add(s);
+            }
+        }
+        for (String s : toDel) {
+            coll.remove(s);
+        }
+    }
+
+    public Long restartAndGet(String campaignName, Long newVal) {
+        StatDataCollector sdc = coll.get(campaignName);
+        if (sdc != null) {
+            return sdc.restartAndGet();
+        } else {
+            switch (type) {
+            case MIN:
+                sdc = new StatDataCollectorMin(campaignName);
+                break;
+            case MAX:
+                sdc = new StatDataCollectorMax(campaignName);
+                break;
+            }
+            if (sdc != null) {
+                coll.put(campaignName, sdc);
+                if (newVal != null)
+                    sdc.updateData(newVal);
+            }
+            return null;
+        }
+    }
+
+    public void updateData(long newVal) {
+        for (String s : coll.keySet()) {
+            StatDataCollector d = coll.get(s);
+            d.updateData(newVal);
+        }
+    }
+
+}
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollection.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,91 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+import java.util.Date;
+
+import javolution.util.FastMap;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public class StatDataCollection {
+
+ private FastMap<String, StatCounterCollection> coll = new FastMap<String, StatCounterCollection>();
+
+ public StatCounterCollection registerStatCounterCollector(String counterName, StatDataCollectorType type) {
+        synchronized (this) {
+ StatCounterCollection c = new StatCounterCollection(counterName, type);
+            coll.put(counterName, c);
+            return c;
+        }
+    }
+
+// public StatCounterCollection getStatCounterCollection(String counterName) {
+//        synchronized (this) {
+//            StatCounterCollection scc = coll.get(counterName);
+//            return scc;
+//        }
+//    }
+
+// public StatDataCollector getStatDateCollector(String counterName, String campaignName) {
+//        synchronized (this) {
+//            StatCounterCollection scc = coll.get(counterName);
+//            if (scc == null)
+//                return null;
+//
+//            return scc.getStatDataCollector(campaignName);
+//        }
+//    }
+
+    public void clearDeadCampaignes(Date lastTime) {
+        synchronized (this) {
+            for (String s : coll.keySet()) {
+                StatCounterCollection d = coll.get(s);
+                d.clearDeadCampaignes(lastTime);
+            }
+        }
+    }
+
+ public Long restartAndGet(String counterName, String campaignName, Long newVal) {
+        synchronized (this) {
+            StatCounterCollection scc = this.coll.get(counterName);
+            if (scc != null) {
+                return scc.restartAndGet(campaignName, newVal);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    public void updateData(String counterName, long newVal) {
+        synchronized (this) {
+            StatCounterCollection scc = this.coll.get(counterName);
+            if (scc != null) {
+                scc.updateData(newVal);
+            }
+        }
+    }
+}
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollector.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,62 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+import java.util.Date;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public abstract class StatDataCollector {
+
+    private String name;
+    protected long val;
+    private Date sessionStartTime = new Date();
+
+    public StatDataCollector(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Date getSessionStartTime() {
+        return sessionStartTime;
+    }
+
+    public long restartAndGet() {
+        long res = val;
+        this.sessionStartTime = new Date();
+        return res;
+    }
+
+    protected abstract void reset();
+
+    public abstract void updateData(long newVal);
+
+    public abstract StatDataCollectorType getStatDataCollectorType();
+
+}
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollectorMax.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,52 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public class StatDataCollectorMax extends StatDataCollector {
+
+    public StatDataCollectorMax(String name) {
+        super(name);
+    }
+
+    @Override
+    protected void reset() {
+        val = Long.MIN_VALUE;
+    }
+
+    @Override
+    public void updateData(long newVal) {
+        if (val < newVal)
+            val = newVal;
+    }
+
+    @Override
+    public StatDataCollectorType getStatDataCollectorType() {
+        return StatDataCollectorType.MAX;
+    }
+
+}
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollectorMin.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,52 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public class StatDataCollectorMin extends StatDataCollector {
+
+    public StatDataCollectorMin(String name) {
+        super(name);
+    }
+
+    @Override
+    protected void reset() {
+        val = Long.MAX_VALUE;
+    }
+
+    @Override
+    public void updateData(long newVal) {
+        if (val > newVal)
+            val = newVal;
+    }
+
+    @Override
+    public StatDataCollectorType getStatDataCollectorType() {
+        return StatDataCollectorType.MIN;
+    }
+
+}
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StatDataCollectorType.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,34 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public enum StatDataCollectorType {
+
+    MIN, MAX;
+
+}
=======================================
--- /dev/null
+++ /statistics/src/main/java/org/mobicents/protocols/ss7/statistics/StringLongMap.java Wed Aug 14 12:54:58 2013
@@ -0,0 +1,57 @@
+/*
+ * TeleStax, Open Source Cloud Communications  Copyright 2012.
+ * and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.protocols.ss7.statistics;
+
+import java.util.Map;
+
+import javolution.util.FastMap;
+
+/**
+*
+* @author sergey vetyutnev
+*
+*/
+public class StringLongMap {
+
+    private FastMap<String, Long> data = new FastMap<String, Long>();
+
+    public Map<String, Long> restartAndGet() {
+        synchronized (this) {
+            FastMap<String, Long> res = this.data;
+            this.data = new FastMap<String, Long>();
+            return res;
+        }
+    }
+
+    public void updateData(String name) {
+        synchronized (this) {
+            Long val = data.get(name);
+            if (val == null) {
+                val = 0L;
+                data.put(name, val);
+            }
+            val++;
+        }
+    }
+
+}
=======================================
--- /pom.xml    Sun Jul 21 01:40:16 2013
+++ /pom.xml    Wed Aug 14 12:54:58 2013
@@ -40,14 +40,15 @@
                <module>docs</module>
                <module>scheduler</module>
                <module>congestion</module>
+               <module>statistics</module>
                <module>management</module>
                <module>mtp</module>
                <module>m3ua</module>
                <module>hardware</module>
                <module>isup</module>
                <module>sccp</module>
-               <module>tcap</module>
-               <module>tcap-ansi</module>
+        <module>tcap</module>
+        <module>tcap-ansi</module>
                <module>map</module>
                <module>inap</module>
                <module>cap</module>
@@ -281,6 +282,11 @@
                                <artifactId>congestion</artifactId>
                                <version>${pom.version}</version>
                        </dependency>
+                       <dependency>
+                               
<groupId>org.mobicents.protocols.ss7.statistics</groupId>
+                               <artifactId>statistics</artifactId>
+                               <version>${pom.version}</version>
+                       </dependency>
                </dependencies>
        </dependencyManagement>

=======================================
--- /tools/simulator/bootstrap/src/main/assembly/descriptor.xml Mon Jan 28 23:37:54 2013 +++ /tools/simulator/bootstrap/src/main/assembly/descriptor.xml Wed Aug 14 12:54:58 2013
@@ -42,7 +42,7 @@
                                
<include>org.mobicents.protocols.asn:asn</include>

                                <!-- SS7 Libraries -->
-                               
<include>org.mobicents.protocols.ss7.sccp:sccp-api</include>
+ <include>org.mobicents.protocols.ss7.sccp:sccp-api</include>
                                
<include>org.mobicents.protocols.ss7.sccp:sccp-impl</include>
                                
<include>org.mobicents.protocols.ss7.tcap:tcap-api</include>
                                
<include>org.mobicents.protocols.ss7.tcap:tcap-impl</include>
@@ -61,6 +61,7 @@
<!-- <include>org.mobicents.protocols.ss7.hardware:mobicents-dahdi</include> --> <include>org.mobicents.protocols.ss7.hardware:mobicents-dialogic</include>
                                
<include>org.mobicents.protocols.ss7.congestion:congestion</include>
+ <include>org.mobicents.protocols.ss7.statistics:statistics</include>

                        </includes>
                </dependencySet>
=======================================
--- /tools/simulator/pom.xml    Thu Jun 20 08:10:49 2013
+++ /tools/simulator/pom.xml    Wed Aug 14 12:54:58 2013
@@ -36,6 +36,10 @@
                        <artifactId>asn</artifactId>
                </dependency>
                <dependency>
+                       
<groupId>org.mobicents.protocols.ss7.statistics</groupId>
+                       <artifactId>statistics</artifactId>
+               </dependency>
+               <dependency>
                        <groupId>org.mobicents.protocols.ss7.sccp</groupId>
                        <artifactId>sccp-api</artifactId>
                </dependency>

==============================================================================
Revision: 2ca4d1959fb1
Author:   Sergey Vetyutnev <[email protected]>
Date:     Thu Aug 15 07:32:26 2013
Log:      Merge remote-tracking branch 'origin/cap42'
http://code.google.com/p/jss7/source/detail?r=2ca4d1959fb1


--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to