net.larsan.urd.jndi
Class ContextVisitor

java.lang.Object
  |
  +--net.larsan.urd.jndi.ContextVisitor
Direct Known Subclasses:
AutoStartTask, StartAllTask, StopAllTask

public abstract class ContextVisitor
extends java.lang.Object

An abstract JNDI context visitor. The visitor is created with an error handler to report problems to and then started with optional filter for the scanning to use.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Field Summary
protected  javax.naming.Context context
           
protected  ErrorHandler handler
           
 
Constructor Summary
ContextVisitor(javax.naming.Context context, ErrorHandler handler)
          Create visitor
 
Method Summary
 void start(java.lang.Class[] classes)
          Scan the context for object.
 void start(java.lang.String filter)
          Scan the context for object.
 void start(java.lang.String filter, java.lang.Class[] classes)
          Scan the context for object.
abstract  void visit(java.lang.String name, java.lang.Object o)
          Visit an object bound to the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected javax.naming.Context context

handler

protected ErrorHandler handler
Constructor Detail

ContextVisitor

public ContextVisitor(javax.naming.Context context,
                      ErrorHandler handler)
Create visitor

Method Detail

visit

public abstract void visit(java.lang.String name,
                           java.lang.Object o)
Visit an object bound to the context.

Parameters:
name - Context name of the object
o - Object to visit

start

public void start(java.lang.Class[] classes)
Scan the context for object. Only return objects of the classes available in the parameter array.

Parameters:
classes - Class types to visit, may be null

start

public void start(java.lang.String filter)
           throws java.util.regex.PatternSyntaxException
Scan the context for object. Only return objects whose name matches the given regular expression.

Parameters:
filter - Regexp filter to match name against
Throws:
java.util.regex.PatternSyntaxException - If the regexp filter is invalid

start

public void start(java.lang.String filter,
                  java.lang.Class[] classes)
           throws java.util.regex.PatternSyntaxException
Scan the context for object. Only return objects of the classes available in the parameter array. Also filter the context names according to the regexp filter.

If all of the parameters are null the visitor will visit every object found.

Parameters:
filter - Regexp name filter, may be null
classes - Class types to visit, may be null
Throws:
java.util.regex.PatternSyntaxException - If the regexp filter is invalid