TPTP 4.3.0 Monitoring Tools Project
Internal API Specification

org.eclipse.hyades.logging.adapter.internal.parsers
Class SubstituteStatement

java.lang.Object
  extended byorg.eclipse.hyades.logging.adapter.internal.parsers.SubstituteStatement
All Implemented Interfaces:
org.eclipse.hyades.logging.adapter.parsers.IStatement

public class SubstituteStatement
extends java.lang.Object
implements org.eclipse.hyades.logging.adapter.parsers.IStatement

This class represents a substitution rule. It uses the java.util.regex library for processing regular expressions.


Field Summary
protected  boolean callout
           
protected  boolean calloutNewInstance
           
protected  java.lang.String match
           
protected  java.lang.String name
           
protected  java.util.List path
           
protected  java.util.regex.Pattern pattern
           
protected  java.lang.String positions
           
protected  java.util.List positionsList
           
protected  boolean processTime
           
protected  org.eclipse.hyades.logging.adapter.IDirectedGraph resultGraph
           
protected  org.eclipse.hyades.logging.adapter.parsers.IStatefulSubstitutionExtension statefulExtension
           
protected  java.lang.String substitute
           
protected  java.lang.String substitutionExtensionClass
           
protected  java.lang.Class substitutionExtensionClassClass
           
protected  TimeParser timeParser
           
protected  boolean useBuiltin
           
 
Constructor Summary
SubstituteStatement(org.eclipse.hyades.logging.adapter.IParser parser)
          Create an SubstituteStatement with the specified IParser object.
 
Method Summary
protected  void compileMatchString(java.lang.String match)
          Compile the match string and set the match pattern
 org.eclipse.hyades.logging.adapter.IDirectedGraph createResultGraph(java.lang.Object value)
          Deprecated. This method is deprecated by the appropriate DirectedGraphImpl constructor.
 org.eclipse.hyades.logging.adapter.IDirectedGraph getResultGraph()
          Retrieve the IDirectedGraph created as a result of this rule being run.
 boolean isChildChoice()
          This method is not applicable to substitution rules so always return false.
 boolean isRequiredByParent()
          This method is not applicable to substitution rules so always return false.
protected  java.lang.String matchAndSubstitute(java.lang.String line)
          Check if there is a match and if so do the substitution
protected  java.lang.String positionsToString(java.lang.String line, java.util.HashMap inputs)
          This method iterates over the positions string and builds a new string based upon the preprocessed properties extracted from the message string.
 void prepare(org.w3c.dom.Element node, java.lang.String path)
          Prepare the configuration for this substitution rule.
 java.util.List run(java.lang.String line, java.util.HashMap inputs)
          Run the substitution rule against the message string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

positions

protected java.lang.String positions

match

protected java.lang.String match

substitute

protected java.lang.String substitute

pattern

protected java.util.regex.Pattern pattern

positionsList

protected java.util.List positionsList

processTime

protected boolean processTime

timeParser

protected TimeParser timeParser

substitutionExtensionClass

protected java.lang.String substitutionExtensionClass

statefulExtension

protected org.eclipse.hyades.logging.adapter.parsers.IStatefulSubstitutionExtension statefulExtension

callout

protected boolean callout

calloutNewInstance

protected boolean calloutNewInstance

substitutionExtensionClassClass

protected java.lang.Class substitutionExtensionClassClass

useBuiltin

protected boolean useBuiltin

path

protected java.util.List path

resultGraph

protected org.eclipse.hyades.logging.adapter.IDirectedGraph resultGraph
Constructor Detail

SubstituteStatement

public SubstituteStatement(org.eclipse.hyades.logging.adapter.IParser parser)
Create an SubstituteStatement with the specified IParser object. Configuration information can be retrieved from the IParser object.

Parameters:
parser - - IParser object
Method Detail

prepare

public void prepare(org.w3c.dom.Element node,
                    java.lang.String path)
             throws org.eclipse.hyades.logging.adapter.parsers.PreparationException
Prepare the configuration for this substitution rule. If an error occurs a PreparationException is thrown.

Specified by:
prepare in interface org.eclipse.hyades.logging.adapter.parsers.IStatement
Parameters:
node - - configuration information for this substitution rule
path - - name of the attribute this substitution rule is for
Throws:
org.eclipse.hyades.logging.adapter.parsers.PreparationException - if an error occurs.
See Also:
org.eclipse.hyades.logging.adapter.IStatement#prepare(org.w3c.dom.Element)

compileMatchString

protected void compileMatchString(java.lang.String match)
                           throws org.eclipse.hyades.logging.adapter.parsers.PreparationException
Compile the match string and set the match pattern

Parameters:
match - - the match string to compile
Throws:
org.eclipse.hyades.logging.adapter.parsers.PreparationException

run

public java.util.List run(java.lang.String line,
                          java.util.HashMap inputs)
                   throws org.eclipse.hyades.logging.adapter.AdapterException,
                          org.eclipse.hyades.logging.adapter.parsers.StatementException
Run the substitution rule against the message string. If a match is found, then return the parsed value as a DirectedGraphImpl object. Otherwise throw a StatementException.

Specified by:
run in interface org.eclipse.hyades.logging.adapter.parsers.IStatement
Parameters:
line - - string to perform the matching and parsing on
inputs - - the map containing the preprocessed properties extracted from the message string
Returns:
a List containing only the parsed value stored as a DirectedGraphImpl object
Throws:
org.eclipse.hyades.logging.adapter.AdapterException - if an error occurred during parsing. The exception contains a message indicating what error occurred and possibly a cause exception.
org.eclipse.hyades.logging.adapter.parsers.StatementException - if no data can be parsed for this attribute from the input string.
See Also:
org.eclipse.hyades.logging.adapter.IStatement#run(java.lang.String)

matchAndSubstitute

protected java.lang.String matchAndSubstitute(java.lang.String line)
Check if there is a match and if so do the substitution

Parameters:
line - to check for pattern match and to do substitution on
Returns:
the resulting string from matching and substitution

positionsToString

protected java.lang.String positionsToString(java.lang.String line,
                                             java.util.HashMap inputs)
This method iterates over the positions string and builds a new string based upon the preprocessed properties extracted from the message string. For each position that is a key into the preprocessed properties map we extract the value and append it to the previous. All of the values are separated by the postion separator.

Parameters:
line - - the positions string to parse
inputs - - the map containing the preprocessed properties extracted from the message string
Returns:
a new string containing the position values

getResultGraph

public org.eclipse.hyades.logging.adapter.IDirectedGraph getResultGraph()
Retrieve the IDirectedGraph created as a result of this rule being run.

Returns:
the parsing result as an IDirectedGraph object.

createResultGraph

public org.eclipse.hyades.logging.adapter.IDirectedGraph createResultGraph(java.lang.Object value)
Deprecated. This method is deprecated by the appropriate DirectedGraphImpl constructor.

Create the IDirectedGraph for this rule with a specific value.

Parameters:
value - - value object
Returns:
the IDirectedGraph

isRequiredByParent

public boolean isRequiredByParent()
This method is not applicable to substitution rules so always return false.

Specified by:
isRequiredByParent in interface org.eclipse.hyades.logging.adapter.parsers.IStatement
See Also:
IStatement.isRequiredByParent()

isChildChoice

public boolean isChildChoice()
This method is not applicable to substitution rules so always return false.

Specified by:
isChildChoice in interface org.eclipse.hyades.logging.adapter.parsers.IStatement
See Also:
IStatement.isChildChoice()

TPTP 4.3.0 Monitoring Tools Project
Internal API Specification