uk.org.ogsadai.trace
Class RequestTrace

java.lang.Object
  extended by uk.org.ogsadai.trace.RequestTrace
All Implemented Interfaces:
java.lang.Comparable

public class RequestTrace
extends java.lang.Object
implements java.lang.Comparable

Stores trace information for a request.

Author:
The OGSA-DAI Project Team.

Field Summary
protected  java.lang.String mDotExecutable
          Path to the dot executable that is used to produce the SVG file.
protected  DAIException mError
          Any error associated with the request.
protected  java.util.List<ActivityPipeline> mPipelines
          Pipelines of the request.
protected  java.util.Map<java.lang.String,PipeTrace> mPipeTraces
          Traces for each pipe used by the request.
protected  java.lang.String mRelativePathToTraceDirectory
          The relative path to the trace directory from the web app directory.
protected  RequestExecutionStatus mRequestExecutionStatus
          Request execution status.
protected  ResourceID mRequestID
          Request ID.
protected  java.io.File mSvgFile
          The SVG file that displays the trace.
protected  java.lang.String mSvgUrl
          The relative URL to the trace SVG file.
protected  java.util.Date mTimestamp
          Timestamp the request was created.
protected  java.io.File mTraceDirectory
          The trace directory for logging trace files.
 
Constructor Summary
RequestTrace(ResourceID requestID, SecurityContext securityContext, java.io.File traceDirectory, java.lang.String relativePathToTraceDirectory, java.lang.String dotExecutable)
          Constructor.
 
Method Summary
 void addPipeline(ActivityPipeline pipeline)
          Adds a pipeline to the request.
 int compareTo(java.lang.Object o)
           
 void destroy()
          Destroys the trace and deletes any corresponding trace files.
 DAIException getError()
          Gets any error associated with the request.
 RequestExecutionStatus getExecutionStatus()
          Gets the request execution status.
protected  PipeTrace getPipeTrace(Pipe pipe)
          Gets the pipe trace for the given pipe.
 ResourceID getRequestID()
          Gets the ID of the request.
 java.lang.String getSvgUrl()
          Gets the URL of the SVG file that displays the trace.
 java.util.Date getTimestamp()
          Gets the timestamp when the request was created.
 void pipeAddBlockRead(Pipe pipe, java.lang.Object block)
          Called when a block has been read by a pipe.
 void pipeAddBlockWritten(Pipe pipe, java.lang.Object block)
          Called when a block has been written to a pipe.
 void pipeClosedByConsumer(Pipe pipe)
          Called when a pipe has been closed by the consumer.
 void pipeClosedByProducer(Pipe pipe)
          Called when a pipe has been closed by the producer.
 void pipeClosedByProducerDueToError(Pipe pipe)
          Called when a pipe has been closed by the producer due to an error.
 void pipeError(Pipe pipe, PipeIOException cause)
          Called when there is a pipe error.
 void pipeTerminated(Pipe pipe)
          Called when a pipe has been terminated.
 void setError(DAIException error)
          Sets an error for the request.
 void setExecutionStatus(RequestExecutionStatus status)
          Sets the request execution status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mRequestID

protected ResourceID mRequestID
Request ID.


mRequestExecutionStatus

protected RequestExecutionStatus mRequestExecutionStatus
Request execution status.


mError

protected DAIException mError
Any error associated with the request.


mTimestamp

protected java.util.Date mTimestamp
Timestamp the request was created.


mPipelines

protected java.util.List<ActivityPipeline> mPipelines
Pipelines of the request.


mPipeTraces

protected java.util.Map<java.lang.String,PipeTrace> mPipeTraces
Traces for each pipe used by the request.


mTraceDirectory

protected java.io.File mTraceDirectory
The trace directory for logging trace files.


mRelativePathToTraceDirectory

protected java.lang.String mRelativePathToTraceDirectory
The relative path to the trace directory from the web app directory.


mSvgFile

protected java.io.File mSvgFile
The SVG file that displays the trace.


mSvgUrl

protected java.lang.String mSvgUrl
The relative URL to the trace SVG file.


mDotExecutable

protected java.lang.String mDotExecutable
Path to the dot executable that is used to produce the SVG file.

Constructor Detail

RequestTrace

public RequestTrace(ResourceID requestID,
                    SecurityContext securityContext,
                    java.io.File traceDirectory,
                    java.lang.String relativePathToTraceDirectory,
                    java.lang.String dotExecutable)
Constructor.

Parameters:
requestID - ID of the request being traced
securityContext - security context
traceDirectory - directory used to store trace files
relativePathToTraceDirectory - relative path to the trace directory from the web apps directory
dotExecutable - path to the dot executable used to produce SVG files
Method Detail

destroy

public void destroy()
Destroys the trace and deletes any corresponding trace files.


getTimestamp

public java.util.Date getTimestamp()
Gets the timestamp when the request was created.

Returns:
time of creation.

setExecutionStatus

public void setExecutionStatus(RequestExecutionStatus status)
Sets the request execution status.

Parameters:
status - execution status.

getExecutionStatus

public RequestExecutionStatus getExecutionStatus()
Gets the request execution status.

Returns:
request execution status.

setError

public void setError(DAIException error)
Sets an error for the request.

Parameters:
error - the error

getError

public DAIException getError()
Gets any error associated with the request.

Returns:
the error associated with the request, or null if there is no error.

addPipeline

public void addPipeline(ActivityPipeline pipeline)
Adds a pipeline to the request.

Parameters:
pipeline - pipeline

getSvgUrl

public java.lang.String getSvgUrl()
Gets the URL of the SVG file that displays the trace.

Returns:
URL of the SVG file. This is a relative URL.

getRequestID

public ResourceID getRequestID()
Gets the ID of the request.

Returns:
request ID.

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

pipeAddBlockRead

public void pipeAddBlockRead(Pipe pipe,
                             java.lang.Object block)
Called when a block has been read by a pipe.

Parameters:
pipe - pipe
block - block

pipeAddBlockWritten

public void pipeAddBlockWritten(Pipe pipe,
                                java.lang.Object block)
Called when a block has been written to a pipe.

Parameters:
pipe - pipe
block - block

pipeClosedByProducer

public void pipeClosedByProducer(Pipe pipe)
Called when a pipe has been closed by the producer.

Parameters:
pipe - pipe

pipeClosedByConsumer

public void pipeClosedByConsumer(Pipe pipe)
Called when a pipe has been closed by the consumer.

Parameters:
pipe - pipe

pipeClosedByProducerDueToError

public void pipeClosedByProducerDueToError(Pipe pipe)
Called when a pipe has been closed by the producer due to an error.

Parameters:
pipe - pipe

pipeError

public void pipeError(Pipe pipe,
                      PipeIOException cause)
Called when there is a pipe error.

Parameters:
pipe - pipe

pipeTerminated

public void pipeTerminated(Pipe pipe)
Called when a pipe has been terminated.

Parameters:
pipe - pipe

getPipeTrace

protected PipeTrace getPipeTrace(Pipe pipe)
Gets the pipe trace for the given pipe.

Parameters:
pipe - pipe
Returns:
pipe trace for the specified pipe.