Java Doc for Catalog.java in  » 6.0-JDK-Modules » jaxb-xjc » com » sun » org » apache » xml » internal » resolver » 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 » 6.0 JDK Modules » jaxb xjc » com.sun.org.apache.xml.internal.resolver 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.org.apache.xml.internal.resolver.Catalog

All known Subclasses:   com.sun.org.apache.xml.internal.resolver.Resolver,
Catalog
public class Catalog (Code)
Represents OASIS Open Catalog files.

This class implements the semantics of OASIS Open Catalog files (defined by OASIS Technical Resolution 9401:1997 (Amendment 2 to TR 9401)).

The primary purpose of the Catalog is to associate resources in the document with local system identifiers. Some entities (document types, XML entities, and notations) have names and all of them can have either public or system identifiers or both. (In XML, only a notation can have a public identifier without a system identifier, but the methods implemented in this class obey the Catalog semantics from the SGML days when system identifiers were optional.)

The system identifiers returned by the resolution methods in this class are valid, i.e. usable by, and in fact constructed by, the java.net.URL class. Unfortunately, this class seems to behave in somewhat non-standard ways and the system identifiers returned may not be directly usable in a browser or filesystem context.

This class recognizes all of the Catalog entries defined in TR9401:1997:

  • BASE changes the base URI for resolving relative system identifiers. The initial base URI is the URI of the location of the catalog (which is, in turn, relative to the location of the current working directory at startup, as returned by the user.dir system property).
  • CATALOG processes other catalog files. An included catalog occurs logically at the end of the including catalog.
  • DELEGATE_PUBLIC specifies alternate catalogs for some public identifiers. The delegated catalogs are not loaded until they are needed, but they are cached once loaded.
  • DELEGATE_SYSTEM specifies alternate catalogs for some system identifiers. The delegated catalogs are not loaded until they are needed, but they are cached once loaded.
  • DELEGATE_URI specifies alternate catalogs for some URIs. The delegated catalogs are not loaded until they are needed, but they are cached once loaded.
  • REWRITE_SYSTEM specifies alternate prefix for a system identifier.
  • REWRITE_URI specifies alternate prefix for a URI.
  • SYSTEM_SUFFIX maps any system identifier that ends with a particular suffix to another system identifier.
  • URI_SUFFIX maps any URI that ends with a particular suffix to another URI.
  • DOCTYPE associates the names of root elements with URIs. (In other words, an XML processor might infer the doctype of an XML document that does not include a doctype declaration by looking for the DOCTYPE entry in the catalog which matches the name of the root element of the document.)
  • DOCUMENT provides a default document.
  • DTDDECL recognized and silently ignored. Not relevant for XML.
  • ENTITY associates entity names with URIs.
  • LINKTYPE recognized and silently ignored. Not relevant for XML.
  • NOTATION associates notation names with URIs.
  • OVERRIDE changes the override behavior. Initial behavior is set by the system property xml.catalog.override. The default initial behavior is 'YES', that is, entries in the catalog override system identifiers specified in the document.
  • PUBLIC maps a public identifier to a system identifier.
  • SGMLDECL recognized and silently ignored. Not relevant for XML.
  • SYSTEM maps a system identifier to another system identifier.
  • URI maps a URI to another URI.

Note that BASE entries are treated as described by RFC2396. In particular, this has the counter-intuitive property that after a BASE entry identifing "http://example.com/a/b/c" as the base URI, the relative URI "foo" is resolved to the absolute URI "http://example.com/a/b/foo". You must provide the trailing slash if you do not want the final component of the path to be discarded as a filename would in a URI for a resource: "http://example.com/a/b/c/".

Note that subordinate catalogs (all catalogs except the first, including CATALOG and DELEGATE* catalogs) are only loaded if and when they are required.

This class relies on classes which implement the CatalogReader interface to actually load catalog files. This allows the catalog semantics to be implemented for TR9401 text-based catalogs, XML catalogs, or any number of other storage formats.

Additional catalogs may also be loaded with the Catalog.parseCatalog method.

Change Log:

2.0

Rewrite to use CatalogReaders.

1.1

