Class FileLogTracer

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

public class FileLogTracer extends AbstractIOLogTracer
Tracer che salva i log su FileSystem. Il posizionamento dei log dipende dal path indicato nel file di cofingurazione all'interno dell'attributo PropertiesWS.PATH_TRACE. Attenzione! Il salvataggio è sincrono e quindi è necessario attendere che il salvataggio sia stato completato prima di poter proseguire con le elaborazioni seguenti. Pertanto un elevata mole di richieste a questo tracer potrebbe comportare un lieve rallentamento generale. Per questo motivo si consiglia di wrappare il tracer all'interno di un AsyncIOLogTracer.
  • Field Details

  • Constructor Details

  • Method Details

    • isLogActive

      protected boolean isLogActive()
      Description copied from class: AbstractIOLogTracer
      Check whether the log should be traced or not
      Specified by:
      isLogActive in class AbstractIOLogTracer
      Returns:
      true if the log is active, false otherwise
    • getOutputStreamInput

      public OutputStream getOutputStreamInput()
      Returns:
      lo stream su cui scrivere il contenuto della richiesta.
    • getOutputStreamOutput

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

      public OutputStream getOutputStreamError()
      Returns:
      lo stream su cui scrivere il contenuto della risposta nel caso di errori.
    • 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)
      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
    • logOutput

      protected void logOutput(Object output)
      Description copied from class: AbstractIOLogTracer
      Registra il contenuto della risposta nel caso la richiesta abbia avuto successo.
      Overrides:
      logOutput in class AbstractIOLogTracer
      Parameters:
      output - vengono gestite istanze di oggetti appartenenti alle seguenti classi: Per tutte le altre classi l'output verrà serializzato attraverso il serializzatore JackMapper
    • logError

      protected void logError(Object error)
      Description copied from class: AbstractIOLogTracer
      Registra il contenuto della risposta nel caso la richiesta non abbia avuto successo.
      Overrides:
      logError in class AbstractIOLogTracer
      Parameters:
      error - vengono gestite istanze di oggetti appartenenti alle seguenti classi: Per tutte le altre classi l'errore verrà serializzato attraverso il serializzatore JackMapper
    • save

      public void save()
      Description copied from interface: IOLogTracer
      Memorizza le informazioni inviate/ricevute in modo persistente.
    • 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.
      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.
      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.
      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.
      Parameters:
      name - nome del servizio
      url - url del servizio
    • 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.
      Parameters:
      s - si possono specificare i seguenti valori:
    • setRequestHeaders

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

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

      public void setInputAttachments(int count)
      Parameters:
      count - il numero di allegati inviati
    • setOutputAttachments

      public void setOutputAttachments(int count)
      Parameters:
      count - il numero di allegati ricevuti
    • flush

      public void flush()
      Description copied from interface: IOLogTracer
      method used to clean any variables once the log has been saved
    • 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
      Returns:
      true if the tracer has all the necessary information and can proceed with saving the log. false otherwise
    • setMethod

      public void setMethod(String method)
      Description copied from interface: IOLogTracer
      Imposta il metodo d chiamata di un servizio.
      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
      Parameters:
      code - codice di risposta
    • getStream

      protected OutputStream getStream(String type)
    • getStreamRelativePath

      protected String getStreamRelativePath(String type)
    • addExtension

      protected String addExtension(String path)
    • rotate

      protected void rotate()
    • oldestPage

      protected File oldestPage(File[] files)
    • deletePage

      protected void deletePage(String s)
    • createMasterFile

      protected void createMasterFile(String name, Date date)
    • createTemplateFiles

      protected void createTemplateFiles() throws IOException
      Throws:
      IOException
    • setupMasterDocument

      protected void setupMasterDocument(org.apache.ecs.Document doc, org.apache.ecs.html.IFrame ifL, org.apache.ecs.html.IFrame ifR, Boolean client)