StatisticsJMXResource.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */


  20. package org.openspcoop2.pdd.core.jmx;


  21. import java.text.SimpleDateFormat;
  22. import java.util.Date;
  23. import java.util.Iterator;

  24. import javax.management.Attribute;
  25. import javax.management.AttributeList;
  26. import javax.management.AttributeNotFoundException;
  27. import javax.management.DynamicMBean;
  28. import javax.management.InvalidAttributeValueException;
  29. import javax.management.JMException;
  30. import javax.management.MBeanAttributeInfo;
  31. import javax.management.MBeanConstructorInfo;
  32. import javax.management.MBeanException;
  33. import javax.management.MBeanInfo;
  34. import javax.management.MBeanOperationInfo;
  35. import javax.management.NotificationBroadcasterSupport;
  36. import javax.management.ReflectionException;

  37. import org.openspcoop2.pdd.core.handlers.statistics.StatisticsCollection;
  38. import org.openspcoop2.utils.Utilities;
  39. import org.openspcoop2.utils.date.DateManager;
  40. import org.openspcoop2.utils.date.DateUtils;


  41. /**
  42.  * Implementazione JMX per la gestione dell'autorizzazione
  43.  *  
  44.  * @author Poli Andrea (apoli@link.it)
  45.  * @author $Author$
  46.  * @version $Rev$, $Date$
  47.  */
  48. public class StatisticsJMXResource extends NotificationBroadcasterSupport implements DynamicMBean {

  49.     /** Nomi proprieta' */
  50.     public static final String INTERVALLO_STATISTICO = "Intervallo Temporale dei dati Statistici";
  51.    
  52.     public static final String NUMERO_TRANSAZIONI = "Numero transazioni PdD";
  53.     public static final String TXT_NUMERO_TRANSAZIONI = "Numero di transazioni (totale/ok/inErrore) gestite dalla PdD";
  54.    
  55.     public static final String NUMERO_TRANSAZIONI_PD = "Numero transazioni PortaDelegata";
  56.     public static final String TXT_NUMERO_TRANSAZIONI_PD = "Numero di transazioni (totale/ok/inErrore) gestite sulla PortaDelegata";
  57.    
  58.     public static final String NUMERO_TRANSAZIONI_PA = "Numero transazioni PortaApplicativa";
  59.     public static final String TXT_NUMERO_TRANSAZIONI_PA = "Numero di transazioni (totale/ok/inErrore) gestite sulla PortaApplicativa";
  60.    
  61.     public static final String LATENZA_ATTRAVERSAMENTO = "Tempo attraversamento PdD";
  62.     public static final String TXT_LATENZA_ATTRAVERSAMENTO = "Tempo di attraversamento (min/avg/max) della PdD";
  63.     public static final String LATENZA_ATTRAVERSAMENTO_REQUEST =
  64.         "Tempo attraversamento richieste";
  65.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_REQUEST =
  66.         "Tempo di attraversamento (min/avg/max) della PdD per i messaggi di richiesta";
  67.     public static final String LATENZA_ATTRAVERSAMENTO_RESPONSE =
  68.         "Tempo attraversamento risposte";
  69.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_RESPONSE =
  70.         "Tempo di attraversamento (min/avg/max) della PdD per i messaggi di risposta";
  71.    
  72.     public static final String LATENZA_ATTRAVERSAMENTO_PD = "Tempo attraversamento PortaDelegata";
  73.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_PD = "Tempo di attraversamento (min/avg/max) della PortaDelegata";
  74.     public static final String LATENZA_ATTRAVERSAMENTO_PD_REQUEST =
  75.         "Tempo attraversamento richieste sulla PortaDelegata";
  76.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_PD_REQUEST =
  77.         "Tempo di attraversamento (min/avg/max) della PortaDelegata per i messaggi di richiesta";
  78.     public static final String LATENZA_ATTRAVERSAMENTO_PD_RESPONSE =
  79.         "Tempo attraversamento risposte sulla PortaDelegata";
  80.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_PD_RESPONSE =
  81.         "Tempo di attraversamento (min/avg/max) della PortaDelegata per i messaggi di risposta";
  82.    
  83.     public static final String LATENZA_ATTRAVERSAMENTO_PA = "Tempo attraversamento PortaApplicativa";
  84.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_PA = "Tempo di attraversamento (min/avg/max) della PortaApplicativa";
  85.     public static final String LATENZA_ATTRAVERSAMENTO_PA_REQUEST =
  86.         "Tempo attraversamento richieste sulla PortaApplicativa";
  87.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_PA_REQUEST =
  88.         "Tempo di attraversamento (min/avg/max) della PortaApplicativa per i messaggi di richiesta";
  89.     public static final String LATENZA_ATTRAVERSAMENTO_PA_RESPONSE =
  90.         "Tempo attraversamento risposte sulla PortaApplicativa";
  91.     public static final String TXT_LATENZA_ATTRAVERSAMENTO_PA_RESPONSE =
  92.         "Tempo di attraversamento (min/avg/max) della PortaApplicativa per i messaggi di risposta";
  93.    
  94.     public static final String DIMENSIONE_MESSAGGI = "Dimensione messaggi PdD";
  95.     public static final String DIMENSIONE_MESSAGGI_IN_REQUEST = "Dimensione richieste in ingresso sulla PdD";
  96.     public static final String DIMENSIONE_MESSAGGI_OUT_REQUEST = "Dimensione richieste in uscita dalla PdD";
  97.     public static final String DIMENSIONE_MESSAGGI_IN_RESPONSE = "Dimensione risposte in ingresso sulla PdD";
  98.     public static final String DIMENSIONE_MESSAGGI_OUT_RESPONSE = "Dimensione risposte in uscita dalla PdD";
  99.     public static final String TXT_DIMENSIONE_MESSAGGI = "Dimensione dei messaggi (min/avg/max) gestiti dalla PdD";
  100.     public static final String TXT_DIMENSIONE_MESSAGGI_IN_REQUEST = "Dimensione dei messaggi di richiesta (min/avg/max) in ingresso sulla PdD";
  101.     public static final String TXT_DIMENSIONE_MESSAGGI_OUT_REQUEST = "Dimensione dei messaggi di richiesta (min/avg/max) in uscita dalla PdD";
  102.     public static final String TXT_DIMENSIONE_MESSAGGI_IN_RESPONSE = "Dimensione dei messaggi di risposta (min/avg/max) in ingresso sulla PdD";
  103.     public static final String TXT_DIMENSIONE_MESSAGGI_OUT_RESPONSE = "Dimensione dei messaggi di risposta (min/avg/max) in uscita dalla PdD";
  104.    
  105.     public static final String DIMENSIONE_MESSAGGI_PD = "Dimensione messaggi PortaDelegata";
  106.     public static final String DIMENSIONE_MESSAGGI_PD_IN_REQUEST = "Dimensione richieste in ingresso sulla PortaDelegata";
  107.     public static final String DIMENSIONE_MESSAGGI_PD_OUT_REQUEST = "Dimensione richieste in uscita dalla PortaDelegata";
  108.     public static final String DIMENSIONE_MESSAGGI_PD_IN_RESPONSE = "Dimensione risposte in ingresso sulla PortaDelegata";
  109.     public static final String DIMENSIONE_MESSAGGI_PD_OUT_RESPONSE = "Dimensione risposte in uscita dalla PortaDelegata";
  110.     public static final String TXT_DIMENSIONE_MESSAGGI_PD = "Dimensione dei messaggi (min/avg/max) gestiti dalla PortaDelegata";
  111.     public static final String TXT_DIMENSIONE_MESSAGGI_PD_IN_REQUEST = "Dimensione dei messaggi di richiesta (min/avg/max) in ingresso sulla PortaDelegata";
  112.     public static final String TXT_DIMENSIONE_MESSAGGI_PD_OUT_REQUEST = "Dimensione dei messaggi di richiesta (min/avg/max) in uscita dalla PortaDelegata";
  113.     public static final String TXT_DIMENSIONE_MESSAGGI_PD_IN_RESPONSE = "Dimensione dei messaggi di risposta (min/avg/max) in ingresso sulla PortaDelegata";
  114.     public static final String TXT_DIMENSIONE_MESSAGGI_PD_OUT_RESPONSE = "Dimensione dei messaggi di risposta (min/avg/max) in uscita dalla PortaDelegata";
  115.        
  116.     public static final String DIMENSIONE_MESSAGGI_PA = "Dimensione messaggi PortaApplicativa";
  117.     public static final String DIMENSIONE_MESSAGGI_PA_IN_REQUEST = "Dimensione richieste in ingresso sulla PortaApplicativa";
  118.     public static final String DIMENSIONE_MESSAGGI_PA_OUT_REQUEST = "Dimensione richieste in uscita dalla PortaApplicativa";
  119.     public static final String DIMENSIONE_MESSAGGI_PA_IN_RESPONSE = "Dimensione risposte in ingresso sulla PortaApplicativa";
  120.     public static final String DIMENSIONE_MESSAGGI_PA_OUT_RESPONSE = "Dimensione risposte in uscita dalla PortaApplicativa";
  121.     public static final String TXT_DIMENSIONE_MESSAGGI_PA = "Dimensione dei messaggi (min/avg/max) gestiti dalla PortaApplicativa";
  122.     public static final String TXT_DIMENSIONE_MESSAGGI_PA_IN_REQUEST = "Dimensione dei messaggi di richiesta (min/avg/max) in ingresso sulla PortaApplicativa";
  123.     public static final String TXT_DIMENSIONE_MESSAGGI_PA_OUT_REQUEST = "Dimensione dei messaggi di richiesta (min/avg/max) in uscita dalla PortaApplicativa";
  124.     public static final String TXT_DIMENSIONE_MESSAGGI_PA_IN_RESPONSE = "Dimensione dei messaggi di risposta (min/avg/max) in ingresso sulla PortaApplicativa";
  125.     public static final String TXT_DIMENSIONE_MESSAGGI_PA_OUT_RESPONSE = "Dimensione dei messaggi di risposta (min/avg/max) in uscita dalla PortaApplicativa";
  126.    
  127.    
  128.     /** Nomi metodi */
  129.     public static final String REFRESH = "refresh";
  130.     public static final String RESET = "reset";
  131.    


  132.     /** Attributi */
  133.     private String intervallo_statistico = "";
  134.     private String numero_transazioni = "";
  135.     private String numero_transazioni_pd = "";
  136.     private String numero_transazioni_pa = "";
  137.     private String latenza_attraversamento = "";
  138.     private String latenza_attraversamento_request = "";
  139.     private String latenza_attraversamento_response = "";
  140.     private String latenza_attraversamento_pd = "";
  141.     private String latenza_attraversamento_pd_request = "";
  142.     private String latenza_attraversamento_pd_response = "";
  143.     private String latenza_attraversamento_pa = "";
  144.     private String latenza_attraversamento_pa_request = "";
  145.     private String latenza_attraversamento_pa_response = "";
  146.     private String dimensione_messaggi = "";
  147.     private String dimensione_messaggi_in_request = "";
  148.     private String dimensione_messaggi_out_request = "";
  149.     private String dimensione_messaggi_in_response = "";
  150.     private String dimensione_messaggi_out_response = "";
  151.     private String dimensione_messaggi_pd = "";
  152.     private String dimensione_messaggi_pd_in_request = "";
  153.     private String dimensione_messaggi_pd_out_request = "";
  154.     private String dimensione_messaggi_pd_in_response = "";
  155.     private String dimensione_messaggi_pd_out_response = "";    
  156.     private String dimensione_messaggi_pa = "";
  157.     private String dimensione_messaggi_pa_in_request = "";
  158.     private String dimensione_messaggi_pa_out_request = "";
  159.     private String dimensione_messaggi_pa_in_response = "";
  160.     private String dimensione_messaggi_pa_out_response = "";
  161.    
  162.    
  163.     /** getAttribute */
  164.     @Override
  165.     public Object getAttribute(String attributeName) throws AttributeNotFoundException,MBeanException,ReflectionException{

  166.         if( (attributeName==null) || (attributeName.equals("")) )
  167.             throw new IllegalArgumentException("Il nome dell'attributo e' nullo o vuoto");

  168.         if(attributeName.equals(StatisticsJMXResource.INTERVALLO_STATISTICO))
  169.             return this.intervallo_statistico;
  170.        
  171.         else if(attributeName.equals(StatisticsJMXResource.NUMERO_TRANSAZIONI))
  172.             return this.numero_transazioni;
  173.         else if(attributeName.equals(StatisticsJMXResource.NUMERO_TRANSAZIONI_PD))
  174.             return this.numero_transazioni_pd;
  175.         else if(attributeName.equals(StatisticsJMXResource.NUMERO_TRANSAZIONI_PA))
  176.             return this.numero_transazioni_pa;
  177.        
  178.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO))
  179.             return this.latenza_attraversamento;
  180.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_REQUEST))
  181.             return this.latenza_attraversamento_request;
  182.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_RESPONSE))
  183.             return this.latenza_attraversamento_response;
  184.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD))
  185.             return this.latenza_attraversamento_pd;
  186.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD_REQUEST))
  187.             return this.latenza_attraversamento_pd_request;
  188.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD_RESPONSE))
  189.             return this.latenza_attraversamento_pd_response;
  190.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA))
  191.             return this.latenza_attraversamento_pa;
  192.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA_REQUEST))
  193.             return this.latenza_attraversamento_pa_request;
  194.         else if(attributeName.equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA_RESPONSE))
  195.             return this.latenza_attraversamento_pa_response;

  196.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI))
  197.             return this.dimensione_messaggi;
  198.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_IN_REQUEST))
  199.             return this.dimensione_messaggi_in_request;
  200.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_OUT_REQUEST))
  201.             return this.dimensione_messaggi_out_request;
  202.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_IN_RESPONSE))
  203.             return this.dimensione_messaggi_in_response;
  204.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_OUT_RESPONSE))
  205.             return this.dimensione_messaggi_out_response;
  206.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD))
  207.             return this.dimensione_messaggi_pd;
  208.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_IN_REQUEST))
  209.             return this.dimensione_messaggi_pd_in_request;
  210.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_OUT_REQUEST))
  211.             return this.dimensione_messaggi_pd_out_request;
  212.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_IN_RESPONSE))
  213.             return this.dimensione_messaggi_pd_in_response;
  214.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_OUT_RESPONSE))
  215.             return this.dimensione_messaggi_pd_out_response;
  216.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA))
  217.             return this.dimensione_messaggi_pa;
  218.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_IN_REQUEST))
  219.             return this.dimensione_messaggi_pa_in_request;
  220.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_OUT_REQUEST))
  221.             return this.dimensione_messaggi_pa_out_request;
  222.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_IN_RESPONSE))
  223.             return this.dimensione_messaggi_pa_in_response;
  224.         else if(attributeName.equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_OUT_RESPONSE))
  225.             return this.dimensione_messaggi_pa_out_response;
  226.        
  227.         throw new AttributeNotFoundException("Attributo "+attributeName+" non trovato");
  228.     }

  229.     /** getAttributes */
  230.     @Override
  231.     public AttributeList getAttributes(String [] attributesNames){

  232.         if(attributesNames==null)
  233.             throw new IllegalArgumentException("Array nullo");

  234.         AttributeList list = new AttributeList();
  235.         for (int i=0; i<attributesNames.length; i++){
  236.             try{
  237.                 list.add(new Attribute(attributesNames[i],getAttribute(attributesNames[i])));
  238.             }catch(JMException ex){}
  239.         }
  240.         return list;
  241.     }

  242.     /** setAttribute */
  243.     @Override
  244.     public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException{

  245.         if( attribute==null )
  246.             throw new IllegalArgumentException("Il nome dell'attributo e' nullo");

  247.         try{

  248.             if(attribute.getName().equals(StatisticsJMXResource.INTERVALLO_STATISTICO)){
  249.                 // nothing DO
  250.             }
  251.            
  252.             else if(attribute.getName().equals(StatisticsJMXResource.NUMERO_TRANSAZIONI)){
  253.                 // nothing DO
  254.             }
  255.             else if(attribute.getName().equals(StatisticsJMXResource.NUMERO_TRANSAZIONI_PD)){
  256.                 // nothing DO
  257.             }
  258.             else if(attribute.getName().equals(StatisticsJMXResource.NUMERO_TRANSAZIONI_PA)){
  259.                 // nothing DO
  260.             }
  261.            
  262.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO)){
  263.                 // nothing DO
  264.             }
  265.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_REQUEST)){
  266.                 // nothing DO
  267.             }
  268.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_RESPONSE)){
  269.                 // nothing DO
  270.             }
  271.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD)){
  272.                 // nothing DO
  273.             }
  274.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD_REQUEST)){
  275.                 // nothing DO
  276.             }
  277.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD_RESPONSE)){
  278.                 // nothing DO
  279.             }
  280.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA)){
  281.                 // nothing DO
  282.             }
  283.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA_REQUEST)){
  284.                 // nothing DO
  285.             }
  286.             else if(attribute.getName().equals(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA_RESPONSE)){
  287.                 // nothing DO
  288.             }

  289.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI)){
  290.                 // nothing DO
  291.             }
  292.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_IN_REQUEST)){
  293.                 // nothing DO
  294.             }
  295.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_OUT_REQUEST)){
  296.                 // nothing DO
  297.             }
  298.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_IN_RESPONSE)){
  299.                 // nothing DO
  300.             }
  301.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_OUT_RESPONSE)){
  302.                 // nothing DO
  303.             }
  304.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD)){
  305.                 // nothing DO
  306.             }
  307.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_IN_REQUEST)){
  308.                 // nothing DO
  309.             }
  310.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_OUT_REQUEST)){
  311.                 // nothing DO
  312.             }
  313.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_IN_RESPONSE)){
  314.                 // nothing DO
  315.             }
  316.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_OUT_RESPONSE)){
  317.                 // nothing DO
  318.             }
  319.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA)){
  320.                 // nothing DO
  321.             }
  322.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_IN_REQUEST)){
  323.                 // nothing DO
  324.             }
  325.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_OUT_REQUEST)){
  326.                 // nothing DO
  327.             }
  328.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_IN_RESPONSE)){
  329.                 // nothing DO
  330.             }
  331.             else if(attribute.getName().equals(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_OUT_RESPONSE)){
  332.                 // nothing DO
  333.             }
  334.            
  335.             else
  336.                 throw new AttributeNotFoundException("Attributo "+attribute.getName()+" non trovato");

  337.         }catch(ClassCastException ce){
  338.             throw new InvalidAttributeValueException("il tipo "+attribute.getValue().getClass()+" dell'attributo "+attribute.getName()+" non e' valido");
  339.         }catch(JMException j){
  340.             throw new MBeanException(j);
  341.         }

  342.     }

  343.     /** setAttributes */
  344.     @Override
  345.     public AttributeList setAttributes(AttributeList list){

  346.         if(list==null)
  347.             throw new IllegalArgumentException("Lista degli attributi e' nulla");

  348.         AttributeList ret = new AttributeList();
  349.         Iterator<?> it = ret.iterator();

  350.         while(it.hasNext()){
  351.             try{
  352.                 Attribute attribute = (Attribute) it.next();
  353.                 setAttribute(attribute);
  354.                 ret.add(attribute);
  355.             }catch(JMException ex){}
  356.         }

  357.         return ret;

  358.     }

  359.     /** invoke */
  360.     @Override
  361.     public Object invoke(String actionName, Object[]params, String[]signature) throws MBeanException,ReflectionException{

  362.         if( (actionName==null) || (actionName.equals("")) )
  363.             throw new IllegalArgumentException("Nessuna operazione definita");

  364.         if(actionName.equals(StatisticsJMXResource.REFRESH)){
  365.             return this.refresh();
  366.         }
  367.         else if(actionName.equals(StatisticsJMXResource.RESET)){
  368.             return this.reset();
  369.         }
  370.        
  371.         throw new UnsupportedOperationException("Operazione "+actionName+" sconosciuta");
  372.     }

  373.    
  374.     /* MBean info */
  375.     @Override
  376.     public MBeanInfo getMBeanInfo(){

  377.         // Descrizione della classe nel MBean
  378.         String className = this.getClass().getName();
  379.         String description = "Stato dei servizi attivi";

  380.         // MetaData per gli attributi
  381.         MBeanAttributeInfo intervalloStatistico_VAR
  382.             = new MBeanAttributeInfo(StatisticsJMXResource.INTERVALLO_STATISTICO,String.class.getName(),
  383.                 "Intervallo temporale a cui si riferisce il rilevamento statistico",
  384.                 JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);        
  385.        
  386.         MBeanAttributeInfo numeroTransazioni_VAR
  387.             = new MBeanAttributeInfo(StatisticsJMXResource.NUMERO_TRANSAZIONI,String.class.getName(),
  388.                 StatisticsJMXResource.TXT_NUMERO_TRANSAZIONI,
  389.                 JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  390.         MBeanAttributeInfo numeroTransazioniPD_VAR
  391.             = new MBeanAttributeInfo(StatisticsJMXResource.NUMERO_TRANSAZIONI_PD,String.class.getName(),
  392.                     StatisticsJMXResource.TXT_NUMERO_TRANSAZIONI_PD,
  393.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  394.         MBeanAttributeInfo numeroTransazioniPA_VAR
  395.             = new MBeanAttributeInfo(StatisticsJMXResource.NUMERO_TRANSAZIONI_PA,String.class.getName(),
  396.                     StatisticsJMXResource.TXT_NUMERO_TRANSAZIONI_PA,
  397.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  398.        
  399.         MBeanAttributeInfo latenzaAttraversamento_VAR
  400.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO,String.class.getName(),
  401.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO,
  402.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  403.         MBeanAttributeInfo latenzaAttraversamentoRequest_VAR
  404.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_REQUEST,String.class.getName(),
  405.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_REQUEST,
  406.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  407.         MBeanAttributeInfo latenzaAttraversamentoResponse_VAR
  408.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_RESPONSE,String.class.getName(),
  409.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_RESPONSE,
  410.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    

  411.         MBeanAttributeInfo latenzaAttraversamentoPD_VAR
  412.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD,String.class.getName(),
  413.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_PD,
  414.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  415.         MBeanAttributeInfo latenzaAttraversamentoPDRequest_VAR
  416.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD_REQUEST,String.class.getName(),
  417.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_PD_REQUEST,
  418.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  419.         MBeanAttributeInfo latenzaAttraversamentoPDResponse_VAR
  420.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PD_RESPONSE,String.class.getName(),
  421.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_PD_RESPONSE,
  422.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  423.        
  424.         MBeanAttributeInfo latenzaAttraversamentoPA_VAR
  425.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA,String.class.getName(),
  426.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_PA,
  427.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  428.         MBeanAttributeInfo latenzaAttraversamentoPARequest_VAR
  429.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA_REQUEST,String.class.getName(),
  430.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_PA_REQUEST,
  431.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  432.         MBeanAttributeInfo latenzaAttraversamentoPAResponse_VAR
  433.             = new MBeanAttributeInfo(StatisticsJMXResource.LATENZA_ATTRAVERSAMENTO_PA_RESPONSE,String.class.getName(),
  434.                     StatisticsJMXResource.TXT_LATENZA_ATTRAVERSAMENTO_PA_RESPONSE,
  435.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  436.        
  437.         MBeanAttributeInfo dimensioneMessaggi_VAR
  438.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI,String.class.getName(),
  439.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI,
  440.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  441.         MBeanAttributeInfo dimensioneMessaggiInRequest_VAR
  442.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_IN_REQUEST,String.class.getName(),
  443.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_IN_REQUEST,
  444.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  445.         MBeanAttributeInfo dimensioneMessaggiOutRequest_VAR
  446.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_OUT_REQUEST,String.class.getName(),
  447.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_OUT_REQUEST,
  448.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  449.         MBeanAttributeInfo dimensioneMessaggiInResponse_VAR
  450.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_IN_RESPONSE,String.class.getName(),
  451.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_IN_RESPONSE,
  452.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  453.         MBeanAttributeInfo dimensioneMessaggiOutResponse_VAR
  454.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_OUT_RESPONSE,String.class.getName(),
  455.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_OUT_RESPONSE,
  456.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  457.        
  458.         MBeanAttributeInfo dimensioneMessaggiPD_VAR
  459.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD,String.class.getName(),
  460.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PD,
  461.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  462.         MBeanAttributeInfo dimensioneMessaggiPDInRequest_VAR
  463.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_IN_REQUEST,String.class.getName(),
  464.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PD_IN_REQUEST,
  465.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  466.         MBeanAttributeInfo dimensioneMessaggiPDOutRequest_VAR
  467.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_OUT_REQUEST,String.class.getName(),
  468.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PD_OUT_REQUEST,
  469.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  470.         MBeanAttributeInfo dimensioneMessaggiPDInResponse_VAR
  471.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_IN_RESPONSE,String.class.getName(),
  472.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PD_IN_RESPONSE,
  473.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  474.         MBeanAttributeInfo dimensioneMessaggiPDOutResponse_VAR
  475.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PD_OUT_RESPONSE,String.class.getName(),
  476.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PD_OUT_RESPONSE,
  477.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);
  478.        
  479.         MBeanAttributeInfo dimensioneMessaggiPA_VAR
  480.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA,String.class.getName(),
  481.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PA,
  482.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  483.         MBeanAttributeInfo dimensioneMessaggiPAInRequest_VAR
  484.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_IN_REQUEST,String.class.getName(),
  485.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PA_IN_REQUEST,
  486.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  487.         MBeanAttributeInfo dimensioneMessaggiPAOutRequest_VAR
  488.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_OUT_REQUEST,String.class.getName(),
  489.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PA_OUT_REQUEST,
  490.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  491.         MBeanAttributeInfo dimensioneMessaggiPAInResponse_VAR
  492.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_IN_RESPONSE,String.class.getName(),
  493.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PA_IN_RESPONSE,
  494.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);    
  495.         MBeanAttributeInfo dimensioneMessaggiPAOutResponse_VAR
  496.             = new MBeanAttributeInfo(StatisticsJMXResource.DIMENSIONE_MESSAGGI_PA_OUT_RESPONSE,String.class.getName(),
  497.                     StatisticsJMXResource.TXT_DIMENSIONE_MESSAGGI_PA_OUT_RESPONSE,
  498.                     JMXUtils.JMX_ATTRIBUTE_READABLE,!JMXUtils.JMX_ATTRIBUTE_WRITABLE,!JMXUtils.JMX_ATTRIBUTE_IS_GETTER);
  499.        
  500.         // MetaData per le operazioni
  501.         MBeanOperationInfo refresh_OP
  502.         = new MBeanOperationInfo(StatisticsJMXResource.REFRESH,"Aggiorna le statistiche",
  503.                 null,
  504.                 String.class.getName(),
  505.                 MBeanOperationInfo.ACTION);
  506.         MBeanOperationInfo reset_OP
  507.         = new MBeanOperationInfo(StatisticsJMXResource.RESET,"Reset delle informazioni statistiche",
  508.                 null,
  509.                 String.class.getName(),
  510.                 MBeanOperationInfo.ACTION);


  511.         // Mbean costruttore
  512.         MBeanConstructorInfo defaultConstructor =
  513.             new MBeanConstructorInfo("Default Constructor","Crea e inizializza una nuova istanza del MBean",null);

  514.         // Lista attributi
  515.         MBeanAttributeInfo[] attributes =
  516.             new MBeanAttributeInfo[]{intervalloStatistico_VAR,
  517.                 numeroTransazioni_VAR,numeroTransazioniPD_VAR,numeroTransazioniPA_VAR,
  518.                 latenzaAttraversamento_VAR,latenzaAttraversamentoRequest_VAR,latenzaAttraversamentoResponse_VAR,
  519.                 latenzaAttraversamentoPD_VAR,latenzaAttraversamentoPDRequest_VAR,latenzaAttraversamentoPDResponse_VAR,
  520.                 latenzaAttraversamentoPA_VAR,latenzaAttraversamentoPARequest_VAR,latenzaAttraversamentoPAResponse_VAR,
  521.                 dimensioneMessaggi_VAR,dimensioneMessaggiInRequest_VAR,dimensioneMessaggiOutRequest_VAR,
  522.                 dimensioneMessaggiInResponse_VAR,dimensioneMessaggiOutResponse_VAR,
  523.                 dimensioneMessaggiPD_VAR,dimensioneMessaggiPDInRequest_VAR,dimensioneMessaggiPDOutRequest_VAR,
  524.                 dimensioneMessaggiPDInResponse_VAR,dimensioneMessaggiPDOutResponse_VAR,
  525.                 dimensioneMessaggiPA_VAR,dimensioneMessaggiPAInRequest_VAR,dimensioneMessaggiPAOutRequest_VAR,
  526.                 dimensioneMessaggiPAInResponse_VAR,dimensioneMessaggiPAOutResponse_VAR};

  527.         // Lista Costruttori
  528.         MBeanConstructorInfo[] constructors = new MBeanConstructorInfo[]{defaultConstructor};

  529.         // Lista operazioni
  530.         MBeanOperationInfo[] operations = new MBeanOperationInfo[]{refresh_OP,reset_OP};

  531.         return new MBeanInfo(className,description,attributes,constructors,operations,null);
  532.     }


  533.    


  534.     /* Costruttore */
  535.     public StatisticsJMXResource() throws Exception{

  536.        
  537.        
  538.     }

  539.     /* Metodi di management JMX */

  540.     public String refresh(){
  541.         StatisticsCollection stat = StatisticsCollection.getStatisticsCollection();
  542.        
  543.         if(stat.getDataUltimoRefresh()>0) {
  544.             // Altrimenti non sono ancora passati messaggi.
  545.             Date rightBound = DateManager.getDate();
  546.             Date leftBound = new Date(stat.getDataUltimoRefresh());
  547.        
  548.             SimpleDateFormat dateformat = DateUtils.getDefaultDateTimeFormatter("yyyy-MM-dd HH:mm:ss");
  549.             this.intervallo_statistico = "["+ dateformat.format(leftBound)
  550.                 + "] - ["+dateformat.format(rightBound)+"]";
  551.         }else{
  552.             this.intervallo_statistico = "";
  553.         }
  554.        
  555.         this.numero_transazioni = stat.getStatNumeroTransazioni().numeroTransazioni + "/" +
  556.             stat.getStatNumeroTransazioni().numeroTransazioni_esitoOK + "/" +
  557.             stat.getStatNumeroTransazioni().numeroTransazioni_esitoErrore;
  558.         this.numero_transazioni_pd = stat.getStatNumeroTransazioniPD().numeroTransazioni + "/" +
  559.             stat.getStatNumeroTransazioniPD().numeroTransazioni_esitoOK + "/" +
  560.             stat.getStatNumeroTransazioniPD().numeroTransazioni_esitoErrore;
  561.         this.numero_transazioni_pa = stat.getStatNumeroTransazioniPA().numeroTransazioni + "/" +
  562.             stat.getStatNumeroTransazioniPA().numeroTransazioni_esitoOK + "/" +
  563.             stat.getStatNumeroTransazioniPA().numeroTransazioni_esitoErrore;
  564.        
  565.         this.latenza_attraversamento = convertTime(stat.getStatLatenzaAttraversamento().latenzaMinimaAttraversamento) + "/" +
  566.             convertTime(stat.getStatLatenzaAttraversamento().latenzaMediaAttraversamento) + "/" +
  567.             convertTime(stat.getStatLatenzaAttraversamento().latenzaMassimaAttraversamento);
  568.         this.latenza_attraversamento_request = convertTime(stat.getStatLatenzaAttraversamentoRequest().latenzaMinimaAttraversamento) + "/" +
  569.             convertTime(stat.getStatLatenzaAttraversamentoRequest().latenzaMediaAttraversamento) + "/" +
  570.             convertTime(stat.getStatLatenzaAttraversamentoRequest().latenzaMassimaAttraversamento);
  571.         this.latenza_attraversamento_response = convertTime(stat.getStatLatenzaAttraversamentoResponse().latenzaMinimaAttraversamento) + "/" +
  572.             convertTime(stat.getStatLatenzaAttraversamentoResponse().latenzaMediaAttraversamento) + "/" +
  573.             convertTime(stat.getStatLatenzaAttraversamentoResponse().latenzaMassimaAttraversamento);
  574.        
  575.         this.latenza_attraversamento_pd = convertTime(stat.getStatLatenzaAttraversamentoPD().latenzaMinimaAttraversamento) + "/" +
  576.             convertTime(stat.getStatLatenzaAttraversamentoPD().latenzaMediaAttraversamento) + "/" +
  577.             convertTime(stat.getStatLatenzaAttraversamentoPD().latenzaMassimaAttraversamento);
  578.         this.latenza_attraversamento_pd_request = convertTime(stat.getStatLatenzaAttraversamentoPDRequest().latenzaMinimaAttraversamento) + "/" +
  579.             convertTime(stat.getStatLatenzaAttraversamentoPDRequest().latenzaMediaAttraversamento) + "/" +
  580.             convertTime(stat.getStatLatenzaAttraversamentoPDRequest().latenzaMassimaAttraversamento);
  581.         this.latenza_attraversamento_pd_response = convertTime(stat.getStatLatenzaAttraversamentoPDResponse().latenzaMinimaAttraversamento) + "/" +
  582.             convertTime(stat.getStatLatenzaAttraversamentoPDResponse().latenzaMediaAttraversamento) + "/" +
  583.             convertTime(stat.getStatLatenzaAttraversamentoPDResponse().latenzaMassimaAttraversamento);
  584.        
  585.         this.latenza_attraversamento_pa = convertTime(stat.getStatLatenzaAttraversamentoPA().latenzaMinimaAttraversamento) + "/" +
  586.             convertTime(stat.getStatLatenzaAttraversamentoPA().latenzaMediaAttraversamento) + "/" +
  587.             convertTime(stat.getStatLatenzaAttraversamentoPA().latenzaMassimaAttraversamento);
  588.         this.latenza_attraversamento_pa_request = convertTime(stat.getStatLatenzaAttraversamentoPARequest().latenzaMinimaAttraversamento) + "/" +
  589.             convertTime(stat.getStatLatenzaAttraversamentoPARequest().latenzaMediaAttraversamento) + "/" +
  590.             convertTime(stat.getStatLatenzaAttraversamentoPARequest().latenzaMassimaAttraversamento);
  591.         this.latenza_attraversamento_pa_response = convertTime(stat.getStatLatenzaAttraversamentoPAResponse().latenzaMinimaAttraversamento) + "/" +
  592.             convertTime(stat.getStatLatenzaAttraversamentoPAResponse().latenzaMediaAttraversamento) + "/" +
  593.             convertTime(stat.getStatLatenzaAttraversamentoPAResponse().latenzaMassimaAttraversamento);
  594.        
  595.         this.dimensione_messaggi = convertSize(stat.getStatDimensioneMessaggio().dimensioneMinimaMessaggio) + "/" +
  596.             convertSize(stat.getStatDimensioneMessaggio().dimensioneMediaMessaggio) + "/" +
  597.             convertSize(stat.getStatDimensioneMessaggio().dimensioneMassimaMessaggio);
  598.         this.dimensione_messaggi_in_request = convertSize(stat.getStatDimensioneMessaggioInRequest().dimensioneMinimaMessaggio) + "/" +
  599.             convertSize(stat.getStatDimensioneMessaggioInRequest().dimensioneMediaMessaggio) + "/" +
  600.             convertSize(stat.getStatDimensioneMessaggioInRequest().dimensioneMassimaMessaggio);
  601.         this.dimensione_messaggi_out_request = convertSize(stat.getStatDimensioneMessaggioOutRequest().dimensioneMinimaMessaggio) + "/" +
  602.             convertSize(stat.getStatDimensioneMessaggioOutRequest().dimensioneMediaMessaggio) + "/" +
  603.             convertSize(stat.getStatDimensioneMessaggioOutRequest().dimensioneMassimaMessaggio);
  604.         this.dimensione_messaggi_in_response = convertSize(stat.getStatDimensioneMessaggioInResponse().dimensioneMinimaMessaggio) + "/" +
  605.             convertSize(stat.getStatDimensioneMessaggioInResponse().dimensioneMediaMessaggio) + "/" +
  606.             convertSize(stat.getStatDimensioneMessaggioInResponse().dimensioneMassimaMessaggio);
  607.         this.dimensione_messaggi_out_response = convertSize(stat.getStatDimensioneMessaggioOutResponse().dimensioneMinimaMessaggio) + "/" +
  608.             convertSize(stat.getStatDimensioneMessaggioOutResponse().dimensioneMediaMessaggio) + "/" +
  609.             convertSize(stat.getStatDimensioneMessaggioOutResponse().dimensioneMassimaMessaggio);
  610.        
  611.         this.dimensione_messaggi_pd = convertSize(stat.getStatDimensioneMessaggioPD().dimensioneMinimaMessaggio) + "/" +
  612.             convertSize(stat.getStatDimensioneMessaggioPD().dimensioneMediaMessaggio) + "/" +
  613.             convertSize(stat.getStatDimensioneMessaggioPD().dimensioneMassimaMessaggio);
  614.         this.dimensione_messaggi_pd_in_request = convertSize(stat.getStatDimensioneMessaggioPDInRequest().dimensioneMinimaMessaggio) + "/" +
  615.             convertSize(stat.getStatDimensioneMessaggioPDInRequest().dimensioneMediaMessaggio) + "/" +
  616.             convertSize(stat.getStatDimensioneMessaggioPDInRequest().dimensioneMassimaMessaggio);
  617.         this.dimensione_messaggi_pd_out_request = convertSize(stat.getStatDimensioneMessaggioPDOutRequest().dimensioneMinimaMessaggio) + "/" +
  618.             convertSize(stat.getStatDimensioneMessaggioPDOutRequest().dimensioneMediaMessaggio) + "/" +
  619.             convertSize(stat.getStatDimensioneMessaggioPDOutRequest().dimensioneMassimaMessaggio);
  620.         this.dimensione_messaggi_pd_in_response = convertSize(stat.getStatDimensioneMessaggioPDInResponse().dimensioneMinimaMessaggio) + "/" +
  621.             convertSize(stat.getStatDimensioneMessaggioPDInResponse().dimensioneMediaMessaggio) + "/" +
  622.             convertSize(stat.getStatDimensioneMessaggioPDInResponse().dimensioneMassimaMessaggio);
  623.         this.dimensione_messaggi_pd_out_response = convertSize(stat.getStatDimensioneMessaggioPDOutResponse().dimensioneMinimaMessaggio) + "/" +
  624.             convertSize(stat.getStatDimensioneMessaggioPDOutResponse().dimensioneMediaMessaggio) + "/" +
  625.             convertSize(stat.getStatDimensioneMessaggioPDOutResponse().dimensioneMassimaMessaggio);
  626.        
  627.         this.dimensione_messaggi_pa = convertSize(stat.getStatDimensioneMessaggioPA().dimensioneMinimaMessaggio) + "/" +
  628.             convertSize(stat.getStatDimensioneMessaggioPA().dimensioneMediaMessaggio) + "/" +
  629.             convertSize(stat.getStatDimensioneMessaggioPA().dimensioneMassimaMessaggio);
  630.         this.dimensione_messaggi_pa_in_request = convertSize(stat.getStatDimensioneMessaggioPAInRequest().dimensioneMinimaMessaggio) + "/" +
  631.             convertSize(stat.getStatDimensioneMessaggioPAInRequest().dimensioneMediaMessaggio) + "/" +
  632.             convertSize(stat.getStatDimensioneMessaggioPAInRequest().dimensioneMassimaMessaggio);
  633.         this.dimensione_messaggi_pa_out_request = convertSize(stat.getStatDimensioneMessaggioPAOutRequest().dimensioneMinimaMessaggio) + "/" +
  634.             convertSize(stat.getStatDimensioneMessaggioPAOutRequest().dimensioneMediaMessaggio) + "/" +
  635.             convertSize(stat.getStatDimensioneMessaggioPAOutRequest().dimensioneMassimaMessaggio);
  636.         this.dimensione_messaggi_pa_in_response = convertSize(stat.getStatDimensioneMessaggioPAInResponse().dimensioneMinimaMessaggio) + "/" +
  637.             convertSize(stat.getStatDimensioneMessaggioPAInResponse().dimensioneMediaMessaggio) + "/" +
  638.             convertSize(stat.getStatDimensioneMessaggioPAInResponse().dimensioneMassimaMessaggio);
  639.         this.dimensione_messaggi_pa_out_response = convertSize(stat.getStatDimensioneMessaggioPAOutResponse().dimensioneMinimaMessaggio) + "/" +
  640.             convertSize(stat.getStatDimensioneMessaggioPAOutResponse().dimensioneMediaMessaggio) + "/" +
  641.             convertSize(stat.getStatDimensioneMessaggioPAOutResponse().dimensioneMassimaMessaggio);
  642.        
  643.         return "Refresh dati statistici effettuato";
  644.     }
  645.    
  646.     private String convertTime(long time){
  647.         return Utilities.convertSystemTimeIntoStringMillisecondi(time, true);
  648.     }
  649.     private String convertSize(long size){
  650.         return Utilities.convertBytesToFormatString(size);
  651.     }
  652.    
  653.     public String reset(){
  654.         StatisticsCollection.reset();
  655.         refresh();
  656.         return "Reset dati statistici effettuato";
  657.     }

  658. }