Allow quoted components in xml.catalog.files so that URLs containing colons can be used on Unix. The string passed to xml.catalog.files can now have the form:

 unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars'
 

(Where ":" is the separater character in this example.)

If an unquoted path contains an embedded double or single quote character, no special processig is performed on that character. No path can contain separater characters, double, and single quotes simultaneously.

Fix bug in calculation of BASE entries: if a catalog contains multiple BASE entries, each is relative to the preceding base, not the default base URI of the catalog.

1.0.1

Fixed a bug in the calculation of the list of subordinate catalogs. This bug caused an infinite loop where parsing would alternately process two catalogs indefinitely.


See Also:   CatalogReader
See Also:   CatalogEntry
author:
   Norman Walsh
author:
   Norman.Walsh@Sun.COM
version:
   1.0
version:
  

Derived from public domain code originally published by Arbortext,
version:
   Inc.



Field Summary
final public static  intBASE
     The BASE Catalog Entry type.
final public static  intCATALOG
     The CATALOG Catalog Entry type.
final public static  intDELEGATE_PUBLIC
     The DELEGATE_PUBLIC Catalog Entry type.
final public static  intDELEGATE_SYSTEM
     The DELEGATE_SYSTEM Catalog Entry type.
final public static  intDELEGATE_URI
     The DELEGATE_URI Catalog Entry type.
final public static  intDOCTYPE
     The DOCTYPE Catalog Entry type.
final public static  intDOCUMENT
     The DOCUMENT Catalog Entry type.
final public static  intDTDDECL
     The DTDDECL Catalog Entry type.
final public static  intENTITY
     The ENTITY Catalog Entry type.
final public static  intLINKTYPE
     The LINKTYPE Catalog Entry type.
final public static  intNOTATION
     The NOTATION Catalog Entry type.
final public static  intOVERRIDE
     The OVERRIDE Catalog Entry type.
final public static  intPUBLIC
     The PUBLIC Catalog Entry type.
final public static  intREWRITE_SYSTEM
     The REWRITE_SYSTEM Catalog Entry type.
final public static  intREWRITE_URI
     The REWRITE_URI Catalog Entry type.
final public static  intSGMLDECL
     The SGMLDECL Catalog Entry type.
final public static  intSYSTEM
     The SYSTEM Catalog Entry type.
final public static  intSYSTEM_SUFFIX
     The SYSTEM_SUFFIX Catalog Entry type.
final public static  intURI
     The URI Catalog Entry type.
final public static  intURI_SUFFIX
     The URI_SUFFIX Catalog Entry type.
protected  URLbase
     The base URI for relative system identifiers in the catalog.
protected  URLcatalogCwd
     The base URI of the Catalog file currently being parsed.
protected  VectorcatalogEntries
     The catalog entries currently known to the system.
protected  VectorcatalogFiles
     A vector of catalog files to be loaded.
protected  CatalogManagercatalogManager
     The catalog manager in use for this instance.
protected  Vectorcatalogs
     A vector of Catalogs.

The semantics of Catalog resolution are such that each catalog is effectively a list of Catalogs (in other words, a recursive list of Catalog instances).

Catalogs that are processed as the result of CATALOG or DELEGATE* entries are subordinate to the catalog that contained them, but they may in turn have subordinate catalogs.

Catalogs are only loaded when they are needed, so this vector initially contains a list of Catalog filenames (URLs).

protected  booleandefault_override
     The default initial override setting.
protected  VectorlocalCatalogFiles
     A vector of catalog files constructed during processing of CATALOG entries in the current catalog.

This two-level system is actually necessary to correctly implement the semantics of the CATALOG entry.

protected  VectorlocalDelegate
     A vector of DELEGATE* Catalog entries constructed during processing of the Catalog.

This two-level system has two purposes; first, it allows us to sort the DELEGATE* entries by the length of the partial public identifier so that a linear search encounters them in the correct order and second, it puts them all at the end of the Catalog.

When processing reaches the end of each catalog file, any elements on this vector are added to the end of the catalogEntries vector.

protected  VectorreaderArr
     A vector of CatalogReaders.

This vector contains all of the readers in the order that they were added.

