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

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

public class MultiplexingVisitor
extends java.lang.Object
implements HeaderVisitor

A basic visitor that delegates to some array of other visitors. This visitor is used when multiple are plugged into the parser - to ensure the standard visitor still runs, in addition to the user specified visitors. Concurrent Semantics
Threadsafe.

Author:
Andy Clement

Field Summary
private static HeaderVisitor[] NONE
           
private  HeaderVisitor[] visitors
           
 
Constructor Summary
MultiplexingVisitor(HeaderVisitor... visitors)
           
 
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 name)
          Called to visit a symbolic name.
 void visitUniqueName(java.lang.String name)
          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

NONE

private static final HeaderVisitor[] NONE

visitors

private HeaderVisitor[] visitors
Constructor Detail

MultiplexingVisitor

public MultiplexingVisitor(HeaderVisitor... visitors)
Method Detail

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

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

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 name)
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

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

visitUniqueName

public void visitUniqueName(java.lang.String name)
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

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

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