Top Description Inners Fields Constructors Methods
com.sun.faces.config.manager

public Class DbfFactory

extends Object
Class Inheritance
Static Imports
com.sun.faces.util.Util.createDocumentBuilderFactory, .Util.createSchemaFactory, java.util.Collections.synchronizedMap, java.util.logging.Level.FINE, .Level.SEVERE, javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI

Create and configure DocumentBuilderFactory instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
public static final DbfFactory.FacesEntityResolver
FACES_ENTITY_RESOLVER

EntityResolver

public static final DbfFactory.FacesErrorHandler
FACES_ERROR_HANDLER

ErrorHandler

private static final Logger
private static final String
SCHEMA_MAP

The constant that points to the schema map (in the servlet context).

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static DocumentBuilderFactory
public static Schema

Returns:

the schema, or null if not found.
getSchema
(ServletContext
the backing servlet context.
servletContext
,
String
namespace of the document
documentNS
,
String
version attribute of the root tag, if any
version
,
String
name of the root tag
localName
)

Get the schema for the given schema id.

public static Schema

Returns:

the schema, or null if not found.
getSchema
(ServletContext
the backing servlet context.
servletContext
,
FacesSchema
the schema id.
schemaId
)

Get the schema for the given schema id.

private static Map<FacesSchema, Schema>

Returns:

the schema map.
getSchemaMap
(ServletContext
the servlet context.
servletContext
)

Get the schema map from the servlet context (or create it).

public static Schema
loadSchema(String resourceName, String fileName)

public static void
removeSchemaMap(ServletContext
the servlet context.
servletContext
)

Remove the schema map from the servlet context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FACES_ENTITY_RESOLVERback to summary
public static final DbfFactory.FacesEntityResolver FACES_ENTITY_RESOLVER

EntityResolver

FACES_ERROR_HANDLERback to summary
public static final DbfFactory.FacesErrorHandler FACES_ERROR_HANDLER

ErrorHandler

LOGGERback to summary
private static final Logger LOGGER
SCHEMA_MAPback to summary
private static final String SCHEMA_MAP

The constant that points to the schema map (in the servlet context).

Constructor Detail

DbfFactoryback to summary
public DbfFactory()

Method Detail

getFactoryback to summary
public static DocumentBuilderFactory getFactory()
getSchemaback to summary
public static Schema getSchema(ServletContext servletContext, String documentNS, String version, String localName)

Get the schema for the given schema id.

Parameters
servletContext:ServletContext

the backing servlet context.

documentNS:String

namespace of the document

version:String

version attribute of the root tag, if any

localName:String

name of the root tag

Returns:Schema

the schema, or null if not found.

getSchemaback to summary
public static Schema getSchema(ServletContext servletContext, FacesSchema schemaId)

Get the schema for the given schema id.

Parameters
servletContext:ServletContext

the backing servlet context.

schemaId:FacesSchema

the schema id.

Returns:Schema

the schema, or null if not found.

getSchemaMapback to summary
private static Map<FacesSchema, Schema> getSchemaMap(ServletContext servletContext)

Get the schema map from the servlet context (or create it).

Parameters
servletContext:ServletContext

the servlet context.

Returns:Map<FacesSchema, Schema>

the schema map.

Annotations
@SuppressWarnings:unchecked
loadSchemaback to summary
public static Schema loadSchema(String resourceName, String fileName) throws SAXException, IOException
removeSchemaMapback to summary
public static void removeSchemaMap(ServletContext servletContext)

Remove the schema map from the servlet context.

Parameters
servletContext:ServletContext

the servlet context.

com.sun.faces.config.manager back to summary

private Class DbfFactory.FacesEntityResolver

extends DefaultHandler
implements LSResourceResolver
Class Inheritance
All Implemented Interfaces
org.w3c.dom.ls.LSResourceResolver

Field Summary

Modifier and TypeField and Description
private HashMap<String, String>
entities

Contains mapping between grammar name and the local URL to the physical resource.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InputSource
resolveEntity(String
The public identifier, or null if none is available.
publicId
,
String
The system identifier provided in the XML document.
systemId
)

Overrides org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements org.xml.sax.EntityResolver.resolveEntity.

