Class AsyncIOLogTracer

java.lang.Object
overit.geocall.io.tracer.AsyncIOLogTracer
All Implemented Interfaces:
IOLogTracer, Identified

public class AsyncIOLogTracer extends Object implements IOLogTracer
Tracer che permette di rendere asincrono l'effettivo salvataggio del log. Nello specifico viene sfruttata un istanza della classe IOLogProcessor la quale si preoccuperà di spostare la richiesta di salvataggio su un thread separato evitando quindi di bloccare il thread corrente, consentendogli di procedere con le successive elaborazioni.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected IOLogTracer
     

    Fields inherited from interface overit.geocall.io.tracer.IOLogTracer

    STATUS_COMPLETE, STATUS_ERROR, STATUS_REQUEST
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Aggiunge un filtro che verrà eseguito prima del salvataggio dei log di input/output/error.
    boolean
    returns true if the tracer has all the necessary information and can proceed with saving the log.
    void
    method used to clean any variables once the log has been saved
    Returns the Identity associated to the component
     
     
     
    getReference(String serviceName)
    Get the reference that can be used later to retrieve the log.
    void
    onError(Object error)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'errore sul file di log.
    void
    onError(Object error, Date registrationTime)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'errore sul file di log.
    void
    onInput(String serviceName, String serviceUrl, Object input)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'input sul file di log.
    void
    onInput(String serviceName, String serviceUrl, Object input, Date registrationTime)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'input sul file di log.
    void
    onInput(String serviceName, String serviceUrl, String headers, Object input, Date registrationTime)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'input sul file di log.
    void
    onOutput(Object output)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'output sul file di log.
    void
    onOutput(Object output, Date registrationTime)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'output sul file di log.
    void
    onOutput(Object output, Date registrationTime, String headers)
    Metodo di utilità che semplifica le operazioni di setup e scrittura dell'output sul file di log.
    void
    Rimuove un determinato filtro, evitando che questo contribuisca alla modifica del messaggio prima del logging
    void
    Memorizza le informazioni inviate/ricevute in modo persistente.
    void
    setDuration(long l)
    Utilizzato per impostare la durata complessiva della richiesta.
    void
    setEnd(long end)
    Utilizzato per impostare l'istante in cui la richiesta è stata elaborata.
    void
    Sets the Identity to the component
    void
     
    void
    setMethod(String method)
    Imposta il metodo d chiamata di un servizio.
    void
     
    void
    Imposta gli headers della richiesta.
    void
    Imposta gli headers della risposta.
    void
    setService(String name, String url)
    Imposta il nome e l'url del servizio, inizializzando il nome del log nel caso sia abilitata la funzionalità di logging.
    void
    setStart(long start)
    Utilizzato per impostare l'istante in cui l'elaborazione della richiesta ha inizio.
    void
    setStatus(int s)
    Viene utilizzato per impostare lo stato del tracer; solitamente questo metodo viene invocato più volte in modo da mantenere allineato lo stato con l'avanzamento della richiesta.
    void
    setStatusCode(int code)
    Imposta il codice di risposta relativo ad una chiamata ad un WS

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface overit.geocall.io.tracer.IOLogTracer

    onResult
  • Field Details

  • Constructor Details

  • Method Details

    • onInput

      public void onInput(String serviceName, String serviceUrl, Object input)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'input sul file di log.
      Specified by:
      onInput in interface IOLogTracer
      Parameters:
      serviceName - nome del servizio, utilizzato per il setup delle directory
      serviceUrl - url del servizio inserito all'interno del masterfile
      input - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'input verrà serializzato attraverso il serializzatore JackMapper.
    • onInput

      public void onInput(String serviceName, String serviceUrl, Object input, Date registrationTime)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'input sul file di log.
      Specified by:
      onInput in interface IOLogTracer
      Parameters:
      serviceName - nome del servizio, utilizzato per il setup delle directory
      serviceUrl - url del servizio inserito all'interno del masterfile
      input - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'input verrà serializzato attraverso il serializzatore JackMapper.
      registrationTime - istante di registrazione del log.
    • onInput

      public void onInput(String serviceName, String serviceUrl, String headers, Object input, Date registrationTime)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'input sul file di log.
      Specified by:
      onInput in interface IOLogTracer
      Parameters:
      serviceName - nome del servizio, utilizzato per il setup delle directory
      serviceUrl - url del servizio inserito all'interno del masterfile
      headers - headers della risposta della richiesta.
      input - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'input verrà serializzato attraverso il serializzatore JackMapper.
      registrationTime - istante di registrazione del log.
    • onOutput

      public void onOutput(Object output)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'output sul file di log.
      Specified by:
      onOutput in interface IOLogTracer
      Parameters:
      output - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'output verrà serializzato attraverso il serializzatore JackMapper.
    • onOutput

      public void onOutput(Object output, Date registrationTime)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'output sul file di log.
      Specified by:
      onOutput in interface IOLogTracer
      Parameters:
      output - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'output verrà serializzato attraverso il serializzatore JackMapper.
      registrationTime - istante di registrazione del log.
    • onOutput

      public void onOutput(Object output, Date registrationTime, String headers)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'output sul file di log.
      Specified by:
      onOutput in interface IOLogTracer
      Parameters:
      output - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'output verrà serializzato attraverso il serializzatore JackMapper.
      registrationTime - istante di registrazione del log.
      headers - headers della risposta.
    • onError

      public void onError(Object error)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'errore sul file di log.
      Specified by:
      onError in interface IOLogTracer
      Parameters:
      error - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'errore verrà serializzato attraverso il serializzatore JackMapper.
    • onError

      public void onError(Object error, Date registrationTime)
      Description copied from interface: IOLogTracer
      Metodo di utilità che semplifica le operazioni di setup e scrittura dell'errore sul file di log.
      Specified by:
      onError in interface IOLogTracer
      Parameters:
      error - vengono gestite istanze di oggetti appartenenti alle seguenti classi: XMLTree, SOAPMessage, JsonElement e
      invalid reference
      byte[]
      , Throwable. Per tutte le altre classi l'errore verrà serializzato attraverso il serializzatore JackMapper.
      registrationTime - istante di registrazione del log.
    • save

      public void save()
      Description copied from interface: IOLogTracer
      Memorizza le informazioni inviate/ricevute in modo persistente.
      Specified by:
      save in interface IOLogTracer
    • getOutputStreamInput

      public OutputStream getOutputStreamInput()
      Specified by:
      getOutputStreamInput in interface IOLogTracer
      Returns:
      lo stream su cui scrivere il contenuto della richiesta.
    • getOutputStreamOutput

      public OutputStream getOutputStreamOutput()
      Specified by:
      getOutputStreamOutput in interface IOLogTracer
      Returns:
      lo stream su cui scrivere il contenuto della risposta nel caso la richiesta sia stata processata con successo.
    • getOutputStreamError

      public OutputStream getOutputStreamError()
      Specified by:
      getOutputStreamError in interface IOLogTracer
      Returns:
      lo stream su cui scrivere il contenuto della risposta nel caso di errori.
    • setStart

      public void setStart(long start)
      Description copied from interface: IOLogTracer
      Utilizzato per impostare l'istante in cui l'elaborazione della richiesta ha inizio. Questo metodo dev'essere invocato IMMEDIATAMENTE PRIMA del invio della richiesta al WS.
      Specified by:
      setStart in interface IOLogTracer
      Parameters:
      start - timestamp di inizio chiamata
    • setEnd

      public void setEnd(long end)
      Description copied from interface: IOLogTracer
      Utilizzato per impostare l'istante in cui la richiesta è stata elaborata. Questo metodo dev'essere invocato SOLO una volta che la richiesta è stata ricevuta ed elaborata.
      Specified by:
      setEnd in interface IOLogTracer
      Parameters:
      end - timestamp di fine chiamata
    • setDuration

      public void setDuration(long l)
      Description copied from interface: IOLogTracer
      Utilizzato per impostare la durata complessiva della richiesta. Questo metodo dev'essere invocato SOLO una volta che la richiesta è stata ricevuta ed elaborata.
      Specified by:
      setDuration in interface IOLogTracer
      Parameters:
      l - millisecondi trascorsi dal momento di invio all'effettiva ricezione.
    • setService

      public void setService(String name, String url)
      Description copied from interface: IOLogTracer
      Imposta il nome e l'url del servizio, inizializzando il nome del log nel caso sia abilitata la funzionalità di logging. Questo metodo dev'essere invocato prima di iniziare la scrittura del log.
      Specified by:
      setService in interface IOLogTracer
      Parameters:
      name - nome del servizio
      url - url del servizio
    • setRequestHeaders

      public void setRequestHeaders(String headers)
      Description copied from interface: IOLogTracer
      Imposta gli headers della richiesta.
      Specified by:
      setRequestHeaders in interface IOLogTracer
      Parameters:
      headers - headers della richiesta.
    • setResponseHeaders

      public void setResponseHeaders(String headers)
      Description copied from interface: IOLogTracer
      Imposta gli headers della risposta.
      Specified by:
      setResponseHeaders in interface IOLogTracer
      Parameters:
      headers - headers della risposta.
    • setStatus

      public void setStatus(int s)
      Description copied from interface: IOLogTracer
      Viene utilizzato per impostare lo stato del tracer; solitamente questo metodo viene invocato più volte in modo da mantenere allineato lo stato con l'avanzamento della richiesta.
      Specified by:
      setStatus in interface IOLogTracer
      Parameters:
      s - si possono specificare i seguenti valori:
    • setInputAttachments

      public void setInputAttachments(int count)
      Specified by:
      setInputAttachments in interface IOLogTracer
      Parameters:
      count - il numero di allegati inviati
    • setOutputAttachments

      public void setOutputAttachments(int count)
      Specified by:
      setOutputAttachments in interface IOLogTracer
      Parameters:
      count - il numero di allegati ricevuti
    • addFilter

      public void addFilter(IOLogFilter filter)
      Description copied from interface: IOLogTracer
      Aggiunge un filtro che verrà eseguito prima del salvataggio dei log di input/output/error.
      Specified by:
      addFilter in interface IOLogTracer
      Parameters:
      filter - Il filtro da aggiungere
    • removeFilter

      public void removeFilter(IOLogFilter filter)
      Description copied from interface: IOLogTracer
      Rimuove un determinato filtro, evitando che questo contribuisca alla modifica del messaggio prima del logging
      Specified by:
      removeFilter in interface IOLogTracer
      Parameters:
      filter - Il filtro da rimuovere
    • getReference

      public Object getReference(String serviceName)
      Description copied from interface: IOLogTracer
      Get the reference that can be used later to retrieve the log. If the DB log has been activated, this method will return a Long number indicating the ID of the database record. If the FS log has been activated, this method will return an array of string whose contains 4 elements:
      1. path of the master document
      2. path of the Input raw document
      3. path of the Outputput raw document (in case of successfully response)
      4. path of the Error raw document (in case of unsuccessfully response)
      Specified by:
      getReference in interface IOLogTracer
      Parameters:
      serviceName - string containing the name of the service. If you have an instance of Message you can extract the service's name in this way:
      message.getExchange().get(Message.WSDL_INTERFACE).toString()
      Returns:
      The reference that can be used later to retrieve the log
    • getIdentity

      public Identity getIdentity()
      Description copied from interface: Identified
      Returns the Identity associated to the component
      Specified by:
      getIdentity in interface Identified
      Returns:
      The Identity of the user currently logged in the application
    • setIdentity

      public void setIdentity(Identity identity)
      Description copied from interface: Identified
      Sets the Identity to the component
      Specified by:
      setIdentity in interface Identified
      Parameters:
      identity - The Identity that must be associated to the component
    • completed

      public boolean completed()
      Description copied from interface: IOLogTracer
      returns true if the tracer has all the necessary information and can proceed with saving the log. false otherwise
      Specified by:
      completed in interface IOLogTracer
      Returns:
      true if the tracer has all the necessary information and can proceed with saving the log. false otherwise
    • flush

      public void flush()
      Description copied from interface: IOLogTracer
      method used to clean any variables once the log has been saved
      Specified by:
      flush in interface IOLogTracer
    • setMethod

      public void setMethod(String method)
      Description copied from interface: IOLogTracer
      Imposta il metodo d chiamata di un servizio.
      Specified by:
      setMethod in interface IOLogTracer
      Parameters:
      method - verbo con cui viene chiamato il servizio
    • setStatusCode

      public void setStatusCode(int code)
      Description copied from interface: IOLogTracer
      Imposta il codice di risposta relativo ad una chiamata ad un WS
      Specified by:
      setStatusCode in interface IOLogTracer
      Parameters:
      code - codice di risposta