[webbeans-commits] Webbeans SVN: r2186 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: xmlmetadata/declaration and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 10:10:48 -0400 (Tue, 24 Mar 2009)
New Revision: 2186
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/BeanDeclarationTest.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/bean/
Log:
rename test package
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/BeanDeclarationTest.java (from rev 2178, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/bean/BeanDeclarationTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/BeanDeclarationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/BeanDeclarationTest.java 2009-03-24 14:10:48 UTC (rev 2186)
@@ -0,0 +1,68 @@
+package org.jboss.jsr299.tck.tests.xml.declaration.bean;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+@Artifact
+public class BeanDeclarationTest extends AbstractJSR299Test
+{
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "a")
+ public void testDirectRootChildren()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "b")
+ public void testDeclaredJavaType()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "c")
+ public void testIsElementJmsResource()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "d")
+ public void testIsElementResource()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "e")
+ public void testIsElementSessionBean()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "f")
+ public void testIsElementSimpleBean()
+ {
+ assert false;
+ }
+
+ @Test(expectedExceptions = DefinitionException.class, groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "g")
+ public void testDefinitionErrorInWebbeansXml()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "stub", "webbeansxml" })
+ @SpecAssertion(section = "9.5", id = "h")
+ public void testInlineBeanDeclaration()
+ {
+ assert false;
+ }
+}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2185 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: xml and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 10:07:06 -0400 (Tue, 24 Mar 2009)
New Revision: 2185
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/child/
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/bean/child/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/interceptor/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/stereotype/
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/child/BeanChildDeclarationTest.java
Log:
rename test package
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/child (from rev 2178, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/bean/child)
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/child/BeanChildDeclarationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/declaration/bean/child/BeanChildDeclarationTest.java 2009-03-24 10:41:17 UTC (rev 2178)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/declaration/bean/child/BeanChildDeclarationTest.java 2009-03-24 14:07:06 UTC (rev 2185)
@@ -1,4 +1,4 @@
-package org.jboss.jsr299.tck.tests.xmlmetadata.declaration.bean.child;
+package org.jboss.jsr299.tck.tests.xml.declaration.bean.child;
import javax.inject.DefinitionException;
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2184 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 09:57:22 -0400 (Tue, 24 Mar 2009)
New Revision: 2184
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java
Log:
WBRI-205
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 13:54:01 UTC (rev 2183)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 13:57:22 UTC (rev 2184)
@@ -19,6 +19,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
+import java.lang.reflect.Type;
import java.util.Set;
import javax.context.CreationalContext;
@@ -129,6 +130,31 @@
{
throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
}
+ else if (declaringBean instanceof EnterpriseBean)
+ {
+ boolean methodDeclaredOnTypes = false;
+ // TODO use annotated item?
+ for (Type type : declaringBean.getTypes())
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ try
+ {
+ clazz.getDeclaredMethod(getAnnotatedItem().getName(), getAnnotatedItem().getParameterTypesAsArray());
+ methodDeclaredOnTypes = true;
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // No - op
+ }
+ }
+ }
+ if (!methodDeclaredOnTypes)
+ {
+ throw new DefinitionException("Producer method " + toString() + " must be declared on a business interface of " + declaringBean);
+ }
+ }
}
/**
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java 2009-03-24 13:54:01 UTC (rev 2183)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/enterprise/nonbusiness/ProducerMethodNotBusinessMethodTest.java 2009-03-24 13:57:22 UTC (rev 2184)
@@ -3,6 +3,7 @@
import javax.inject.DefinitionException;
import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
@@ -15,8 +16,11 @@
@ExpectedDeploymentException(DefinitionException.class)
public class ProducerMethodNotBusinessMethodTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
- @SpecAssertion(section = "3.4.2", id = "f")
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "3.4.2", id = "f"),
+ @SpecAssertion(section = "3.4", id = "d")
+ })
public void testProducerMethodOnSessionBeanMustBeBusinessMethod()
{
assert false;
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2182 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.
by webbeans-commits@lists.jboss.org
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);
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2181 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/examples.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 09:50:53 -0400 (Tue, 24 Mar 2009)
New Revision: 2181
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/examples/MockExampleTest.java
Log:
tidy up
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/examples/MockExampleTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/examples/MockExampleTest.java 2009-03-24 13:27:28 UTC (rev 2180)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/examples/MockExampleTest.java 2009-03-24 13:50:53 UTC (rev 2181)
@@ -11,10 +11,9 @@
{
@Test
- public void testMockSentenceTranslator() throws Exception {
+ public void testMockSentenceTranslator() throws Exception
+ {
- //manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, Mock.class));
-
new RunInDependentContext()
{
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2180 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-24 09:27:28 -0400 (Tue, 24 Mar 2009)
New Revision: 2180
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
Log:
minor changes
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 12:54:58 UTC (rev 2179)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24 13:27:28 UTC (rev 2180)
@@ -117,14 +117,14 @@
if (attrVal.startsWith(XmlConstants.URN_PREFIX))
{
urn = attrVal;
- URL namespaceFile = environment.loadFileByUrn(urn, XmlConstants.NAMESPACE_FILE_NAME);
+ URL namespaceFile = loadFile(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 = environment.loadFileByUrn(urn, XmlConstants.SCHEMA_FILE_NAME);
+ URL schemaFile = loadFile(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 = environment.loadFileByUrn(uri, XmlConstants.NAMESPACE_FILE_NAME);
+ URL namespaceFile = loadFile(uri, XmlConstants.NAMESPACE_FILE_NAME);
if (namespaceFile != null)
{
packagesSet.addAll(parseNamespaceFile(namespaceFile));
@@ -241,4 +241,14 @@
packagesMap.put(prefix, packagesSet);
}
}
+
+ private static URL loadFile(String urn, String fileName)
+ {
+ char separator = '/';
+ String packageName = urn.replaceFirst(XmlConstants.URN_PREFIX, "");
+ String path = packageName.replace('.', separator);
+ String filePath = separator + path + separator + fileName;
+ URL namespaceFile = ParseXmlHelper.class.getResource(filePath);
+ return namespaceFile;
+ }
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2179 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 08:54:58 -0400 (Tue, 24 Mar 2009)
New Revision: 2179
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
minor
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 10:41:17 UTC (rev 2178)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24 12:54:58 UTC (rev 2179)
@@ -1,6 +1,7 @@
package org.jboss.webbeans.xml;
import java.io.IOException;
+import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
@@ -61,7 +62,41 @@
throw new DefinitionException("There are multiple packages containing a Java type with the same name '" + className + "'");
}
+
+ public static <T extends Annotation> Class<? extends T> loadAnnotationClass(Element element, Class<T> expectedType, XmlEnvironment environment, Map<String, Set<String>> packagesMap)
+ {
+ List<Class<? extends T>> classesList = new ArrayList<Class<? extends T>>();
+ String className = element.getName();
+ String prefix = element.getNamespacePrefix();
+ for (Map.Entry<String, Set<String>> packagesEntry : packagesMap.entrySet())
+ {
+ if (prefix.equalsIgnoreCase(packagesEntry.getKey()))
+ {
+ Set<String> packages = packagesEntry.getValue();
+ for (String packageName : packages)
+ {
+ String classPath = packageName + "." + element.getName();
+ try
+ {
+ classesList.add(environment.loadAnnotation(classPath, expectedType));
+ }
+ catch (ResourceLoadingException e)
+ {
+ }
+ }
+ }
+ }
+
+ if (classesList.size() == 0)
+ throw new DefinitionException("Could not find '" + className + "'");
+
+ if (classesList.size() == 1)
+ return classesList.get(0);
+
+ throw new DefinitionException("There are multiple packages containing a Java type with the same name '" + className + "'");
+ }
+
public static void checkProduces(Element element, AnnotatedClass<?> beanClass)
{
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 10:41:17 UTC (rev 2178)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 12:54:58 UTC (rev 2179)
@@ -175,12 +175,12 @@
List<Element> children = element.elements();
for (Element child : children)
{
- AnnotatedClass<? extends Annotation> deploymentClass = ParseXmlHelper.loadElementClass(child, Annotation.class, environment, packagesMap);
+ Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(child, Annotation.class, environment, packagesMap);
// if(deploymentClass.getAnnotation(DeploymentType.class) == null)
// throw new DefinitionException("<Deploy> child <" + element.getName() + "> must be a deployment type");
- deploymentClasses.add(deploymentClass.getRawType());
+ deploymentClasses.add(deploymentClass);
}
haveAnyDeployElement = true;
return deploymentClasses;
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2178 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-24 06:41:17 -0400 (Tue, 24 Mar 2009)
New Revision: 2178
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
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
add method loadFileByUrn(...) into XmlEnvironment.java for loadin schema.xsd and namespace files
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 10:09:28 UTC (rev 2177)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24 10:41:17 UTC (rev 2178)
@@ -66,7 +66,7 @@
{
}
- public static void checkRootAttributes(Element root, Map<String, Set<String>> packagesMap)
+ public static void checkRootAttributes(Element root, Map<String, Set<String>> packagesMap, XmlEnvironment environment)
{
Iterator<?> rootAttrIterator = root.attributeIterator();
while (rootAttrIterator.hasNext())
@@ -82,14 +82,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 + "'");
}
@@ -99,7 +99,7 @@
}
}
- public static void checkRootDeclaredNamespaces(Element root, Map<String, Set<String>> packagesMap)
+ public static void checkRootDeclaredNamespaces(Element root, Map<String, Set<String>> packagesMap, XmlEnvironment environment)
{
Iterator<?> namespacesIterator = root.declaredNamespaces().iterator();
while (namespacesIterator.hasNext())
@@ -111,7 +111,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));
@@ -166,16 +166,6 @@
return false;
}
- private static URL loadFile(String urn, String fileName)
- {
- char separator = '/';
- String packageName = urn.replaceFirst(XmlConstants.URN_PREFIX, "");
- String path = packageName.replace('.', separator);
- String filePath = separator + path + separator + fileName;
- URL namespaceFile = ParseXmlHelper.class.getResource(filePath);
- return namespaceFile;
- }
-
private static Set<String> parseNamespaceFile(URL namespaceFile)
{
Set<String> packages = new HashSet<String>();
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 10:09:28 UTC (rev 2177)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlEnvironment.java 2009-03-24 10:41:17 UTC (rev 2178)
@@ -74,4 +74,13 @@
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;
+ return serviceRegistry.get(ResourceLoader.class).getResource(filePath);
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 10:09:28 UTC (rev 2177)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 10:41:17 UTC (rev 2178)
@@ -14,7 +14,6 @@
import javax.inject.DefinitionException;
import javax.inject.DeploymentException;
-import javax.inject.manager.Bean;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@@ -219,7 +218,7 @@
private void fullFillPackagesMap(Document document)
{
Element root = document.getRootElement();
- ParseXmlHelper.checkRootAttributes(root, packagesMap);
- ParseXmlHelper.checkRootDeclaredNamespaces(root, packagesMap);
+ ParseXmlHelper.checkRootAttributes(root, packagesMap, environment);
+ ParseXmlHelper.checkRootDeclaredNamespaces(root, packagesMap, environment);
}
}
15 years, 9 months