public class JBossEntityResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver, org.w3c.dom.ls.LSResourceResolver
| Modifier and Type | Class and Description |
|---|---|
private static class |
JBossEntityResolver.LSInputImpl |
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map |
entities
A class wide Map
|
private java.lang.ThreadLocal<java.lang.Boolean> |
entityResolved |
private java.util.Map |
localEntities
A local entities map that overrides the class level entities
|
private static org.jboss.logging.Logger |
log |
private boolean |
replaceSystemProperties
Should system property refs in system ids be replaced
|
private static boolean |
warnOnNonFileURLs
A class flag indicating whether an attempt to resolve a systemID as a
non-file URL should produce a warning rather than a trace level log msg.
|
| Constructor and Description |
|---|
JBossEntityResolver() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Map |
getEntityMap()
Obtain a read-only view of the current entity map.
|
boolean |
isEntityResolved()
Returns the boolean value to inform id DTD was found in the XML file or not
|
boolean |
isReplaceSystemProperties() |
static boolean |
isWarnOnNonFileURLs() |
protected java.io.InputStream |
loadClasspathResource(java.lang.String resource,
boolean trace)
Look for the resource name on the thread context loader resource path.
|
static void |
registerEntity(java.lang.String id,
java.lang.String dtdFileName)
Register the mapping from the public id/system id to the dtd/xsd file
name.
|
void |
registerLocalEntity(java.lang.String id,
java.lang.String dtdOrSchema)
Register the mapping from the public id/system id to the dtd/xsd file
name.
|
protected org.xml.sax.InputSource |
resolveClasspathName(java.lang.String systemId,
boolean trace)
Resolve the systemId as a classpath resource.
|
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
Returns DTD/Schema inputSource.
|
protected org.xml.sax.InputSource |
resolvePublicID(java.lang.String publicId,
boolean trace)
Load the schema from the class entity to schema file mapping.
|
org.w3c.dom.ls.LSInput |
resolveResource(java.lang.String type,
java.lang.String namespaceURI,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String baseURI) |
protected org.xml.sax.InputSource |
resolveSystemID(java.lang.String systemId,
boolean trace)
Attempt to use the systemId as a URL from which the schema can be read.
|
protected org.xml.sax.InputSource |
resolveSystemIDasURL(java.lang.String systemId,
boolean trace)
Attempt to use the systemId as a URL from which the schema can be read.
|
void |
setReplaceSystemProperties(boolean replaceSystemProperties) |
static void |
setWarnOnNonFileURLs(boolean warnOnNonFileURLs) |
private static final org.jboss.logging.Logger log
private static java.util.Map entities
private static boolean warnOnNonFileURLs
private boolean replaceSystemProperties
private java.util.Map localEntities
private java.lang.ThreadLocal<java.lang.Boolean> entityResolved
public static java.util.Map getEntityMap()
public static boolean isWarnOnNonFileURLs()
public static void setWarnOnNonFileURLs(boolean warnOnNonFileURLs)
public static void registerEntity(java.lang.String id,
java.lang.String dtdFileName)
id - the DOCTYPE public id or system id such as
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"dtdFileName - the simple dtd/xsd file name, "ejb-jar.dtd"public boolean isReplaceSystemProperties()
public void setReplaceSystemProperties(boolean replaceSystemProperties)
public void registerLocalEntity(java.lang.String id,
java.lang.String dtdOrSchema)
id - the DOCTYPE public id or system id such as
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"dtdOrSchema - the simple dtd/xsd file name, "ejb-jar.dtd"public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException,
java.io.IOException
resolveEntity in interface org.xml.sax.EntityResolverpublicId - - Public ID of DTD, or null if it is a schemasystemId - - the system ID of DTD or Schemaorg.xml.sax.SAXExceptionjava.io.IOExceptionpublic boolean isEntityResolved()
protected org.xml.sax.InputSource resolvePublicID(java.lang.String publicId,
boolean trace)
publicId - - the public entity name of the schematrace - - trace level logging flagregisterEntity(String, String)protected org.xml.sax.InputSource resolveSystemID(java.lang.String systemId,
boolean trace)
systemId - - the systemIdtrace - - trace level logging flagprotected org.xml.sax.InputSource resolveSystemIDasURL(java.lang.String systemId,
boolean trace)
systemId - - the systemIdtrace - - trace level logging flagprotected org.xml.sax.InputSource resolveClasspathName(java.lang.String systemId,
boolean trace)
systemId - - the system ID of DTD or Schematrace - - trace level logging flagprotected java.io.InputStream loadClasspathResource(java.lang.String resource,
boolean trace)
resource - - the classpath resource name of the schematrace - - trace level logging flagpublic org.w3c.dom.ls.LSInput resolveResource(java.lang.String type,
java.lang.String namespaceURI,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String baseURI)
resolveResource in interface org.w3c.dom.ls.LSResourceResolver