Author: vitold
Date: 2009-03-24 10:54:54 -0400 (Tue, 24 Mar 2009)
New Revision: 2189
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
some changes with deployment types
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
14:49:27 UTC (rev 2188)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24
14:54:54 UTC (rev 2189)
@@ -2,6 +2,7 @@
import java.io.IOException;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
@@ -19,6 +20,10 @@
import org.dom4j.QName;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.MethodSignature;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
+import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
import org.jboss.webbeans.resources.spi.ResourceLoadingException;
public class ParseXmlHelper
@@ -83,13 +88,18 @@
}
catch (ResourceLoadingException e)
{
+ //work with this when 'classesList.size() == 0'
}
+ catch (ClassCastException e)
+ {
+ throw new DefinitionException("<Deploy> child <" +
element.getName() + "> must be a Java annotation type");
+ }
}
}
}
if (classesList.size() == 0)
- throw new DefinitionException("Could not find '" + className +
"'");
+ throw new DefinitionException("Could not find '" + className +
"' for bean <");
if (classesList.size() == 1)
return classesList.get(0);
@@ -197,7 +207,7 @@
public static boolean isMethod(Element element, AnnotatedClass<?> beanClass,
AnnotatedClass<?> expectedType)
{
- //TODO
+ //TODO
return false;
}
@@ -241,14 +251,4 @@
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;
- }*/
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java 2009-03-24
14:49:27 UTC (rev 2188)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java 2009-03-24
14:54:54 UTC (rev 2189)
@@ -7,8 +7,12 @@
public static final String DEPLOY = "Deploy";
public static final String INTERCEPTORS = "Interceptors";
+
+ public static final String INTERCEPTOR = "Interceptor";
public static final String DECORATORS = "Decorators";
+
+ public static final String DECORATOR = "Decorator";
public static final String BINDING_TYPE = "BindingType";
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 14:49:27
UTC (rev 2188)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 14:54:54
UTC (rev 2189)
@@ -14,6 +14,7 @@
import javax.inject.DefinitionException;
import javax.inject.DeploymentException;
+import javax.inject.DeploymentType;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@@ -177,8 +178,8 @@
{
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");
+ if(!deploymentClass.isAnnotationPresent(DeploymentType.class))
+ throw new DefinitionException("<Deploy> child <" +
child.getName() + "> must be a deployment type");
deploymentClasses.add(deploymentClass);
}
@@ -187,7 +188,7 @@
}
public void checkProduces(Element beanElement, AnnotatedClass<?> beanClass)
- {
+ {//TODO
Iterator<?> childIterator = beanElement.elementIterator();
while(childIterator.hasNext())
{
@@ -211,7 +212,7 @@
if(ParseXmlHelper.isMethod(producesElement, beanClass, beanClass))
{}
- throw new DefinitionException("A producer doesn't declared in class
file as method or field");
+// throw new DefinitionException("A producer doesn't declared in class
file as method or field");
}
}
Show replies by date