protected  HashtablereaderMap
     A hash of CatalogReaders.

This hash maps MIME types to elements in the readerArr vector.


Constructor Summary
public  Catalog()
     Constructs an empty Catalog.
public  Catalog(CatalogManager manager)
     Constructs an empty Catalog with a specific CatalogManager.

Method Summary
protected  voidaddDelegate(CatalogEntry entry)
     Add to the current list of delegated catalogs.
public  voidaddEntry(CatalogEntry entry)
     Cleanup and process a Catalog entry.
public  voidaddReader(String mimeType, CatalogReader reader)
     Add a new CatalogReader to the Catalog.

This method allows you to add a new CatalogReader to the catalog.

protected  voidcopyReaders(Catalog newCatalog)
     Copies the reader list from the current Catalog to a new Catalog.
protected  StringencodedByte(int b)
     Perform %-encoding on a single byte.
Parameters:
  b - The 8-bit integer that represents th byte.
protected  StringfixSlashes(String sysid)
     Replace backslashes with forward slashes.
public  CatalogManagergetCatalogManager()
     Return the CatalogManager used by this catalog.
public  StringgetCurrentBase()
     Returns the current base URI.
public  StringgetDefaultOverride()
     Returns the default override setting associated with this catalog.
public  voidloadSystemCatalogs()
     Load the system catalog files.
protected  StringmakeAbsolute(String sysid)
     Construct an absolute URI from a relative one, using the current base URI.
protected  CatalognewCatalog()
     Create a new Catalog object.

This method constructs a new instance of the running Catalog class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog). All new catalogs are managed by the same CatalogManager.

N.B.

protected  StringnormalizeURI(String uriref)
     Perform character normalization on a URI reference.
public  voidparseAllCatalogs()
     Parse all subordinate catalogs.
public synchronized  voidparseCatalog(String fileName)
     Parse a catalog file, augmenting internal data structures.
public synchronized  voidparseCatalog(String mimeType, InputStream is)
     Parse a catalog file, augmenting internal data structures.
public synchronized  voidparseCatalog(URL aUrl)
     Parse a catalog document, augmenting internal data structures.

This method supports catalog files stored in jar files: e.g., jar:file:///path/to/filename.jar!/path/to/catalog.xml".

protected synchronized  voidparseCatalogFile(String fileName)
     Parse a single catalog file, augmenting internal data structures.
protected synchronized  voidparsePendingCatalogs()
     Parse all of the pending catalogs.
public  StringresolveDoctype(String entityName, String publicId, String systemId)
     Return the applicable DOCTYPE system identifier.
Parameters:
  entityName - The name of the entity (element) for whicha doctype is required.
