Author: pete.muir(a)jboss.org
Date: 2009-03-24 09:51:15 -0400 (Tue, 24 Mar 2009)
New Revision: 2182
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlEnvironment.java
Log:
Fix environment based file loader
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24
13:50:53 UTC (rev 2181)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24
13:51:15 UTC (rev 2182)
@@ -117,14 +117,14 @@
if (attrVal.startsWith(XmlConstants.URN_PREFIX))
{
urn = attrVal;
- URL namespaceFile = loadFile(urn, XmlConstants.NAMESPACE_FILE_NAME);
+ URL namespaceFile = environment.loadFileByUrn(urn,
XmlConstants.NAMESPACE_FILE_NAME);
if (namespaceFile == null)
throw new DefinitionException("Could not find '" +
XmlConstants.NAMESPACE_FILE_NAME + "' file according to specified URN '"
+ urn + "'");
packagesSet.addAll(parseNamespaceFile(namespaceFile));
}
if (attribute.getName().equalsIgnoreCase(XmlConstants.SCHEMA_LOCATION)
&& attrVal.startsWith(XmlConstants.HTTP_PREFIX) && urn.trim().length()
> 0)
{
- URL schemaFile = loadFile(urn, XmlConstants.SCHEMA_FILE_NAME);
+ URL schemaFile = environment.loadFileByUrn(urn,
XmlConstants.SCHEMA_FILE_NAME);
if (schemaFile == null)
throw new DefinitionException("Could not find '" +
XmlConstants.SCHEMA_FILE_NAME + "' file according to specified URN '" +
urn + "'");
}
@@ -146,7 +146,7 @@
{
Set<String> packagesSet = new HashSet<String>();
- URL namespaceFile = loadFile(uri, XmlConstants.NAMESPACE_FILE_NAME);
+ URL namespaceFile = environment.loadFileByUrn(uri,
XmlConstants.NAMESPACE_FILE_NAME);
if (namespaceFile != null)
{
packagesSet.addAll(parseNamespaceFile(namespaceFile));
@@ -242,7 +242,7 @@
}
}
- private static URL loadFile(String urn, String fileName)
+ /*private static URL loadFile(String urn, String fileName)
{
char separator = '/';
String packageName = urn.replaceFirst(XmlConstants.URN_PREFIX, "");
@@ -250,5 +250,5 @@
String filePath = separator + path + separator + fileName;
URL namespaceFile = ParseXmlHelper.class.getResource(filePath);
return namespaceFile;
- }
+ }*/
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlEnvironment.java 2009-03-24
13:50:53 UTC (rev 2181)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlEnvironment.java 2009-03-24
13:51:15 UTC (rev 2182)
@@ -65,21 +65,12 @@
return enabledDeploymentTypes;
}
- public URL loadNamespaceFile(String namespace)
- {
- char separator = '/';
- String packageName = namespace.replaceFirst(XmlConstants.URN_PREFIX,
"");
- String path = packageName.replace('.', separator);
- String filePath = separator + path + separator + XmlConstants.NAMESPACE_FILE_NAME;
- return serviceRegistry.get(ResourceLoader.class).getResource(filePath);
- }
-
public URL loadFileByUrn(String urn, String fileName)
{
char separator = '/';
String packageName = urn.replaceFirst(XmlConstants.URN_PREFIX, "");
String path = packageName.replace('.', separator);
- String filePath = separator + path + separator + fileName;
+ String filePath = path + separator + fileName;
return serviceRegistry.get(ResourceLoader.class).getResource(filePath);
}
Show replies by date