Java Doc for PrefixResolver.java in  » Web-Server » simple » simple » http » load » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » simple » simple.http.load 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   simple.util.xml.Traverser
      simple.http.load.PrefixResolver

PrefixResolver
public class PrefixResolver extends Traverser (Code)
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.
author:
   Niall Gallagher




Constructor Summary
public  PrefixResolver(Locator lookup)
     Constructor for the PrefixResolver.
public  PrefixResolver(Locator lookup, int max)
     Constructor for the PrefixResolver.

Method Summary
protected  voidcommit(Node node)
     This is used to commit any data that has been collected during the processing of an element node.
protected  voidfinish()
     Used to prepare the prefix paths so that they can be matched with relative URI paths quickly.
public  StringgetClass(String name)
     Used to resolve the class name using a service name.
public  ConfigurationgetConfiguration(String name)
     This method is used retrieve properties for a service by using the service name.
public  StringgetName(String prefix)
     Used to resolve the service name using a path prefix.
public  StringgetPath(String normal)
     Used to acquire the path relative to the prefix.
public  StringgetPrefix(String normal)
     Used to get the prefix path for the given relative URI path, which must be normalized.
protected  voidprocess(Node node)
     This is used to process a element node extracted from the XML document.
protected  voidstart()
     This method is used to initialize this resolver.


Constructor Detail
PrefixResolver
public PrefixResolver(Locator lookup)(Code)
Constructor for the 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.
Parameters:
  lookup - the locator used to find the configuration



PrefixResolver
public PrefixResolver(Locator lookup, int max)(Code)
Constructor for the 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.
Parameters:
  lookup - the object used to perform configuration
Parameters:
  max - this is the maximum path length expected





Method Detail
commit
protected void commit(Node node)(Code)
This is used to commit any data that has been collected during the processing of an element node. The elements of interest to this method are the "service" and "property" elements. This will save the properties collected for each "service" element.
Parameters:
  node - this is the node to be committed by this method



finish
protected void finish()(Code)
Used to prepare the prefix paths so that they can be matched with relative URI paths quickly. The XML configuration file used to specify the prefix paths with the service and class names will be loaded unordered into a HashMap. This ensures the acquired keys are sorted for searching.



getClass
public String getClass(String name)(Code)
Used to resolve the class name using a service name. This is required to resolve the class name once the service name has been acquired from the getName method. If there is no match for the service name then null is returned.
Parameters:
  name - this is the service name to get a class name for the class name that matches the service name given



getConfiguration
public Configuration getConfiguration(String name)(Code)
This method is used retrieve properties for a service by using the service name. This will acquire the properties if any for the named service instance. The properties will contain zero or more name value pairs. If no properties are associated with the service the instance returned will be an empty map rather than a null object.
Parameters:
  name - this is the name of the service instance returns a properties object for configuration



getName
public String getName(String prefix)(Code)
Used to resolve the service name using a path prefix. This is required to resolve the service name once the prefix of the path is acquired from the getPrefix method. If there is no match for the prefix then null is returned.
Parameters:
  prefix - the path prefix to acquire a service name for the service name that matches the prefix path given



getPath
public String getPath(String normal)(Code)
Used to acquire the path relative to the prefix. This will return the path as it is relative to the prefix resolved for the given normalized path. This will remove the start of the given normalized path if it matches a prefix path.
Parameters:
  normal - the normalized URI path to get a path for the full path once its prefix has been removed



getPrefix
public String getPrefix(String normal)(Code)
Used to get the prefix path for the given relative URI path, which must be normalized. This will attempt to match the start of the given path to the highest directory path. For example, given the URI path /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.
Parameters:
  normal - the normalized URI path to get a prefix for the highest matched directory for the given path



process
protected void process(Node node)(Code)
This is used to process a element node extracted from the XML document. It will be given each element that exists within the document. The elements of interest to this implementation are the "property", "match", "section", and "service" elements.
Parameters:
  node - this is the node to be evaluated by this method



start
protected void start()(Code)
This method is used to initialize this resolver. This will clear out all data structures used in the parsing process. It is invoked before the process method is used. to evaluate the element nodes extracted from the XML document.



Methods inherited from simple.util.xml.Traverser
protected void commit(Node node) throws Exception(Code)(Java Doc)
protected void finish() throws Exception(Code)(Java Doc)
public void parse(String source) throws Exception(Code)(Java Doc)
public void parse(File source) throws Exception(Code)(Java Doc)
public void parse(File source, String charset) throws Exception(Code)(Java Doc)
public void parse(InputStream source) throws Exception(Code)(Java Doc)
public void parse(InputStream source, String charset) throws Exception(Code)(Java Doc)
public void parse(Reader source) throws Exception(Code)(Java Doc)
public void parse(Element source) throws Exception(Code)(Java Doc)
public void parse(Node source) throws Exception(Code)(Java Doc)
abstract protected void process(Node node) throws Exception(Code)(Java Doc)
abstract protected void start() throws Exception(Code)(Java Doc)
protected void traverse(Element node) throws Exception(Code)(Java Doc)
protected void traverse(Element node, int count) throws Exception(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.