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

public Class ParseConfigResourceToDOMTask

extends Object
implements Callable<DocumentInfo>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable
Static Imports
com.sun.faces.RIConstants.CHAR_ENCODING, .RIConstants.DOCUMENT_NAMESPACE, com.sun.faces.config.manager.DbfFactory.FACES_ENTITY_RESOLVER, .DbfFactory.FACES_ERROR_HANDLER, .FacesSchema.Schemas.FACES_CONFIG_1_X_DEFAULT_NS, .FacesSchema.Schemas.JAKARTAEE_SCHEMA_DEFAULT_NS, .FacesSchema.Schemas.JAVAEE_SCHEMA_DEFAULT_NS, .FacesSchema.Schemas.JAVAEE_SCHEMA_LEGACY_DEFAULT_NS, com.sun.faces.config.processor.FacesFlowDefinitionConfigProcessor.synthesizeEmptyFlowDefinition, .FacesFlowDefinitionConfigProcessor.uriIsFlowDefinition, com.sun.faces.util.Util.createTransformerFactory, java.lang.System.arraycopy, java.text.MessageFormat.format, java.util.logging.Level.WARNING

This Callable will be used by getXMLDocuments It represents a single configuration resource (such as faces-config.xml) to be parsed into a DOM.

Field Summary

Modifier and TypeField and Description
private URI
private static final String
private static final String
private static final String
private static final String
FACES_TO_1_1_PRIVATE_XSL

Stylesheet to convert 1.0 and 1.1 based faces-config documents to our private 1.1 schema for validation.

private DocumentBuilderFactory
private static final Logger
private ServletContext
private boolean
public static final String
WEB_INF_MARKER

Name of the attribute added by ParseTask to indicate a Document instance as a representation of /WEB-INF/faces-config.xml.

Constructor Summary

AccessConstructor and Description
public
ParseConfigResourceToDOMTask(ServletContext
the servlet context.
servletContext
,
boolean
whether or not we're validating
validating
,
URI
a URL to the configuration resource to be parsed
documentURI
)

Constructs a new ParseTask instance

Method Summary

Modifier and TypeMethod and Description
public DocumentInfo

Returns:

the result of the parse operation (a DOM)
call
()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.
private Schema
findMatchingSchema(String documentNS, String version, String localName)

private DocumentBuilder
private Document

Returns:

Document based on documentURI.
getDocument
()

private Document
private static InputStream

Returns:

an InputStream to the resource referred to by url
getInputStream
(URL
source URL
url
)

private DocumentBuilder
private static Transformer

Returns:

a new Tranformer instance
getTransformer
(String documentNS)

Obtain a Transformer using the style sheet referenced by the XSL constant.

private String
getVersion(Node documentElement)

private boolean
isNonFacesConfigDocument(String rootElementTagName)

private Document
loadDocument(Schema schema, DOMSource domSource)

private Document
loadDocument(Schema schema, DOMResult domResult)

private Document
parseDocumentFromURL(DocumentBuilder documentBuilder, URL documentURL)

private boolean
private static DOMResult
transformDocument(String documentNS, DOMSource domSource)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

documentURIback to summary
private URI documentURI
EMPTY_FACES_CONFIGback to summary
private static final String EMPTY_FACES_CONFIG
FACELET_TAGLIB_TAGNAMEback to summary
private static final String FACELET_TAGLIB_TAGNAME
FACES_CONFIG_TAGNAMEback to summary
private static final String FACES_CONFIG_TAGNAME
FACES_TO_1_1_PRIVATE_XSLback to summary
private static final String FACES_TO_1_1_PRIVATE_XSL

Stylesheet to convert 1.0 and 1.1 based faces-config documents to our private 1.1 schema for validation.

factoryback to summary
private DocumentBuilderFactory factory
LOGGERback to summary
private static final Logger LOGGER
servletContextback to summary
private ServletContext servletContext
validatingback to summary
private boolean validating
WEB_INF_MARKERback to summary
public static final String WEB_INF_MARKER

Name of the attribute added by ParseTask to indicate a Document instance as a representation of /WEB-INF/faces-config.xml.

Constructor Detail

ParseConfigResourceToDOMTaskback to summary
public ParseConfigResourceToDOMTask(ServletContext servletContext, boolean validating, URI documentURI) throws Exception

Constructs a new ParseTask instance

Parameters
servletContext:ServletContext

the servlet context.

validating:boolean

whether or not we're validating

documentURI:URI

a URL to the configuration resource to be parsed

Exceptions
Exception:
general error

Method Detail

callback to summary
public DocumentInfo call() throws Exception

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:DocumentInfo

the result of the parse operation (a DOM)

Annotations
@Override
Exceptions
Exception:
if an error occurs during the parsing process
findMatchingSchemaback to summary
private Schema findMatchingSchema(String documentNS, String version, String localName)
getBuilderForSchemaback to summary
private DocumentBuilder getBuilderForSchema(Schema schema) throws Exception
getDocumentback to summary
private Document getDocument() throws Exception
Returns:Document

Document based on documentURI.

Exceptions
Exception:
if an error occurs during the process of building a Document
getEmptyFacesConfigback to summary
private Document getEmptyFacesConfig(DocumentBuilder documentBuilder) throws SAXException, IOException
getInputStreamback to summary
private static InputStream getInputStream(URL url) throws IOException
Parameters
url:URL

source URL

Returns:InputStream

an InputStream to the resource referred to by url

Exceptions
IOException:
if an error occurs
getNonValidatingBuilderback to summary
private DocumentBuilder getNonValidatingBuilder() throws Exception
getTransformerback to summary
private static Transformer getTransformer(String documentNS) throws Exception

Obtain a Transformer using the style sheet referenced by the XSL constant.

Returns:Transformer

a new Tranformer instance

Exceptions
Exception:
if a Tranformer instance could not be created
getVersionback to summary
private String getVersion(Node documentElement)
isNonFacesConfigDocumentback to summary
private boolean isNonFacesConfigDocument(String rootElementTagName)
loadDocumentback to summary
private Document loadDocument(Schema schema, DOMSource domSource) throws Exception
loadDocumentback to summary
private Document loadDocument(Schema schema, DOMResult domResult) throws Exception
parseDocumentFromURLback to summary
private Document parseDocumentFromURL(DocumentBuilder documentBuilder, URL documentURL) throws SAXException, IOException
streamIsZeroLengthOrEmptyback to summary
private boolean streamIsZeroLengthOrEmpty(InputStream is) throws IOException
transformDocumentback to summary
private static DOMResult transformDocument(String documentNS, DOMSource domSource) throws Exception