org.hopto.pentaj.jexin.stacktrace
Class StackTraceTemplate

java.lang.Object
  extended by org.hopto.pentaj.jexin.stacktrace.StackTraceTemplate
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<StackTraceTemplate>

public class StackTraceTemplate
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<StackTraceTemplate>

Used to inject errors during a running StackTrace. The incoming StackFrames will be compared to the StackFrameTemplates contained herein and as long as they match in sequence any injected exception definitions in the corresponding StackFrameTemplate will be injected into the running node at that point in the execution path.

See Also:
Serialized Form

Constructor Summary
StackTraceTemplate(int id, CompletedStackTrace completedTrace)
           
StackTraceTemplate(int id, java.lang.String name, CompletedStackTrace completedTrace)
           
 
Method Summary
 int compareTo(StackTraceTemplate o)
           
 NodeAddress getAddress()
           
 java.util.Date getCreatedTime()
           
 int getId()
           
 java.util.List<InjectableException> getInjectableExceptions()
           
 StackFrameTemplate getMatchingAfterTemplate(StackFrame stackFrame)
           
 StackFrameTemplate getMatchingBeforeTemplate(StackFrame stackFrame)
           
 java.lang.String getName()
           
 java.util.List<StackFrameTemplate> getStackFrameTemplates()
           
 boolean isActive()
           
 boolean isStackEndIndex(int stackIndex)
          This is called for the open StackTrace when its pop method returns true to determine if this trace template ends with the same frame as the open StackTrace.
 void setActive(boolean active)
           
 void setName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackTraceTemplate

public StackTraceTemplate(int id,
                          CompletedStackTrace completedTrace)
Parameters:
id -
completedTrace -

StackTraceTemplate

public StackTraceTemplate(int id,
                          java.lang.String name,
                          CompletedStackTrace completedTrace)
Parameters:
id -
name -
completedTrace -
Method Detail

getId

public int getId()
Returns:
the id used by the StackTraceManager

getName

public java.lang.String getName()
Returns:
the name

getCreatedTime

public java.util.Date getCreatedTime()
Returns:
The date/time this template was created

getInjectableExceptions

public java.util.List<InjectableException> getInjectableExceptions()
Returns:
The exceptions that can be injected

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set

getAddress

public NodeAddress getAddress()
Returns:
the address

isActive

public boolean isActive()
Returns:
True if this template is active, false if it isn't

setActive

public void setActive(boolean active)
Parameters:
active - True if this template is active, false if it isn't

getStackFrameTemplates

public java.util.List<StackFrameTemplate> getStackFrameTemplates()
Returns:
the stackFrameTemplates

getMatchingBeforeTemplate

public StackFrameTemplate getMatchingBeforeTemplate(StackFrame stackFrame)
Parameters:
stackFrame -
Returns:
The StackFrameTemplate that matches the stackFrame at its traceIndex before method call. Null if there is no match.

getMatchingAfterTemplate

public StackFrameTemplate getMatchingAfterTemplate(StackFrame stackFrame)
Parameters:
stackFrame -
Returns:
The StackFrameTemplate that matches the stackFrame at its traceIndex after method call. Null if there is no match. It is assumed that getMatchingBeforeTemplate was already successful for this same stackFrame.

isStackEndIndex

public boolean isStackEndIndex(int stackIndex)
This is called for the open StackTrace when its pop method returns true to determine if this trace template ends with the same frame as the open StackTrace.

Parameters:
stackIndex -
Returns:
True if stackIndex is the index of the last frame in the stack list

compareTo

public int compareTo(StackTraceTemplate o)
Specified by:
compareTo in interface java.lang.Comparable<StackTraceTemplate>
See Also:
Comparable.compareTo(java.lang.Object)