Resolves the physical resource using the last segment of the systemId (e.g. http://java.sun.com/dtds/web-facesconfig_1_1.dtd, the last segment would be web-facesconfig_1_1.dtd).

public LSInput
resolveResource(String
The type of the resource being resolved. For XML [XML 1.0] resources (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml". For XML Schema [XML Schema Part 1] , applications must use the value "http://www.w3.org/2001/XMLSchema". Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method.
type
,
String
The namespace of the resource being resolved, e.g. the target namespace of the XML Schema [XML Schema Part 1] when resolving XML Schema resources.
namespaceURI
,
String
The public identifier of the external entity being referenced, or null if no public identifier was supplied or if the resource is not an entity.
publicId
,
String
The system identifier, a URI reference [IETF RFC 2396], of the external resource being referenced, or null if no system identifier was supplied.
systemId
,
String
The absolute base URI of the resource being parsed, or null if there is no base URI.
baseURI
)

Implements org.w3c.dom.ls.LSResourceResolver.resolveResource.

Allow the application to resolve external resources.

Inherited from org.xml.sax.helpers.DefaultHandler:
charactersendDocumentendElementendPrefixMappingerrorfatalErrorignorableWhitespacenotationDeclprocessingInstructionsetDocumentLocatorskippedEntitystartDocumentstartElementstartPrefixMappingunparsedEntityDeclwarning

Field Detail

entitiesback to summary
private HashMap<String, String> entities

Contains mapping between grammar name and the local URL to the physical resource.

Constructor Detail

FacesEntityResolverback to summary
public FacesEntityResolver()

Method Detail

resolveEntityback to summary
public InputSource resolveEntity(String publicId, String systemId) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements org.xml.sax.EntityResolver.resolveEntity.

Resolves the physical resource using the last segment of the systemId (e.g. http://java.sun.com/dtds/web-facesconfig_1_1.dtd, the last segment would be web-facesconfig_1_1.dtd). If a mapping cannot be found for the segment, then defer to the DefaultHandler for resolution.

Parameters
publicId:String

Doc from org.xml.sax.helpers.DefaultHandler.resolveEntity.

The public identifier, or null if none is available.

systemId:String

Doc from org.xml.sax.helpers.DefaultHandler.resolveEntity.

The system identifier provided in the XML document.

Returns:InputSource

Doc from org.xml.sax.helpers.DefaultHandler.resolveEntity.

The new input source, or null to require the default behaviour.

Annotations
@Override
Exceptions
SAXException:

Doc from org.xml.sax.helpers.DefaultHandler.resolveEntity.

Any SAX exception, possibly wrapping another exception.

resolveResourceback to summary
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)

Implements org.w3c.dom.ls.LSResourceResolver.resolveResource.

Doc from org.w3c.dom.ls.LSResourceResolver.resolveResource.

Allow the application to resolve external resources.
The LSParser will call this method before opening any external resource, including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element (however, the top-level document entity is not passed to this method). The application may then request that the LSParser resolve the external resource itself, that it use an alternative URI, or that it use an entirely different input source.
Application writers can use this method to redirect external system identifiers to secure and/or local URI, to look up public identifiers in a catalogue, or to read an entity from a database or other input source (including, for example, a dialog box).

Parameters
type:String

The type of the resource being resolved. For XML [XML 1.0] resources (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml". For XML Schema [XML Schema Part 1] , applications must use the value "http://www.w3.org/2001/XMLSchema". Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method.

namespaceURI:String

The namespace of the resource being resolved, e.g. the target namespace of the XML Schema [XML Schema Part 1] when resolving XML Schema resources.

publicId:String

The public identifier of the external entity being referenced, or null if no public identifier was supplied or if the resource is not an entity.

systemId:String

The system identifier, a URI reference [IETF RFC 2396], of the external resource being referenced, or null if no system identifier was supplied.

baseURI:String

The absolute base URI of the resource being parsed, or null if there is no base URI.

Returns:LSInput

A LSInput object describing the new input source, or null to request that the parser open a regular URI connection to the resource.

Annotations
@Override
com.sun.faces.config.manager back to summary

private Class DbfFactory.FacesErrorHandler

extends Object
implements ErrorHandler
Class Inheritance
All Implemented Interfaces
org.xml.sax.ErrorHandler

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
error(SAXParseException
The error information encapsulated in a SAX parse exception.
exception
)

Implements org.xml.sax.ErrorHandler.error.

Receive notification of a recoverable error.

public void
fatalError(SAXParseException
The error information encapsulated in a SAXParseException.
exception
)

Implements org.xml.sax.ErrorHandler.fatalError.

Receive notification of a non-recoverable, fatal error.

public void
warning(SAXParseException
The warning information encapsulated in a SAX parse exception.
exception
)

Implements org.xml.sax.ErrorHandler.warning.

Receive notification of a warning.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FacesErrorHandlerback to summary
private FacesErrorHandler()

Method Detail

errorback to summary
public void error(SAXParseException exception) throws SAXException

Implements org.xml.sax.ErrorHandler.error.

Doc from org.xml.sax.ErrorHandler.error.

Receive notification of a recoverable error.

This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML recommendation does not require it to do so.

Filters may use this method to report other, non-XML errors as well.

Parameters
exception:SAXParseException

The error information encapsulated in a SAX parse exception.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
fatalErrorback to summary
public void fatalError(SAXParseException exception) throws SAXException

Implements org.xml.sax.ErrorHandler.fatalError.

Doc from org.xml.sax.ErrorHandler.fatalError.

Receive notification of a non-recoverable, fatal error.

As defined in section 1.2 of the W3C XML 1.0 Recommendation, fatal errors are those that would make it impossible for a parser to continue normal processing. These include violation of a well-formedness constraint, invalid encoding, and forbidden structural errors as described in the W3C XML 1.0 Recommendation.

Parameters
exception:SAXParseException

The error information encapsulated in a SAXParseException.

Annotations
@Override
Exceptions
SAXException:
if the application chooses to discontinue the parsing
warningback to summary
public void warning(SAXParseException exception) throws SAXException

Implements org.xml.sax.ErrorHandler.warning.

Doc from org.xml.sax.ErrorHandler.warning.

Receive notification of a warning.

SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML recommendation. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.

Filters may use this method to report other, non-XML warnings as well.

Parameters
exception:SAXParseException

The warning information encapsulated in a SAX parse exception.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
com.sun.faces.config.manager back to summary

private final Class DbfFactory.Input

extends Object
implements LSInput
Class Inheritance
All Implemented Interfaces
org.w3c.dom.ls.LSInput

Field Summary

Modifier and TypeField and Description
pack-priv InputStream

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getBaseURI()

Implements org.w3c.dom.ls.LSInput.getBaseURI.

The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for resolving a relative systemId to an absolute URI.

public InputStream
getByteStream()

Implements org.w3c.dom.ls.LSInput.getByteStream.

An attribute of a language and binding dependent type that represents a stream of bytes.

public boolean
getCertifiedText()

Implements org.w3c.dom.ls.LSInput.getCertifiedText.

If set to true, assume that the input is certified (see section 2.13 in [XML 1.1]) when parsing [XML 1.1].

public Reader
getCharacterStream()

Implements org.w3c.dom.ls.LSInput.getCharacterStream.

An attribute of a language and binding dependent type that represents a stream of 16-bit units.

public String
getEncoding()

Implements org.w3c.dom.ls.LSInput.getEncoding.

The character encoding, if known.

public String
getPublicId()

Implements org.w3c.dom.ls.LSInput.getPublicId.

The public identifier for this input source.

public String
getStringData()

Implements org.w3c.dom.ls.LSInput.getStringData.

String data to parse.

public String
getSystemId()

Implements org.w3c.dom.ls.LSInput.getSystemId.

The system identifier, a URI reference [IETF RFC 2396], for this input source.

public void
setBaseURI(String baseURI)

Implements org.w3c.dom.ls.LSInput.setBaseURI.

The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for resolving a relative systemId to an absolute URI.

public void
setByteStream(InputStream byteStream)

Implements org.w3c.dom.ls.LSInput.setByteStream.

An attribute of a language and binding dependent type that represents a stream of bytes.

public void
setCertifiedText(boolean certifiedText)

Implements org.w3c.dom.ls.LSInput.setCertifiedText.

If set to true, assume that the input is certified (see section 2.13 in [XML 1.1]) when parsing [XML 1.1].

public void
setCharacterStream(Reader characterStream)

Implements org.w3c.dom.ls.LSInput.setCharacterStream.

An attribute of a language and binding dependent type that represents a stream of 16-bit units.

public void
setEncoding(String encoding)

Implements org.w3c.dom.ls.LSInput.setEncoding.

The character encoding, if known.

public void
setPublicId(String publicId)

Implements org.w3c.dom.ls.LSInput.setPublicId.

The public identifier for this input source.

public void
setStringData(String stringData)

Implements org.w3c.dom.ls.LSInput.setStringData.

String data to parse.

public void
setSystemId(String systemId)

Implements org.w3c.dom.ls.LSInput.setSystemId.

The system identifier, a URI reference [IETF RFC 2396], for this input source.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inback to summary
pack-priv InputStream in

Constructor Detail

Inputback to summary
public Input(InputStream in)

Method Detail

getBaseURIback to summary
public String getBaseURI()

Implements org.w3c.dom.ls.LSInput.getBaseURI.

Doc from org.w3c.dom.ls.LSInput.getBaseURI.

The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for resolving a relative systemId to an absolute URI.
If, when used, the base URI is itself a relative URI, an empty string, or null, the behavior is implementation dependent.

Annotations
@Override
getByteStreamback to summary
public InputStream getByteStream()

Implements org.w3c.dom.ls.LSInput.getByteStream.

Doc from org.w3c.dom.ls.LSInput.getByteStream.

An attribute of a language and binding dependent type that represents a stream of bytes.
If the application knows the character encoding of the byte stream, it should set the encoding attribute. Setting the encoding in this way will override any encoding specified in an XML declaration in the data.

Annotations
@Override
getCertifiedTextback to summary
public boolean getCertifiedText()

Implements org.w3c.dom.ls.LSInput.getCertifiedText.

Doc from org.w3c.dom.ls.LSInput.getCertifiedText.

If set to true, assume that the input is certified (see section 2.13 in [XML 1.1]) when parsing [XML 1.1].

Annotations
@Override
getCharacterStreamback to summary
public Reader getCharacterStream()

Implements org.w3c.dom.ls.LSInput.getCharacterStream.

Doc from org.w3c.dom.ls.LSInput.getCharacterStream.

An attribute of a language and binding dependent type that represents a stream of 16-bit units. The application must encode the stream using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). It is not a requirement to have an XML declaration when using character streams. If an XML declaration is present, the value of the encoding attribute will be ignored.

Annotations
@Override
getEncodingback to summary
public String getEncoding()

Implements org.w3c.dom.ls.LSInput.getEncoding.

Doc from org.w3c.dom.ls.LSInput.getEncoding.

The character encoding, if known. The encoding must be a string acceptable for an XML encoding declaration ([XML 1.0] section 4.3.3 "Character Encoding in Entities").
This attribute has no effect when the application provides a character stream or string data. For other sources of input, an encoding specified by means of this attribute will override any encoding specified in the XML declaration or the Text declaration, or an encoding obtained from a higher level protocol, such as HTTP [IETF RFC 2616].

Annotations
@Override
getPublicIdback to summary
public String getPublicId()

Implements org.w3c.dom.ls.LSInput.getPublicId.

Doc from org.w3c.dom.ls.LSInput.getPublicId.

The public identifier for this input source. This may be mapped to an input source using an implementation dependent mechanism (such as catalogues or other mappings). The public identifier, if specified, may also be reported as part of the location information when errors are reported.

Annotations
@Override
getStringDataback to summary
public String getStringData()

Implements org.w3c.dom.ls.LSInput.getStringData.

Doc from org.w3c.dom.ls.LSInput.getStringData.

String data to parse. If provided, this will always be treated as a sequence of 16-bit units (UTF-16 encoded characters). It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of the encoding attribute will be ignored.

Annotations
@Override
getSystemIdback to summary
public String getSystemId()

Implements org.w3c.dom.ls.LSInput.getSystemId.

Doc from org.w3c.dom.ls.LSInput.getSystemId.

The system identifier, a URI reference [IETF RFC 2396], for this input source. The system identifier is optional if there is a byte stream, a character stream, or string data. It is still useful to provide one, since the application will use it to resolve any relative URIs and can include it in error messages and warnings. (The LSParser will only attempt to fetch the resource identified by the URI reference if there is no other input available in the input source.)
If the application knows the character encoding of the object pointed to by the system identifier, it can set the encoding using the encoding attribute.
If the specified system ID is a relative URI reference (see section 5 in [IETF RFC 2396]), the DOM implementation will attempt to resolve the relative URI with the baseURI as the base, if that fails, the behavior is implementation dependent.

Annotations
@Override
setBaseURIback to summary
public void setBaseURI(String baseURI)

Implements org.w3c.dom.ls.LSInput.setBaseURI.

Doc from org.w3c.dom.ls.LSInput.setBaseURI.

The base URI to be used (see section 5.1.4 in [IETF RFC 2396]) for resolving a relative systemId to an absolute URI.
If, when used, the base URI is itself a relative URI, an empty string, or null, the behavior is implementation dependent.

Annotations
@Override
setByteStreamback to summary
public void setByteStream(InputStream byteStream)

Implements org.w3c.dom.ls.LSInput.setByteStream.

Doc from org.w3c.dom.ls.LSInput.setByteStream.

An attribute of a language and binding dependent type that represents a stream of bytes.
If the application knows the character encoding of the byte stream, it should set the encoding attribute. Setting the encoding in this way will override any encoding specified in an XML declaration in the data.

Annotations
@Override
setCertifiedTextback to summary
public void setCertifiedText(boolean certifiedText)

Implements org.w3c.dom.ls.LSInput.setCertifiedText.

Doc from org.w3c.dom.ls.LSInput.setCertifiedText.

If set to true, assume that the input is certified (see section 2.13 in [XML 1.1]) when parsing [XML 1.1].

Annotations
@Override
setCharacterStreamback to summary
public void setCharacterStream(Reader characterStream)

Implements org.w3c.dom.ls.LSInput.setCharacterStream.

Doc from org.w3c.dom.ls.LSInput.setCharacterStream.

An attribute of a language and binding dependent type that represents a stream of 16-bit units. The application must encode the stream using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). It is not a requirement to have an XML declaration when using character streams. If an XML declaration is present, the value of the encoding attribute will be ignored.

Annotations
@Override
setEncodingback to summary
public void setEncoding(String encoding)

Implements org.w3c.dom.ls.LSInput.setEncoding.

Doc from org.w3c.dom.ls.LSInput.setEncoding.

The character encoding, if known. The encoding must be a string acceptable for an XML encoding declaration ([XML 1.0] section 4.3.3 "Character Encoding in Entities").
This attribute has no effect when the application provides a character stream or string data. For other sources of input, an encoding specified by means of this attribute will override any encoding specified in the XML declaration or the Text declaration, or an encoding obtained from a higher level protocol, such as HTTP [IETF RFC 2616].

Annotations
@Override
setPublicIdback to summary
public void setPublicId(String publicId)

Implements org.w3c.dom.ls.LSInput.setPublicId.

Doc from org.w3c.dom.ls.LSInput.setPublicId.

The public identifier for this input source. This may be mapped to an input source using an implementation dependent mechanism (such as catalogues or other mappings). The public identifier, if specified, may also be reported as part of the location information when errors are reported.

Annotations
@Override
setStringDataback to summary
public void setStringData(String stringData)

Implements org.w3c.dom.ls.LSInput.setStringData.

Doc from org.w3c.dom.ls.LSInput.setStringData.

String data to parse. If provided, this will always be treated as a sequence of 16-bit units (UTF-16 encoded characters). It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of the encoding attribute will be ignored.

Annotations
@Override
setSystemIdback to summary
public void setSystemId(String systemId)

Implements org.w3c.dom.ls.LSInput.setSystemId.

Doc from org.w3c.dom.ls.LSInput.setSystemId.

The system identifier, a URI reference [IETF RFC 2396], for this input source. The system identifier is optional if there is a byte stream, a character stream, or string data. It is still useful to provide one, since the application will use it to resolve any relative URIs and can include it in error messages and warnings. (The LSParser will only attempt to fetch the resource identified by the URI reference if there is no other input available in the input source.)
If the application knows the character encoding of the object pointed to by the system identifier, it can set the encoding using the encoding attribute.
If the specified system ID is a relative URI reference (see section 5 in [IETF RFC 2396]), the DOM implementation will attempt to resolve the relative URI with the baseURI as the base, if that fails, the behavior is implementation dependent.

Annotations
@Override