return _components.get(componentType);
}
public void load(String file) throws IOException, SAXException
{
TreeBuilder builder = new TreeBuilder();
XMLValidityTestCase.ER er = new XMLValidityTestCase.ER();
String publicID =
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN";
// TODO: fall back on RI location if MyFaces can't be found
URL dtdSource = getClass().getClassLoader().getResource(
"org/apache/myfaces/resource/web-facesconfig_1_1.dtd");
er.registerPublicId(publicID, dtdSource);
builder.setEntityResolver(er);
Enumeration<URL> resources = getClass().getClassLoader().getResources(file);
while (resources.hasMoreElements())
{
URL resource = resources.nextElement();
_LOG.info("PARSING " + resource);
InputStream inputStream = null;
// Try to get the inputStream off of a file
if ("file".equalsIgnoreCase(resource.getProtocol()))
{
File resourceFile = new File(resource.getFile().replaceAll("%20", " "));
if (resourceFile.exists())
{
inputStream = new FileInputStream(resourceFile);
}
}
if (inputStream == null)
inputStream = resource.openStream();
try
{
InputSource source = new InputSource(inputStream);
source.setSystemId(resource.toExternalForm());
builder.parse(source, new FacesConfigParser(this));
}
finally
{
inputStream.close();
}