Package overit.geocall.io.tracer
Class FileLogTracer
java.lang.Object
overit.geocall.io.tracer.AbstractIOLogTracer
overit.geocall.io.tracer.FileLogTracer
- All Implemented Interfaces:
IOLogTracer,Identified
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.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SettableElementprotected org.apache.ecs.Documentprotected SettableElementprotected Fileprotected Fileprotected Fileprotected org.apache.ecs.html.IFrameprotected org.apache.ecs.html.IFrameprotected SettableElementprotected Stringprotected SettableElementprotected Stringprotected SettableElementprotected final SimpleDateFormatprotected final SimpleDateFormatprotected SettableElementprotected longprotected SettableElementprotected SettableElementprotected SettableElementprotected SettableElementprotected SettableElementFields inherited from class overit.geocall.io.tracer.AbstractIOLogTracer
_client, _filters, _identity, _profiler, _service, _streamerFields inherited from interface overit.geocall.io.tracer.IOLogTracer
STATUS_COMPLETE, STATUS_ERROR, STATUS_REQUEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddExtension(String path) booleanreturnstrueif the tracer has all the necessary information and can proceed with saving the log.protected voidcreateMasterFile(String name, Date date) protected voidprotected voiddeletePage(String s) voidflush()method used to clean any variables once the log has been savedgetReference(String serviceName) Get the reference that can be used later to retrieve the log.protected OutputStreamprotected StringgetStreamRelativePath(String type) protected booleanCheck whether the log should be traced or notprotected voidRegistra il contenuto della risposta nel caso la richiesta non abbia avuto successo.protected voidRegistra il contenuto della risposta nel caso la richiesta abbia avuto successo.protected FileoldestPage(File[] files) protected voidrotate()voidsave()Memorizza le informazioni inviate/ricevute in modo persistente.voidsetDuration(long l) Utilizzato per impostare la durata complessiva della richiesta.voidsetEnd(long end) Utilizzato per impostare l'istante in cui la richiesta è stata elaborata.voidsetInputAttachments(int count) voidImposta il metodo d chiamata di un servizio.voidsetOutputAttachments(int count) voidsetRequestHeaders(String headers) Imposta gli headers della richiesta.voidsetResponseHeaders(String headers) Imposta gli headers della risposta.voidsetService(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.voidsetStart(long start) Utilizzato per impostare l'istante in cui l'elaborazione della richiesta ha inizio.voidsetStatus(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.voidsetStatusCode(int code) Imposta il codice di risposta relativo ad una chiamata ad un WSprotected voidsetupMasterDocument(org.apache.ecs.Document doc, org.apache.ecs.html.IFrame ifL, org.apache.ecs.html.IFrame ifR, Boolean client) Methods inherited from class overit.geocall.io.tracer.AbstractIOLogTracer
addFilter, doFilter, getIdentity, logInput, onError, onError, onInput, onInput, onInput, onOutput, onOutput, onOutput, removeFilter, setIdentityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface overit.geocall.io.tracer.IOLogTracer
onResult
-
Field Details
-
_document
protected org.apache.ecs.Document _document -
_ifr1
protected org.apache.ecs.html.IFrame _ifr1 -
_ifr2
protected org.apache.ecs.html.IFrame _ifr2 -
_status
-
_duration
-
_serviceName
-
_date
-
_url
-
requestHeaders
-
responseHeaders
-
_inputAttachments
-
_outputAttachments
-
_method
-
_statusCode
-
_start
protected long _start -
_fHtml
-
_fXml
-
_fXSL
-
_master
-
_nRaw
-
_sdf
-
_sdfFile
-
-
Constructor Details
-
FileLogTracer
- Throws:
IOException
-
-
Method Details
-
isLogActive
protected boolean isLogActive()Description copied from class:AbstractIOLogTracerCheck whether the log should be traced or not- Specified by:
isLogActivein classAbstractIOLogTracer- Returns:
trueif the log is active,falseotherwise
-
getOutputStreamInput
- Returns:
- lo stream su cui scrivere il contenuto della richiesta.
-
getOutputStreamOutput
- Returns:
- lo stream su cui scrivere il contenuto della risposta nel caso la richiesta sia stata processata con successo.
-
getOutputStreamError
- Returns:
- lo stream su cui scrivere il contenuto della risposta nel caso di errori.
-
getReference
Description copied from interface:IOLogTracerGet 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:
- path of the master document
- path of the Input raw document
- path of the Outputput raw document (in case of successfully response)
- 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 ofMessageyou 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
Description copied from class:AbstractIOLogTracerRegistra il contenuto della risposta nel caso la richiesta abbia avuto successo.- Overrides:
logOutputin classAbstractIOLogTracer- Parameters:
output- vengono gestite istanze di oggetti appartenenti alle seguenti classi:XMLTreeSOAPMessageJsonElement-
invalid reference
byte[] Throwable
JackMapper
-
logError
Description copied from class:AbstractIOLogTracerRegistra il contenuto della risposta nel caso la richiesta non abbia avuto successo.- Overrides:
logErrorin classAbstractIOLogTracer- Parameters:
error- vengono gestite istanze di oggetti appartenenti alle seguenti classi:XMLTreeSOAPMessageJsonElement-
invalid reference
byte[] Throwable
JackMapper
-
save
public void save()Description copied from interface:IOLogTracerMemorizza le informazioni inviate/ricevute in modo persistente. -
setStart
public void setStart(long start) Description copied from interface:IOLogTracerUtilizzato 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:IOLogTracerUtilizzato 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:IOLogTracerUtilizzato 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
Description copied from interface:IOLogTracerImposta 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 serviziourl- url del servizio
-
setStatus
public void setStatus(int s) Description copied from interface:IOLogTracerViene 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:IOLogTracer.STATUS_REQUESTse la richiesta è stata inoltrataIOLogTracer.STATUS_COMPLETEse la chiamata è terminata con successoIOLogTracer.STATUS_ERRORse la chiamata è terminata con errore
-
setRequestHeaders
Description copied from interface:IOLogTracerImposta gli headers della richiesta.- Parameters:
headers- headers della richiesta.
-
setResponseHeaders
Description copied from interface:IOLogTracerImposta 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:IOLogTracermethod used to clean any variables once the log has been saved -
completed
public boolean completed()Description copied from interface:IOLogTracerreturnstrueif the tracer has all the necessary information and can proceed with saving the log.falseotherwise- Returns:
trueif the tracer has all the necessary information and can proceed with saving the log.falseotherwise
-
setMethod
Description copied from interface:IOLogTracerImposta 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:IOLogTracerImposta il codice di risposta relativo ad una chiamata ad un WS- Parameters:
code- codice di risposta
-
getStream
-
getStreamRelativePath
-
addExtension
-
rotate
protected void rotate() -
oldestPage
-
deletePage
-
createMasterFile
-
createTemplateFiles
- 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)
-