Parameters:
  publicId - The nominal public identifier for the doctype(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the doctype(as provided in the source document).
public  StringresolveDocument()
     Return the applicable DOCUMENT entry.
public  StringresolveEntity(String entityName, String publicId, String systemId)
     Return the applicable ENTITY system identifier.
Parameters:
  entityName - The name of the entity for whicha system identifier is required.
Parameters:
  publicId - The nominal public identifier for the entity(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the entity(as provided in the source document).
protected synchronized  StringresolveLocalPublic(int entityType, String entityName, String publicId, String systemId)
     Return the applicable PUBLIC or SYSTEM identifier.

This method searches the Catalog and returns the system identifier specified for the given system or public identifiers. If no appropriate PUBLIC or SYSTEM entry is found in the Catalog, delegated Catalogs are interrogated.

There are four possible cases:

  • If the system identifier provided matches a SYSTEM entry in the current catalog, the SYSTEM entry is returned.
  • If the system identifier is not null, the PUBLIC entries that were encountered when OVERRIDE YES was in effect are interrogated and the first matching entry is returned.
  • If the system identifier is null, then all of the PUBLIC entries are interrogated and the first matching entry is returned.
protected  StringresolveLocalSystem(String systemId)
     Return the applicable SYSTEM system identifier in this catalog.
protected  StringresolveLocalURI(String uri)
     Return the applicable URI in this catalog.
public  StringresolveNotation(String notationName, String publicId, String systemId)
     Return the applicable NOTATION system identifier.
Parameters:
  notationName - The name of the notation for whicha doctype is required.
Parameters:
  publicId - The nominal public identifier for the notation(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the notation(as provided in the source document).
public  StringresolvePublic(String publicId, String systemId)
     Return the applicable PUBLIC or SYSTEM identifier.

This method searches the Catalog and returns the system identifier specified for the given system or public identifiers.

protected synchronized  StringresolveSubordinateCatalogs(int entityType, String entityName, String publicId, String systemId)
     Search the subordinate catalogs, in order, looking for a match.

This method searches the Catalog and returns the system identifier specified for the given entity type with the given name, public, and system identifiers.

public  StringresolveSystem(String systemId)
     Return the applicable SYSTEM system identifier.

If a SYSTEM entry exists in the Catalog for the system ID specified, return the mapped value.

On Windows-based operating systems, the comparison between the system identifier provided and the SYSTEM entries in the Catalog is case-insensitive.


Parameters:
  systemId - The system ID to locate in the catalog.
public  StringresolveURI(String uri)
     Return the applicable URI.

If a URI entry exists in the Catalog for the URI specified, return the mapped value.

URI comparison is case sensitive.


Parameters:
  uri - The URI to locate in the catalog.
public  voidsetCatalogManager(CatalogManager manager)
     Establish the CatalogManager used by this catalog.
public  voidsetupReaders()
     Setup readers.
public  voidunknownEntry(Vector strings)
     Handle unknown CatalogEntry types.

Field Detail
BASE
final public static int BASE(Code)
The BASE Catalog Entry type.



CATALOG
final public static int CATALOG(Code)
The CATALOG Catalog Entry type.



DELEGATE_PUBLIC
final public static int DELEGATE_PUBLIC(Code)
The DELEGATE_PUBLIC Catalog Entry type.



DELEGATE_SYSTEM
final public static int DELEGATE_SYSTEM(Code)
The DELEGATE_SYSTEM Catalog Entry type.



DELEGATE_URI
final public static int DELEGATE_URI(Code)
The DELEGATE_URI Catalog Entry type.



DOCTYPE
final public static int DOCTYPE(Code)
The DOCTYPE Catalog Entry type.



DOCUMENT
final public static int DOCUMENT(Code)
The DOCUMENT Catalog Entry type.



DTDDECL
final public static int DTDDECL(Code)
The DTDDECL Catalog Entry type.



ENTITY
final public static int ENTITY(Code)
The ENTITY Catalog Entry type.



LINKTYPE
final public static int LINKTYPE(Code)
The LINKTYPE Catalog Entry type.



NOTATION
final public static int NOTATION(Code)
The NOTATION Catalog Entry type.



OVERRIDE
final public static int OVERRIDE(Code)
The OVERRIDE Catalog Entry type.



PUBLIC
final public static int PUBLIC(Code)
The PUBLIC Catalog Entry type.



REWRITE_SYSTEM
final public static int REWRITE_SYSTEM(Code)
The REWRITE_SYSTEM Catalog Entry type.



REWRITE_URI
final public static int REWRITE_URI(Code)
The REWRITE_URI Catalog Entry type.



SGMLDECL
final public static int SGMLDECL(Code)
The SGMLDECL Catalog Entry type.



SYSTEM
final public static int SYSTEM(Code)
The SYSTEM Catalog Entry type.



SYSTEM_SUFFIX
final public static int SYSTEM_SUFFIX(Code)
The SYSTEM_SUFFIX Catalog Entry type.



URI
final public static int URI(Code)
The URI Catalog Entry type.



URI_SUFFIX
final public static int URI_SUFFIX(Code)
The URI_SUFFIX Catalog Entry type.



base
protected URL base(Code)
The base URI for relative system identifiers in the catalog. This may be changed by BASE entries in the catalog.



catalogCwd
protected URL catalogCwd(Code)
The base URI of the Catalog file currently being parsed.



catalogEntries
protected Vector catalogEntries(Code)
The catalog entries currently known to the system.



catalogFiles
protected Vector catalogFiles(Code)
A vector of catalog files to be loaded.

This list is initially established by loadSystemCatalogs when it parses the system catalog list, but CATALOG entries may contribute to it during the course of parsing.


See Also:   Catalog.loadSystemCatalogs
See Also:   Catalog.localCatalogFiles



catalogManager
protected CatalogManager catalogManager(Code)
The catalog manager in use for this instance.



catalogs
protected Vector catalogs(Code)
A vector of Catalogs.

The semantics of Catalog resolution are such that each catalog is effectively a list of Catalogs (in other words, a recursive list of Catalog instances).

Catalogs that are processed as the result of CATALOG or DELEGATE* entries are subordinate to the catalog that contained them, but they may in turn have subordinate catalogs.

Catalogs are only loaded when they are needed, so this vector initially contains a list of Catalog filenames (URLs). If, during processing, one of these catalogs has to be loaded, the resulting Catalog object is placed in the vector, effectively caching it for the next query.




default_override
protected boolean default_override(Code)
The default initial override setting.



localCatalogFiles
protected Vector localCatalogFiles(Code)
A vector of catalog files constructed during processing of CATALOG entries in the current catalog.

This two-level system is actually necessary to correctly implement the semantics of the CATALOG entry. If one catalog file includes another with a CATALOG entry, the included catalog logically occurs at the end of the including catalog, and after any preceding CATALOG entries. In other words, the CATALOG entry cannot insert anything into the middle of a catalog file.

When processing reaches the end of each catalog files, any elements on this vector are added to the front of the catalogFiles vector.


See Also:   Catalog.catalogFiles



localDelegate
protected Vector localDelegate(Code)
A vector of DELEGATE* Catalog entries constructed during processing of the Catalog.

This two-level system has two purposes; first, it allows us to sort the DELEGATE* entries by the length of the partial public identifier so that a linear search encounters them in the correct order and second, it puts them all at the end of the Catalog.

When processing reaches the end of each catalog file, any elements on this vector are added to the end of the catalogEntries vector. This assures that matching PUBLIC keywords are encountered before DELEGATE* entries.




readerArr
protected Vector readerArr(Code)
A vector of CatalogReaders.

This vector contains all of the readers in the order that they were added. In the event that a catalog is read from a file, where the MIME type is unknown, each reader is attempted in turn until one succeeds.




readerMap
protected Hashtable readerMap(Code)
A hash of CatalogReaders.

This hash maps MIME types to elements in the readerArr vector. This allows the Catalog to quickly locate the reader for a particular MIME type.





Constructor Detail
Catalog
public Catalog()(Code)
Constructs an empty Catalog.

The constructor interrogates the relevant system properties using the default (static) CatalogManager and initializes the catalog data structures.




Catalog
public Catalog(CatalogManager manager)(Code)
Constructs an empty Catalog with a specific CatalogManager.

The constructor interrogates the relevant system properties using the specified Catalog Manager and initializes the catalog data structures.





Method Detail
addDelegate
protected void addDelegate(CatalogEntry entry)(Code)
Add to the current list of delegated catalogs.

This method always constructs the Catalog.localDelegate vector so that it is ordered by length of partial public identifier.


Parameters:
  entry - The DELEGATE catalog entry



addEntry
public void addEntry(CatalogEntry entry)(Code)
Cleanup and process a Catalog entry.

This method processes each Catalog entry, changing mapped relative system identifiers into absolute ones (based on the current base URI), and maintaining other information about the current catalog.


Parameters:
  entry - The CatalogEntry to process.



addReader
public void addReader(String mimeType, CatalogReader reader)(Code)
Add a new CatalogReader to the Catalog.

This method allows you to add a new CatalogReader to the catalog. The reader will be associated with the specified mimeType. You can only have one reader per mimeType.

In the absence of a mimeType (e.g., when reading a catalog directly from a file on the local system), the readers are attempted in the order that you add them to the Catalog.

Note that subordinate catalogs (created by CATALOG or DELEGATE* entries) get a copy of the set of readers present in the primary catalog when they are created. Readers added subsequently will not be available. For this reason, it is best to add all of the readers before the first call to parse a catalog.


Parameters:
  mimeType - The MIME type associated with this reader.
Parameters:
  reader - The CatalogReader to use.



copyReaders
protected void copyReaders(Catalog newCatalog)(Code)
Copies the reader list from the current Catalog to a new Catalog.

This method is used internally when constructing a new catalog. It copies the current reader associations over to the new catalog.


Parameters:
  newCatalog - The new Catalog.



encodedByte
protected String encodedByte(int b)(Code)
Perform %-encoding on a single byte.
Parameters:
  b - The 8-bit integer that represents th byte. (Bytes are signedbut encoding needs to look at the bytes unsigned.) The %-encoded string for the byte in question.



fixSlashes
protected String fixSlashes(String sysid)(Code)
Replace backslashes with forward slashes. (URLs always use forward slashes.)
Parameters:
  sysid - The input system identifier. The same system identifier with backslashes turned intoforward slashes.



getCatalogManager
public CatalogManager getCatalogManager()(Code)
Return the CatalogManager used by this catalog.



getCurrentBase
public String getCurrentBase()(Code)
Returns the current base URI.



getDefaultOverride
public String getDefaultOverride()(Code)
Returns the default override setting associated with this catalog.

All catalog files loaded by this catalog will have the initial override setting specified by this default.




loadSystemCatalogs
public void loadSystemCatalogs() throws MalformedURLException, IOException(Code)
Load the system catalog files.

The method adds all of the catalogs specified in the xml.catalog.files property to the Catalog list.


throws:
  MalformedURLException - One of the system catalogs isidentified with a filename that is not a valid URL.
throws:
  IOException - One of the system catalogs cannot be read.



makeAbsolute
protected String makeAbsolute(String sysid)(Code)
Construct an absolute URI from a relative one, using the current base URI.
Parameters:
  sysid - The (possibly relative) system identifier The system identifier made absolute with respect to thecurrent Catalog.base.



newCatalog
protected Catalog newCatalog()(Code)
Create a new Catalog object.

This method constructs a new instance of the running Catalog class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog). All new catalogs are managed by the same CatalogManager.

N.B. All Catalog subtypes should call newCatalog() to construct a new Catalog. Do not simply use "new Subclass()" since that will confuse future subclasses.




normalizeURI
protected String normalizeURI(String uriref)(Code)
Perform character normalization on a URI reference.
Parameters:
  uriref - The URI reference The normalized URI reference.



parseAllCatalogs
public void parseAllCatalogs() throws MalformedURLException, IOException(Code)
Parse all subordinate catalogs.

This method recursively parses all of the subordinate catalogs. If this method does not throw an exception, you can be confident that no subsequent call to any resolve*() method will either, with two possible exceptions:

  1. Delegated catalogs are re-parsed each time they are needed (because a variable list of them may be needed in each case, depending on the length of the matching partial public identifier).

    But they are parsed by this method, so as long as they don't change or disappear while the program is running, they shouldn't generate errors later if they don't generate errors now.

  2. If you add new catalogs with parseCatalog, they won't be loaded until they are needed or until you call parseAllCatalogs again.

On the other hand, if you don't call this method, you may successfully parse documents without having to load all possible catalogs.


throws:
  MalformedURLException - The filename (URL) for asubordinate or delegated catalog is not a valid URL.
throws:
  IOException - Error reading some subordinate or delegatedcatalog file.



parseCatalog
public synchronized void parseCatalog(String fileName) throws MalformedURLException, IOException(Code)
Parse a catalog file, augmenting internal data structures.
Parameters:
  fileName - The filename of the catalog file to process
throws:
  MalformedURLException - The fileName cannot be turned intoa valid URL.
throws:
  IOException - Error reading catalog file.



parseCatalog
public synchronized void parseCatalog(String mimeType, InputStream is) throws IOException, CatalogException(Code)
Parse a catalog file, augmenting internal data structures.

Catalogs retrieved over the net may have an associated MIME type. The MIME type can be used to select an appropriate reader.


Parameters:
  mimeType - The MIME type of the catalog file.
Parameters:
  is - The InputStream from which the catalog should be read
throws:
  CatalogException - Failed to load catalogmimeType.
throws:
  IOException - Error reading catalog file.



parseCatalog
public synchronized void parseCatalog(URL aUrl) throws IOException(Code)
Parse a catalog document, augmenting internal data structures.

This method supports catalog files stored in jar files: e.g., jar:file:///path/to/filename.jar!/path/to/catalog.xml". That URI doesn't survive transmogrification through the URI processing that the parseCatalog(String) performs and passing it as an input stream doesn't set the base URI appropriately.

Written by Stefan Wachter (2002-09-26)


Parameters:
  aUrl - The URL of the catalog document to process
throws:
  IOException - Error reading catalog file.



parseCatalogFile
protected synchronized void parseCatalogFile(String fileName) throws MalformedURLException, IOException, CatalogException(Code)
Parse a single catalog file, augmenting internal data structures.
Parameters:
  fileName - The filename of the catalog file to process
throws:
  MalformedURLException - The fileName cannot be turned intoa valid URL.
throws:
  IOException - Error reading catalog file.



parsePendingCatalogs
protected synchronized void parsePendingCatalogs() throws MalformedURLException, IOException(Code)
Parse all of the pending catalogs.

Catalogs may refer to other catalogs, this method parses all of the currently pending catalog files.




resolveDoctype
public String resolveDoctype(String entityName, String publicId, String systemId) throws MalformedURLException, IOException(Code)
Return the applicable DOCTYPE system identifier.
Parameters:
  entityName - The name of the entity (element) for whicha doctype is required.
Parameters:
  publicId - The nominal public identifier for the doctype(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the doctype(as provided in the source document). The system identifier to use for the doctype.
throws:
  MalformedURLException - The formal system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file.



resolveDocument
public String resolveDocument() throws MalformedURLException, IOException(Code)
Return the applicable DOCUMENT entry. The system identifier to use for the doctype.
throws:
  MalformedURLException - The formal system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file.



resolveEntity
public String resolveEntity(String entityName, String publicId, String systemId) throws MalformedURLException, IOException(Code)
Return the applicable ENTITY system identifier.
Parameters:
  entityName - The name of the entity for whicha system identifier is required.
Parameters:
  publicId - The nominal public identifier for the entity(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the entity(as provided in the source document). The system identifier to use for the entity.
throws:
  MalformedURLException - The formal system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file.



resolveLocalPublic
protected synchronized String resolveLocalPublic(int entityType, String entityName, String publicId, String systemId) throws MalformedURLException, IOException(Code)
Return the applicable PUBLIC or SYSTEM identifier.

This method searches the Catalog and returns the system identifier specified for the given system or public identifiers. If no appropriate PUBLIC or SYSTEM entry is found in the Catalog, delegated Catalogs are interrogated.

There are four possible cases:

  • If the system identifier provided matches a SYSTEM entry in the current catalog, the SYSTEM entry is returned.
  • If the system identifier is not null, the PUBLIC entries that were encountered when OVERRIDE YES was in effect are interrogated and the first matching entry is returned.
  • If the system identifier is null, then all of the PUBLIC entries are interrogated and the first matching entry is returned. This may not be the same as the preceding case, if some PUBLIC entries are encountered when OVERRIDE NO is in effect. In XML, the only place where a public identifier may occur without a system identifier is in a notation declaration.
  • Finally, if the public identifier matches one of the partial public identifiers specified in a DELEGATE* entry in the Catalog, the delegated catalog is interrogated. The first time that the delegated catalog is required, it will be retrieved and parsed. It is subsequently cached.

Parameters:
  entityType - The CatalogEntry type for which this query isbeing conducted. This is necessary in order to do the appropratequery on a delegated catalog.
Parameters:
  entityName - The name of the entity being searched for, ifappropriate.
Parameters:
  publicId - The public identifier of the entity in question.
Parameters:
  systemId - The nominal system identifier for the entityin question (as provided in the source document).
throws:
  MalformedURLException - The formal system identifier of adelegated catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading delegated catalog file. The system identifier to use.Note that the nominal system identifier is not returned if amatch is not found in the catalog, instead null is returnedto indicate that no match was found.



resolveLocalSystem
protected String resolveLocalSystem(String systemId) throws MalformedURLException, IOException(Code)
Return the applicable SYSTEM system identifier in this catalog.

If a SYSTEM entry exists in the catalog file for the system ID specified, return the mapped value.


Parameters:
  systemId - The system ID to locate in the catalog The mapped system identifier or null



resolveLocalURI
protected String resolveLocalURI(String uri) throws MalformedURLException, IOException(Code)
Return the applicable URI in this catalog.

If a URI entry exists in the catalog file for the URI specified, return the mapped value.


Parameters:
  uri - The URI to locate in the catalog The mapped URI or null



resolveNotation
public String resolveNotation(String notationName, String publicId, String systemId) throws MalformedURLException, IOException(Code)
Return the applicable NOTATION system identifier.
Parameters:
  notationName - The name of the notation for whicha doctype is required.
Parameters:
  publicId - The nominal public identifier for the notation(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the notation(as provided in the source document). The system identifier to use for the notation.
throws:
  MalformedURLException - The formal system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file.



resolvePublic
public String resolvePublic(String publicId, String systemId) throws MalformedURLException, IOException(Code)
Return the applicable PUBLIC or SYSTEM identifier.

This method searches the Catalog and returns the system identifier specified for the given system or public identifiers. If no appropriate PUBLIC or SYSTEM entry is found in the Catalog, null is returned.


Parameters:
  publicId - The public identifier to locate in the catalog.Public identifiers are normalized before comparison.
Parameters:
  systemId - The nominal system identifier for the entityin question (as provided in the source document).
throws:
  MalformedURLException - The formal system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file. The system identifier to use.Note that the nominal system identifier is not returned if amatch is not found in the catalog, instead null is returnedto indicate that no match was found.



resolveSubordinateCatalogs
protected synchronized String resolveSubordinateCatalogs(int entityType, String entityName, String publicId, String systemId) throws MalformedURLException, IOException(Code)
Search the subordinate catalogs, in order, looking for a match.

This method searches the Catalog and returns the system identifier specified for the given entity type with the given name, public, and system identifiers. In some contexts, these may be null.


Parameters:
  entityType - The CatalogEntry type for which this query isbeing conducted. This is necessary in order to do the appropratequery on a subordinate catalog.
Parameters:
  entityName - The name of the entity being searched for, ifappropriate.
Parameters:
  publicId - The public identifier of the entity in question(as provided in the source document).
Parameters:
  systemId - The nominal system identifier for the entityin question (as provided in the source document). This parameter isoverloaded for the URI entry type.
throws:
  MalformedURLException - The formal system identifier of adelegated catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading delegated catalog file. The system identifier to use.Note that the nominal system identifier is not returned if amatch is not found in the catalog, instead null is returnedto indicate that no match was found.



resolveSystem
public String resolveSystem(String systemId) throws MalformedURLException, IOException(Code)
Return the applicable SYSTEM system identifier.

If a SYSTEM entry exists in the Catalog for the system ID specified, return the mapped value.

On Windows-based operating systems, the comparison between the system identifier provided and the SYSTEM entries in the Catalog is case-insensitive.


Parameters:
  systemId - The system ID to locate in the catalog. The resolved system identifier.
throws:
  MalformedURLException - The formal system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file.



resolveURI
public String resolveURI(String uri) throws MalformedURLException, IOException(Code)
Return the applicable URI.

If a URI entry exists in the Catalog for the URI specified, return the mapped value.

URI comparison is case sensitive.


Parameters:
  uri - The URI to locate in the catalog. The resolved URI.
throws:
  MalformedURLException - The system identifier of asubordinate catalog cannot be turned into a valid URL.
throws:
  IOException - Error reading subordinate catalog file.



setCatalogManager
public void setCatalogManager(CatalogManager manager)(Code)
Establish the CatalogManager used by this catalog.



setupReaders
public void setupReaders()(Code)
Setup readers.



unknownEntry
public void unknownEntry(Vector strings)(Code)
Handle unknown CatalogEntry types.

This method exists to allow subclasses to deal with unknown entry types.




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)

w_w__w__.___j___a___v__a__2___s___.c___om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.