com.springsource.util.osgi.manifest.parse.standard
Class DebugVisitor

java.lang.Object
  extended by com.springsource.util.osgi.manifest.parse.standard.DebugVisitor
All Implemented Interfaces:
HeaderVisitor

public class DebugVisitor
extends java.lang.Object
implements HeaderVisitor

Simple debug visitor that can be plugged into the parser to observe the visiting order. Plugging it in is as easy as using the StandardHeaderParser constructor that takes a visitor: new StandardHeaderParser(new DebugVisitor()). By default the logged output will go to System.out - but a difference PrintStream can be specified through the DebugVisitor constructor. Concurrent Semantics
Threadsafe.

Author:
Andy Clement

Field Summary
private  java.io.PrintStream printStream
           
 
Constructor Summary
DebugVisitor()
           
DebugVisitor(java.io.PrintStream ps)
           
 
Method Summary
 void clauseEnded()
          Called when a clause ends.
 void endvisit()
          Called when the end of the input has been reached.
 HeaderDeclaration getFirstHeaderDeclaration()
           
 java.util.List<HeaderDeclaration> getHeaderDeclarations()
           
 void initialize()
          Called ahead of parsing a new header
 void visitAttribute(java.lang.String name, java.lang.String value)
          Visit a new attribute (parsed from input of the form name=value)
 void visitDirective(java.lang.String name, java.lang.String value)
          Visit a new directive (parsed from input of the form name:=value)
 void visitSymbolicName(java.lang.String symbolicName)
          Called to visit a symbolic name.
 void visitUniqueName(java.lang.String uniqueName)
          Called to visit a unique name.
 void visitWildcardName(java.lang.String name)
          Called to visit a wildcard name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printStream

private java.io.PrintStream printStream
Constructor Detail

DebugVisitor

public DebugVisitor()

DebugVisitor

public DebugVisitor(java.io.PrintStream ps)
Method Detail

visitAttribute

public void visitAttribute(java.lang.String name,
                           java.lang.String value)
Description copied from interface: HeaderVisitor
Visit a new attribute (parsed from input of the form name=value)

Specified by:
visitAttribute in interface HeaderVisitor

visitDirective

public void visitDirective(java.lang.String name,
                           java.lang.String value)
Description copied from interface: HeaderVisitor
Visit a new directive (parsed from input of the form name:=value)

Specified by:
visitDirective in interface HeaderVisitor

visitSymbolicName

public void visitSymbolicName(java.lang.String symbolicName)
Description copied from interface: HeaderVisitor
Called to visit a symbolic name. These are of the form: "symbolic-name :: = token('.'token)*". So basically a sequence of dot separated tokens.

Specified by:
visitSymbolicName in interface HeaderVisitor

visitUniqueName

public void visitUniqueName(java.lang.String uniqueName)
Description copied from interface: HeaderVisitor
Called to visit a unique name. These are of the form: "unique-name :: = identifier('.'identifier)*". So basically a sequence of dot separated identifiers..

Specified by:
visitUniqueName in interface HeaderVisitor

visitWildcardName

public void visitWildcardName(java.lang.String name)
Description copied from interface: HeaderVisitor
Called to visit a wildcard name. These are similar to a unique name but wildcards are permitted. These are valid wildcarded names: '*' or 'com.foo.*' or 'com.foo.goo'.

Specified by:
visitWildcardName in interface HeaderVisitor

endvisit

public void endvisit()
Description copied from interface: HeaderVisitor
Called when the end of the input has been reached.

Specified by:
endvisit in interface HeaderVisitor

clauseEnded

public void clauseEnded()
Description copied from interface: HeaderVisitor
Called when a clause ends. Clauses are comma separated: header=clause (',' clause)*. It is a sign that a new clause is about to start.

Specified by:
clauseEnded in interface HeaderVisitor

getHeaderDeclarations

public java.util.List<HeaderDeclaration> getHeaderDeclarations()
Specified by:
getHeaderDeclarations in interface HeaderVisitor
Returns:
a list of all HeaderDeclarations if this visitor has been collecting the information. Empty list if nothing has been collected

getFirstHeaderDeclaration

public HeaderDeclaration getFirstHeaderDeclaration()
Specified by:
getFirstHeaderDeclaration in interface HeaderVisitor
Returns:
the first (and probably only) HeaderDeclaration, otherwise null

initialize

public void initialize()
Description copied from interface: HeaderVisitor
Called ahead of parsing a new header

Specified by:
initialize in interface HeaderVisitor