|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimple.util.xml.Traverser
simple.http.load.PrefixResolver
public class PrefixResolver
The PrefixResolver
is used to extract service names
and types from an XML configuration file. Each service name can
be associated with match and prepare XML elements, which can be
used to determine the URI targets used to locate the services
and the properties that are be used to initialize the service.
This is used to implement a scheme similar to the Java Servlet context path mapping scheme. In this scheme a prefix path is used to resolve a Servlet, and the remaining path part is then used to acquire a resource relative the the Servlet context.
Constructor Summary | |
---|---|
PrefixResolver(Locator lookup)
Constructor for the PrefixResolver . |
|
PrefixResolver(Locator lookup,
int max)
Constructor for the PrefixResolver . |
Method Summary | |
---|---|
protected void |
commit(Node node)
This is used to commit any data that has been collected during the processing of an element node. |
protected void |
finish()
Used to prepare the prefix paths so that they can be matched with relative URI paths quickly. |
java.lang.String |
getClass(java.lang.String name)
Used to resolve the class name using a service name. |
Configuration |
getConfiguration(java.lang.String name)
This method is used retrieve properties for a service by using the service name. |
java.lang.String |
getName(java.lang.String prefix)
Used to resolve the service name using a path prefix. |
java.lang.String |
getPath(java.lang.String normal)
Used to acquire the path relative to the prefix. |
java.lang.String |
getPrefix(java.lang.String normal)
Used to get the prefix path for the given relative URI path, which must be normalized. |
protected void |
process(Node node)
This is used to process a element node extracted from the XML document. |
protected void |
start()
This method is used to initialize this resolver. |
Methods inherited from class simple.util.xml.Traverser |
---|
parse, parse, parse, parse, parse, parse, parse, parse, traverse, traverse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PrefixResolver(Locator lookup)
PrefixResolver
. This uses
a configuration file located with the Locator
object supplied. Once the configuration file is located the
service names can be resolved for arbitrary URI paths.
lookup
- the locator used to find the configurationpublic PrefixResolver(Locator lookup, int max)
PrefixResolver
. This uses
a configuration file located with the Locator
object supplied. Once the configuration file is located the
service names can be resolved for arbitrary URI paths.
This includes a parameter that enables a maximum expected path length to be entered. This helps to optimize the resolution of a path prefix. This should typically be at least big enough to include the maximum possible path.
lookup
- the object used to perform configurationmax
- this is the maximum path length expectedMethod Detail |
---|
public Configuration getConfiguration(java.lang.String name)
name
- this is the name of the service instance
public java.lang.String getClass(java.lang.String name)
getName
method. If there
is no match for the service name then null is returned.
name
- this is the service name to get a class name for
public java.lang.String getName(java.lang.String prefix)
getPrefix
method. If
there is no match for the prefix then null is returned.
prefix
- the path prefix to acquire a service name for
public java.lang.String getPrefix(java.lang.String normal)
/pub/bin/README
,
the start of the path will be compared for a prefix. So it
should match /pub/bin/
, /bin/
,
and finally /
in that order.
normal
- the normalized URI path to get a prefix for
public java.lang.String getPath(java.lang.String normal)
normal
- the normalized URI path to get a path for
protected void start()
process
method is used.
to evaluate the element nodes extracted from the XML document.
start
in class Traverser
protected void process(Node node)
process
in class Traverser
node
- this is the node to be evaluated by this methodprotected void commit(Node node)
commit
in class Traverser
node
- this is the node to be committed by this methodprotected void finish()
HashMap
.
This ensures the acquired keys are sorted for searching.
finish
in class Traverser
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |