Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.geronimo.deployment.xml
Class LocalEntityResolver  view LocalEntityResolver download LocalEntityResolver.java

java.lang.Object
  extended byorg.apache.geronimo.deployment.xml.LocalEntityResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver

public class LocalEntityResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver

Implementation of EntityResolver that looks to the local filesystem. The implementation tries to resolve an entity via the following steps:

The catalog resolving is based on the OASIS XML Catalog Standard. OASIS seems to move it around. Try http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=entity and the list of documents currently at http://www.oasis-open.org/committees/documents.php?wg_abbrev=entity An older version may be at http://www.oasis-open.org/committees/entity/archives/spec-2001-08-01.html and see http://www.oasis-open.org/html/a401.htm

Version:
$Rev: 56022 $ $Date: 2004-10-29 22:16:18 -0700 (Fri, 29 Oct 2004) $

Field Summary
private  org.apache.xml.resolver.Catalog catalog
          the XML Catalog
private  java.net.URI catalogFileURI
          the URI of the catalog file
private  boolean failOnUnresolvable
          Flag indicating if this resolver may return null to signal the parser to open a regular URI connection to the system identifier.
static org.apache.geronimo.gbean.GBeanInfo GBEAN_INFO
           
private  java.net.URI localRepositoryURI
          Local Repository where DTDs and Schemas are located
private static org.apache.commons.logging.Log log
          used Logger
private  org.apache.xml.resolver.CatalogManager manager
          The used Catalog Manager
 
Constructor Summary
LocalEntityResolver(java.net.URI catalogFileURI, java.net.URI localRepositoryURI, boolean failOnUnresolvable)
           
 
Method Summary
private  void addEntry(java.lang.String type, java.util.Vector args)
          Adds a new Entry to the catalog
 void addPublicMapping(java.lang.String publicId, java.lang.String uri)
           
 void addSystemMapping(java.lang.String systemId, java.lang.String uri)
           
private  java.lang.String entityMessageString(java.lang.String publicId, java.lang.String systemId)
          Constructs a debugging message string
 java.net.URI getCatalogFileURI()
           
static org.apache.geronimo.gbean.GBeanInfo getGBeanInfo()
           
 java.net.URI getLocalRepositoryURI()
           
private  java.lang.String getSystemIdFileName(java.lang.String systemId)
          Returns the SystemIds filename
private  java.lang.String guaranteeNotNull(java.lang.String string)
          Guarantees a not null value
private  void init()
          Loads mappings from configuration file
 boolean isFailOnUnresolvable()
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Attempt to resolve the entity based on the supplied publicId and systemId.
(package private)  org.xml.sax.InputSource resolveWithCatalog(java.lang.String publicId, java.lang.String systemId)
          Try to resolve using the catalog file
(package private)  org.xml.sax.InputSource resolveWithClasspath(java.lang.String publicId, java.lang.String systemId)
          Try to resolve using the the classpath and only the supplied systemID.
(package private)  org.xml.sax.InputSource resolveWithRepository(java.lang.String publicId, java.lang.String systemId)
          Try to resolve using the local repository and only the supplied systemID filename.
 void setCatalogFileURI(java.net.URI catalogFileURI)
           
 void setFailOnUnresolvable(boolean b)
          Sets the setFailOnUnresolvable flag.
 void setLocalRepositoryURI(java.net.URI string)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log
used Logger


manager

private final org.apache.xml.resolver.CatalogManager manager
The used Catalog Manager


catalog

private org.apache.xml.resolver.Catalog catalog
the XML Catalog


catalogFileURI

private java.net.URI catalogFileURI
the URI of the catalog file


localRepositoryURI

private java.net.URI localRepositoryURI
Local Repository where DTDs and Schemas are located


failOnUnresolvable

private boolean failOnUnresolvable
Flag indicating if this resolver may return null to signal the parser to open a regular URI connection to the system identifier. Otherwise an exception is thrown.


GBEAN_INFO

public static final org.apache.geronimo.gbean.GBeanInfo GBEAN_INFO
Constructor Detail

LocalEntityResolver

public LocalEntityResolver(java.net.URI catalogFileURI,
                           java.net.URI localRepositoryURI,
                           boolean failOnUnresolvable)
Method Detail

setFailOnUnresolvable

public void setFailOnUnresolvable(boolean b)
Sets the setFailOnUnresolvable flag.


isFailOnUnresolvable

public boolean isFailOnUnresolvable()

setCatalogFileURI

public void setCatalogFileURI(java.net.URI catalogFileURI)

getCatalogFileURI

public java.net.URI getCatalogFileURI()

getLocalRepositoryURI

public java.net.URI getLocalRepositoryURI()

setLocalRepositoryURI

public void setLocalRepositoryURI(java.net.URI string)

addPublicMapping

public void addPublicMapping(java.lang.String publicId,
                             java.lang.String uri)

addSystemMapping

public void addSystemMapping(java.lang.String systemId,
                             java.lang.String uri)

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Attempt to resolve the entity based on the supplied publicId and systemId. First the catalog is queried with both publicId and systemId. Then the local repository is queried with the file name part of the systemId Then the classpath is queried with the file name part of the systemId. Then, if failOnUnresolvable is true, an exception is thrown: otherwise null is returned.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver

resolveWithCatalog

org.xml.sax.InputSource resolveWithCatalog(java.lang.String publicId,
                                           java.lang.String systemId)
                                     throws java.net.MalformedURLException,
                                            java.io.IOException
Try to resolve using the catalog file


resolveWithRepository

org.xml.sax.InputSource resolveWithRepository(java.lang.String publicId,
                                              java.lang.String systemId)
Try to resolve using the local repository and only the supplied systemID filename. Any path in the systemID will be removed.


resolveWithClasspath

org.xml.sax.InputSource resolveWithClasspath(java.lang.String publicId,
                                             java.lang.String systemId)
Try to resolve using the the classpath and only the supplied systemID. Any path in the systemID will be removed.


guaranteeNotNull

private java.lang.String guaranteeNotNull(java.lang.String string)
Guarantees a not null value


getSystemIdFileName

private java.lang.String getSystemIdFileName(java.lang.String systemId)
Returns the SystemIds filename


entityMessageString

private java.lang.String entityMessageString(java.lang.String publicId,
                                             java.lang.String systemId)
Constructs a debugging message string


addEntry

private void addEntry(java.lang.String type,
                      java.util.Vector args)
Adds a new Entry to the catalog


init

private void init()
Loads mappings from configuration file


getGBeanInfo

public static org.apache.geronimo.gbean.GBeanInfo getGBeanInfo()