[webbeans-commits] Webbeans SVN: r95 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/deployment and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-11 12:32:44 -0400 (Mon, 11 Aug 2008)
New Revision: 95
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
Log:
Restructure component model to support JMS and producers
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -7,6 +7,7 @@
import javax.webbeans.ComponentInstance;
import javax.webbeans.Container;
+import org.jboss.webbeans.model.AbstractClassComponentModel;
import org.jboss.webbeans.model.AbstractComponentModel;
import org.jboss.webbeans.util.LoggerUtil;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -14,13 +14,13 @@
import org.jboss.webbeans.ComponentInstanceImpl;
import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.SimpleComponentModel;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.scannotation.AnnotationDB;
import org.jboss.webbeans.scannotation.ClasspathUrlFinder;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
import org.jboss.webbeans.util.LoggerUtil;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
import org.jboss.webbeans.util.Reflections;
/**
@@ -105,7 +105,7 @@
Class<?> stereotypeClass = Reflections.classForName(className);
if (stereotypeClass.isAnnotation())
{
- StereotypeModel stereotypeModel = new StereotypeModel(new ClassAnnotatedItem(stereotypeClass));
+ StereotypeModel stereotypeModel = new StereotypeModel(new SimpleAnnotatedType(stereotypeClass));
container.getStereotypeManager().addStereotype(stereotypeModel);
log.info("Stereotype: " + stereotypeModel);
}
@@ -139,8 +139,8 @@
if (!componentClass.isAnnotation())
{
SimpleComponentModel componentModel = new SimpleComponentModel(
- new ClassAnnotatedItem(componentClass),
- new MutableAnnotatedItem(null, new HashMap()), container);
+ new SimpleAnnotatedType(componentClass),
+ new SimpleAnnotatedType(null, new HashMap()), container);
container.addComponent(new ComponentInstanceImpl(componentModel));
log.info("Web Bean: " + componentModel);
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,48 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+
+/**
+ * AnnotatedItem provides a uniform access to the annotations on an annotated
+ * item defined either in Java or XML
+ *
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedItem
+{
+
+ /**
+ * Get all annotations on the item
+ *
+ * An empty set is returned if no annotations are present
+ */
+ public abstract <T extends Annotation> Set<T> getAnnotations();
+
+ /**
+ * Get all annotations which are annotated with the given meta annotation
+ * type
+ *
+ * If no annotations are present which are annotated with the given meta
+ * annotation an empty set is returned
+ */
+ public abstract <T extends Annotation> Set<Annotation> getAnnotations(
+ Class<T> metaAnnotationType);
+
+ /**
+ * Get an annotation for the annotation type specified.
+ *
+ * If the annotation isn't present, null is returned
+ */
+ public abstract <T extends Annotation> T getAnnotation(
+ Class<T> annotationType);
+
+ /**
+ * Return true if the annotation type specified is present
+ */
+ public abstract boolean isAnnotationPresent(
+ Class<? extends Annotation> annotationType);
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Method;
+
+/**
+ * AnnotatedType provides a uniform access to the annotations on an annotated
+ * class defined either in Java or XML
+ *
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedMethod extends AnnotatedItem
+{
+
+ public Method getAnnotatedMethod();
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java (from rev 78, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.introspector;
+
+
+/**
+ * AnnotatedType provides a uniform access to the annotations on an annotated
+ * class defined either in Java or XML
+ *
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedType extends AnnotatedItem
+{
+
+ /**
+ * Return the class of the annotated item. If this annotatedItem isn't in use
+ * then this method should return null
+ */
+ public Class<?> getAnnotatedClass();
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,99 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+public class SimpleAnnotatedItem implements AnnotatedItem
+{
+
+ private Map<Class<? extends Annotation>, Annotation> annotationMap;
+ private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations;
+ private Set<Annotation> annotationSet;
+
+ public SimpleAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ if (annotationMap == null)
+ {
+ throw new NullPointerException("annotationMap cannot be null");
+ }
+ this.annotationMap = annotationMap;
+ }
+
+ protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(AnnotatedElement element)
+ {
+ Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+ for (Annotation annotation : element.getAnnotations())
+ {
+ annotationMap.put(annotation.annotationType(), annotation);
+ }
+ return annotationMap;
+ }
+
+ protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
+ {
+ annotationSet.add(entry.getValue());
+ }
+ return annotationSet;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ return (T) annotationMap.get(annotationType);
+ }
+
+ public <T extends Annotation> Set<Annotation> getAnnotations(Class<T> metaAnnotationType)
+ {
+ if (metaAnnotations == null)
+ {
+ metaAnnotations = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
+ }
+ populateMetaAnnotationMap(metaAnnotationType, metaAnnotations, annotationMap);
+ return metaAnnotations.get(metaAnnotationType);
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ if (annotationSet == null)
+ {
+ annotationSet = populateAnnotationSet(new HashSet<Annotation>(), annotationMap);
+ }
+ return annotationSet;
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
+ {
+ return annotationMap.containsKey(annotatedType);
+ }
+
+ protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<Annotation>> populateMetaAnnotationMap(
+ Class<T> metaAnnotationType, Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations, Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ if (!metaAnnotations.containsKey(metaAnnotationType))
+ {
+ Set<Annotation> s = new HashSet<Annotation>();
+ for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
+ {
+ if (entry.getValue().annotationType().isAnnotationPresent(metaAnnotationType))
+ {
+ s.add(entry.getValue());
+ }
+ }
+ metaAnnotations.put(metaAnnotationType, s);
+ }
+ return metaAnnotations;
+ }
+
+ protected Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
+ {
+ return annotationMap;
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Method;
+
+public class SimpleAnnotatedMethod extends SimpleAnnotatedItem implements AnnotatedMethod
+{
+
+ private Method annotatedMethod;
+
+ public SimpleAnnotatedMethod(Method method)
+ {
+ super(buildAnnotationMap(method));
+ this.annotatedMethod = method;
+ }
+
+ public Method getAnnotatedMethod()
+ {
+ return annotatedMethod;
+ }
+
+ @Override
+ public String toString()
+ {
+ return annotatedMethod + " " + getAnnotatedMethod().toString();
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java (from rev 78, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,40 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+/**
+ * Base class for implementing AnnotatedItem. This implementation assumes
+ * the annotationMap is immutable.
+ *
+ * @author pmuir
+ *
+ */
+public class SimpleAnnotatedType extends SimpleAnnotatedItem implements AnnotatedType
+{
+
+ private Class<?> annotatedClass;
+
+ public SimpleAnnotatedType(Class<?> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ super(annotationMap);
+ this.annotatedClass = annotatedClass;
+ }
+
+ public SimpleAnnotatedType(Class<?> annotatedClass)
+ {
+ this(annotatedClass, buildAnnotationMap(annotatedClass));
+ }
+
+ public Class<?> getAnnotatedClass()
+ {
+ return annotatedClass;
+ }
+
+ @Override
+ public String toString()
+ {
+ return annotatedClass + " " + super.getAnnotationMap().toString();
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java (from rev 93, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,385 @@
+package org.jboss.webbeans.model;
+
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.DeploymentType;
+import javax.webbeans.Destroys;
+import javax.webbeans.Named;
+import javax.webbeans.ScopeType;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.bindings.DependentBinding;
+import org.jboss.webbeans.bindings.ProductionBinding;
+import org.jboss.webbeans.ejb.EjbMetaData;
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.LoggerUtil;
+import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.Strings;
+
+
+
+/**
+ * Web Beans Component meta model
+ *
+ * @author Pete Muir
+ *
+ */
+public abstract class AbstractClassComponentModel<T> extends AbstractComponentModel<T>
+{
+
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ private Annotation deploymentType;
+ private MergedStereotypesModel mergedStereotypes;
+ private String name;
+ private Annotation scopeType;
+ private Class<? extends T> type;
+ private Set<Annotation> bindingTypes;
+
+ /**
+ *
+ * @param annotatedItem Annotations read from java classes
+ * @param xmlAnnotatedItem Annotations read from XML
+ * @param container
+ */
+ @SuppressWarnings("unchecked")
+ public AbstractClassComponentModel(AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem, ContainerImpl container)
+ {
+ if (annotatedItem == null)
+ {
+ throw new NullPointerException("annotatedItem must not be null. If the component is declared just in XML, pass in an empty annotatedItem");
+ }
+
+ if (xmlAnnotatedItem == null)
+ {
+ throw new NullPointerException("xmlAnnotatedItem must not be null. If the component is declared just in Java, pass in an empty xmlAnnotatedItem");
+ }
+ this.type = (Class<? extends T>) initType(annotatedItem, xmlAnnotatedItem);
+ log.fine("Building Web Bean component metadata for " + type);
+ this.bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
+ mergedStereotypes = new MergedStereotypesModel(annotatedItem, xmlAnnotatedItem, container);
+ this.deploymentType = initDeploymentType(mergedStereotypes, annotatedItem, xmlAnnotatedItem, container);
+ this.scopeType = initScopeType(mergedStereotypes, annotatedItem, xmlAnnotatedItem);
+ this.name = initName(getMergedStereotypes(), annotatedItem, xmlAnnotatedItem, getType());
+ checkRequiredTypesImplemented(getMergedStereotypes(), getType());
+ checkScopeAllowed(getMergedStereotypes(), getScopeType(), getType());
+ // TODO This is too high
+ checkComponentImplementation(getType());
+ // TODO Interceptors
+ }
+
+ @SuppressWarnings("unchecked")
+ protected static Class<?> initType(AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem)
+ {
+ if (annotatedItem.getAnnotatedClass() != null && xmlAnnotatedItem.getAnnotatedClass() != null && !annotatedItem.getAnnotatedClass().equals(xmlAnnotatedItem.getAnnotatedClass()))
+ {
+ throw new IllegalArgumentException("Cannot build a component which specifies different classes in XML and Java");
+ }
+ else if (xmlAnnotatedItem.getAnnotatedClass() != null)
+ {
+ log.finest("Component type specified in XML");
+ return xmlAnnotatedItem.getAnnotatedClass();
+ }
+ else if (annotatedItem.getAnnotatedClass() != null)
+ {
+ log.finest("Component type specified in Java");
+ return annotatedItem.getAnnotatedClass();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot build a component which doesn't specify a type");
+ }
+ }
+
+ protected static Annotation initDeploymentType(MergedStereotypesModel stereotypes, AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem, ContainerImpl container)
+ {
+ Set<Annotation> xmlDeploymentTypes = xmlAnnotatedItem.getAnnotations(DeploymentType.class);
+
+ if (xmlDeploymentTypes.size() > 1)
+ {
+ throw new RuntimeException("At most one deployment type may be specified (" + xmlDeploymentTypes + " are specified)");
+ }
+
+ if (xmlDeploymentTypes.size() == 1)
+ {
+ Annotation deploymentType = xmlDeploymentTypes.iterator().next();
+ log.finest("Deployment type " + deploymentType + " specified in XML");
+ return deploymentType;
+ }
+
+ if (xmlAnnotatedItem.getAnnotatedClass() == null)
+ {
+
+ Set<Annotation> deploymentTypes = annotatedItem.getAnnotations(DeploymentType.class);
+
+ if (deploymentTypes.size() > 1)
+ {
+ throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + annotatedItem.getAnnotatedClass());
+ }
+ if (deploymentTypes.size() == 1)
+ {
+ Annotation deploymentType = deploymentTypes.iterator().next();
+ log.finest("Deployment type " + deploymentType + " specified by annotation");
+ return deploymentType;
+ }
+ }
+
+ if (stereotypes.getPossibleDeploymentTypes().size() > 0)
+ {
+ Annotation deploymentType = getDeploymentType(container.getEnabledDeploymentTypes(), stereotypes.getPossibleDeploymentTypes());
+ log.finest("Deployment type " + deploymentType + " specified by stereotype");
+ return deploymentType;
+ }
+
+ if (xmlAnnotatedItem.getAnnotatedClass() != null)
+ {
+ log.finest("Using default @Production deployment type");
+ return new ProductionBinding();
+ }
+ throw new RuntimeException("All Java annotated classes have a deployment type");
+ }
+
+ /**
+ * Return the scope of the component
+ */
+ protected static Annotation initScopeType(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
+ {
+ Set<Annotation> xmlScopes = xmlAnnotatedItem.getAnnotations(ScopeType.class);
+ if (xmlScopes.size() > 1)
+ {
+ throw new RuntimeException("At most one scope may be specified in XML");
+ }
+
+ if (xmlScopes.size() == 1)
+ {
+ Annotation scope = xmlScopes.iterator().next();
+ log.finest("Scope " + scope + " specified in XML");
+ return scope;
+ }
+
+ Set<Annotation> scopes = annotatedItem.getAnnotations(ScopeType.class);
+ if (scopes.size() > 1)
+ {
+ throw new RuntimeException("At most one scope may be specified");
+ }
+
+ if (scopes.size() == 1)
+ {
+ Annotation scope = scopes.iterator().next();
+ log.finest("Scope " + scope + " specified b annotation");
+ return scope;
+ }
+
+ if (stereotypes.getPossibleScopeTypes().size() == 1)
+ {
+ Annotation scope = stereotypes.getPossibleScopeTypes().iterator().next();
+ log.finest("Scope " + scope + " specified by stereotype");
+ return scope;
+ }
+ else if (stereotypes.getPossibleScopeTypes().size() > 1)
+ {
+ throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the component");
+ }
+
+ log.finest("Using default @Dependent scope");
+ return new DependentBinding();
+ }
+
+ public static Annotation getDeploymentType(List<Annotation> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
+ {
+ for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
+ {
+ if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i).annotationType())))
+ {
+ return enabledDeploymentTypes.get(i);
+ }
+ }
+ return null;
+ }
+
+ protected static String initName(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, Class<?> type)
+ {
+ boolean componentNameDefaulted = false;
+ String name = null;
+ if (xmlAnnotatedItem.isAnnotationPresent(Named.class))
+ {
+ name = xmlAnnotatedItem.getAnnotation(Named.class).value();
+ if ("".equals(name))
+ {
+ log.finest("Using default name (specified in XML)");
+ componentNameDefaulted = true;
+ }
+ else
+ {
+ log.finest("Using name " + name + " specified in XML");
+ }
+ }
+ else if (annotatedItem.isAnnotationPresent(Named.class))
+ {
+ name = annotatedItem.getAnnotation(Named.class).value();
+ if ("".equals(name))
+ {
+ log.finest("Using default name (specified by annotations)");
+ componentNameDefaulted = true;
+ }
+ else
+ {
+ log.finest("Using name " + name + " specified in XML");
+ }
+ }
+ if ("".equals(name) && (componentNameDefaulted || stereotypes.isComponentNameDefaulted()))
+ {
+ name = Strings.decapitalize(type.getSimpleName());
+ log.finest("Default name of " + type + " is " + name );
+ }
+ return name;
+ }
+
+ /**
+ * Check that the types required by the stereotypes on the component are implemented
+ */
+ protected static void checkRequiredTypesImplemented(MergedStereotypesModel stereotypes, Class<?> type)
+ {
+ for (Class<?> requiredType : stereotypes.getRequiredTypes())
+ {
+ log.finest("Checking if required type " + requiredType + " is implemented");
+ if (!requiredType.isAssignableFrom(type))
+ {
+ throw new RuntimeException("Required type " + requiredType + " isn't implemented on " + type);
+ }
+ }
+ }
+
+ /**
+ * Check that the scope type is allowed by the stereotypes on the component and the component type
+ * @param type
+ */
+ protected static void checkScopeAllowed(MergedStereotypesModel stereotypes, Annotation scopeType, Class<?> type)
+ {
+ log.finest("Checking if " + scopeType + " is allowed for " + type);
+ if (stereotypes.getSupportedScopes().size() > 0)
+ {
+ if (!stereotypes.getSupportedScopes().contains(scopeType.annotationType()))
+ {
+ throw new RuntimeException("Scope " + scopeType + " is not an allowed by the stereotype for " + type);
+ }
+ }
+ if (isDeclaredFinal(type) && !scopeType.annotationType().equals(Dependent.class))
+ {
+ throw new RuntimeException("Scope " + scopeType + " is not allowed as the class is declared final or has methods declared final for " + type + ". Only @Dependent is allowed for final components");
+ }
+ }
+
+ protected static boolean isDeclaredFinal(Class<?> type)
+ {
+ if (Reflections.isFinal(type))
+ {
+ return true;
+ }
+ for (Method method : type.getDeclaredMethods())
+ {
+ if (Reflections.isFinal(method))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected static <T> InjectableMethod<?> initRemoveMethod(EjbMetaData<T> ejbMetaData, Class<? extends T> type)
+ {
+ if (ejbMetaData.isStateful())
+ {
+ if (ejbMetaData.getRemoveMethods().size() == 1)
+ {
+ return new InjectableMethod<Object>(ejbMetaData.getRemoveMethods().get(0));
+ }
+ else if (ejbMetaData.getRemoveMethods().size() > 1)
+ {
+ List<Method> possibleRemoveMethods = new ArrayList<Method>();
+ for (Method removeMethod : ejbMetaData.getRemoveMethods())
+ {
+ if (removeMethod.isAnnotationPresent(Destroys.class))
+ {
+ possibleRemoveMethods.add(removeMethod);
+ }
+ }
+ if (possibleRemoveMethods.size() == 1)
+ {
+ return new InjectableMethod<Object>(possibleRemoveMethods.get(0));
+ }
+ else if (possibleRemoveMethods.size() > 1)
+ {
+ throw new RuntimeException("Multiple remove methods are annotated @Destroys for " + type);
+ }
+ else if (possibleRemoveMethods.size() == 0)
+ {
+ throw new RuntimeException("Multiple remove methods are declared, and none are annotated @Destroys for " + type);
+ }
+ }
+ else if (ejbMetaData.getRemoveMethods().size() == 0)
+ {
+ throw new RuntimeException("Stateful enterprise bean component has no remove methods declared for " + type);
+ }
+ }
+ else
+ {
+ List<Method> destroysMethods = Reflections.getMethods(type, Destroys.class);
+ if (destroysMethods.size() > 0)
+ {
+ throw new RuntimeException("Only stateful enterprise bean components can have methods annotated @Destroys; " + type + " is not a stateful enterprise bean component");
+ }
+ }
+ return null;
+ }
+
+ protected static void checkComponentImplementation(Class<?> type)
+ {
+ if (Reflections.isAbstract(type))
+ {
+ throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
+ }
+ }
+
+ public Annotation getDeploymentType()
+ {
+ return deploymentType;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public Annotation getScopeType()
+ {
+ return scopeType;
+ }
+
+ protected MergedStereotypesModel getMergedStereotypes()
+ {
+ return mergedStereotypes;
+ }
+
+ protected Class<? extends T> getType()
+ {
+ return type;
+ }
+
+ public Set<Annotation> getBindingTypes()
+ {
+ return bindingTypes;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -1,425 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.Dependent;
-import javax.webbeans.DeploymentType;
-import javax.webbeans.Destroys;
-import javax.webbeans.Named;
-import javax.webbeans.ScopeType;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.bindings.CurrentBinding;
-import org.jboss.webbeans.bindings.DependentBinding;
-import org.jboss.webbeans.bindings.ProductionBinding;
-import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.LoggerUtil;
-import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
-
-
-
-/**
- * Web Beans Component meta model
- *
- * @author Pete Muir
- *
- */
-public abstract class AbstractComponentModel<T>
-{
-
- public static final String LOGGER_NAME = "componentMetaModel";
-
- private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
-
- private Class<? extends T> type;
- private Set<Annotation> bindingTypes;
- private Annotation deploymentType;
- private Annotation scopeType;
- private MergedStereotypesModel mergedStereotypes;
-
- private String name;
-
- /**
- *
- * @param annotatedItem Annotations read from java classes
- * @param xmlAnnotatedItem Annotations read from XML
- * @param container
- */
- @SuppressWarnings("unchecked")
- public AbstractComponentModel(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
- {
- if (annotatedItem == null)
- {
- throw new NullPointerException("annotatedItem must not be null. If the component is declared just in XML, pass in an empty annotatedItem");
- }
-
- if (xmlAnnotatedItem == null)
- {
- throw new NullPointerException("xmlAnnotatedItem must not be null. If the component is declared just in Java, pass in an empty xmlAnnotatedItem");
- }
-
- this.type = (Class<? extends T>) initType(annotatedItem, xmlAnnotatedItem);
- log.fine("Building Web Bean component metadata for " + type);
- mergedStereotypes = new MergedStereotypesModel(annotatedItem, xmlAnnotatedItem, container);
- this.bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
- this.deploymentType = initDeploymentType(mergedStereotypes, annotatedItem, xmlAnnotatedItem, container);
- this.scopeType = initScopeType(mergedStereotypes, annotatedItem, xmlAnnotatedItem);
- this.name = initName(getMergedStereotypes(), annotatedItem, xmlAnnotatedItem, type);
- checkRequiredTypesImplemented(getMergedStereotypes(), type);
- checkScopeAllowed(getMergedStereotypes(), getScopeType(), type);
- checkComponentImplementation(type);
- // TODO Interceptors
- }
-
- public AbstractComponentModel()
- {
- // TODO Auto-generated constructor stub
- }
-
- @SuppressWarnings("unchecked")
- protected static Class<?> initType(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
- {
- if (annotatedItem.getAnnotatedClass() != null && xmlAnnotatedItem.getAnnotatedClass() != null && !annotatedItem.getAnnotatedClass().equals(xmlAnnotatedItem.getAnnotatedClass()))
- {
- throw new IllegalArgumentException("Cannot build a component which specifies different classes in XML and Java");
- }
- else if (xmlAnnotatedItem.getAnnotatedClass() != null)
- {
- log.finest("Component type specified in XML");
- return xmlAnnotatedItem.getAnnotatedClass();
- }
- else if (annotatedItem.getAnnotatedClass() != null)
- {
- log.finest("Component type specified in Java");
- return annotatedItem.getAnnotatedClass();
- }
- else
- {
- throw new IllegalArgumentException("Cannot build a component which doesn't specify a type");
- }
- }
-
- protected static Set<Annotation> initBindingTypes(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
- {
- Set<Annotation> xmlBindingTypes = xmlAnnotatedItem.getAnnotations(BindingType.class);
- if (xmlBindingTypes.size() > 0)
- {
- // TODO support producer expression default binding type
- log.finest("Using binding types " + xmlBindingTypes + " specified in XML");
- return xmlBindingTypes;
- }
-
- Set<Annotation> bindingTypes = annotatedItem.getAnnotations(BindingType.class);
-
- if (bindingTypes.size() == 0)
- {
- log.finest("Adding default @Current binding type");
- bindingTypes.add(new CurrentBinding());
- }
- else
- {
- log.finest("Using binding types " + bindingTypes + " specified by annotations");
- }
- return bindingTypes;
- }
-
- protected static Annotation initDeploymentType(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
- {
- Set<Annotation> xmlDeploymentTypes = xmlAnnotatedItem.getAnnotations(DeploymentType.class);
-
- if (xmlDeploymentTypes.size() > 1)
- {
- throw new RuntimeException("At most one deployment type may be specified (" + xmlDeploymentTypes + " are specified)");
- }
-
- if (xmlDeploymentTypes.size() == 1)
- {
- Annotation deploymentType = xmlDeploymentTypes.iterator().next();
- log.finest("Deployment type " + deploymentType + " specified in XML");
- return deploymentType;
- }
-
- if (xmlAnnotatedItem.getAnnotatedClass() == null)
- {
-
- Set<Annotation> deploymentTypes = annotatedItem.getAnnotations(DeploymentType.class);
-
- if (deploymentTypes.size() > 1)
- {
- throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + annotatedItem.getAnnotatedClass());
- }
- if (deploymentTypes.size() == 1)
- {
- Annotation deploymentType = deploymentTypes.iterator().next();
- log.finest("Deployment type " + deploymentType + " specified by annotation");
- return deploymentType;
- }
- }
-
- if (stereotypes.getPossibleDeploymentTypes().size() > 0)
- {
- Annotation deploymentType = getDeploymentType(container.getEnabledDeploymentTypes(), stereotypes.getPossibleDeploymentTypes());
- log.finest("Deployment type " + deploymentType + " specified by stereotype");
- return deploymentType;
- }
-
- if (xmlAnnotatedItem.getAnnotatedClass() != null)
- {
- log.finest("Using default @Production deployment type");
- return new ProductionBinding();
- }
- throw new RuntimeException("All Java annotated classes have a deployment type");
- }
-
- /**
- * Return the scope of the component
- */
- protected static Annotation initScopeType(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
- {
- Set<Annotation> xmlScopes = xmlAnnotatedItem.getAnnotations(ScopeType.class);
- if (xmlScopes.size() > 1)
- {
- throw new RuntimeException("At most one scope may be specified in XML");
- }
-
- if (xmlScopes.size() == 1)
- {
- Annotation scope = xmlScopes.iterator().next();
- log.finest("Scope " + scope + " specified in XML");
- return scope;
- }
-
- Set<Annotation> scopes = annotatedItem.getAnnotations(ScopeType.class);
- if (scopes.size() > 1)
- {
- throw new RuntimeException("At most one scope may be specified");
- }
-
- if (scopes.size() == 1)
- {
- Annotation scope = scopes.iterator().next();
- log.finest("Scope " + scope + " specified b annotation");
- return scope;
- }
-
- if (stereotypes.getPossibleScopeTypes().size() == 1)
- {
- Annotation scope = stereotypes.getPossibleScopeTypes().iterator().next();
- log.finest("Scope " + scope + " specified by stereotype");
- return scope;
- }
- else if (stereotypes.getPossibleScopeTypes().size() > 1)
- {
- throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the component");
- }
-
- log.finest("Using default @Dependent scope");
- return new DependentBinding();
- }
-
- public static Annotation getDeploymentType(List<Annotation> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
- {
- for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
- {
- if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i).annotationType())))
- {
- return enabledDeploymentTypes.get(i);
- }
- }
- return null;
- }
-
- protected static String initName(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, Class<?> type)
- {
- boolean componentNameDefaulted = false;
- String name = null;
- if (xmlAnnotatedItem.isAnnotationPresent(Named.class))
- {
- name = xmlAnnotatedItem.getAnnotation(Named.class).value();
- if ("".equals(name))
- {
- log.finest("Using default name (specified in XML)");
- componentNameDefaulted = true;
- }
- else
- {
- log.finest("Using name " + name + " specified in XML");
- }
- }
- else if (annotatedItem.isAnnotationPresent(Named.class))
- {
- name = annotatedItem.getAnnotation(Named.class).value();
- if ("".equals(name))
- {
- log.finest("Using default name (specified by annotations)");
- componentNameDefaulted = true;
- }
- else
- {
- log.finest("Using name " + name + " specified in XML");
- }
- }
- if ("".equals(name) && (componentNameDefaulted || stereotypes.isComponentNameDefaulted()))
- {
- name = Strings.decapitalize(type.getSimpleName());
- log.finest("Default name of " + type + " is " + name );
- }
- return name;
- }
-
- /**
- * Check that the types required by the stereotypes on the component are implemented
- */
- protected static void checkRequiredTypesImplemented(MergedStereotypesModel stereotypes, Class<?> type)
- {
- for (Class<?> requiredType : stereotypes.getRequiredTypes())
- {
- log.finest("Checking if required type " + requiredType + " is implemented");
- if (!requiredType.isAssignableFrom(type))
- {
- throw new RuntimeException("Required type " + requiredType + " isn't implemented on " + type);
- }
- }
- }
-
- /**
- * Check that the scope type is allowed by the stereotypes on the component and the component type
- * @param type
- */
- protected static void checkScopeAllowed(MergedStereotypesModel stereotypes, Annotation scopeType, Class<?> type)
- {
- log.finest("Checking if " + scopeType + " is allowed for " + type);
- if (stereotypes.getSupportedScopes().size() > 0)
- {
- if (!stereotypes.getSupportedScopes().contains(scopeType.annotationType()))
- {
- throw new RuntimeException("Scope " + scopeType + " is not an allowed by the stereotype for " + type);
- }
- }
- if (isDeclaredFinal(type) && !scopeType.annotationType().equals(Dependent.class))
- {
- throw new RuntimeException("Scope " + scopeType + " is not allowed as the class is declared final or has methods declared final for " + type + ". Only @Dependent is allowed for final components");
- }
- }
-
- protected static boolean isDeclaredFinal(Class<?> type)
- {
- if (Reflections.isFinal(type))
- {
- return true;
- }
- for (Method method : type.getDeclaredMethods())
- {
- if (Reflections.isFinal(method))
- {
- return true;
- }
- }
- return false;
- }
-
- protected static <T> InjectableMethod<?> initRemoveMethod(EjbMetaData<T> ejbMetaData, Class<? extends T> type)
- {
- if (ejbMetaData.isStateful())
- {
- if (ejbMetaData.getRemoveMethods().size() == 1)
- {
- return new InjectableMethod<Object>(ejbMetaData.getRemoveMethods().get(0));
- }
- else if (ejbMetaData.getRemoveMethods().size() > 1)
- {
- List<Method> possibleRemoveMethods = new ArrayList<Method>();
- for (Method removeMethod : ejbMetaData.getRemoveMethods())
- {
- if (removeMethod.isAnnotationPresent(Destroys.class))
- {
- possibleRemoveMethods.add(removeMethod);
- }
- }
- if (possibleRemoveMethods.size() == 1)
- {
- return new InjectableMethod<Object>(possibleRemoveMethods.get(0));
- }
- else if (possibleRemoveMethods.size() > 1)
- {
- throw new RuntimeException("Multiple remove methods are annotated @Destroys for " + type);
- }
- else if (possibleRemoveMethods.size() == 0)
- {
- throw new RuntimeException("Multiple remove methods are declared, and none are annotated @Destroys for " + type);
- }
- }
- else if (ejbMetaData.getRemoveMethods().size() == 0)
- {
- throw new RuntimeException("Stateful enterprise bean component has no remove methods declared for " + type);
- }
- }
- else
- {
- List<Method> destroysMethods = Reflections.getMethods(type, Destroys.class);
- if (destroysMethods.size() > 0)
- {
- throw new RuntimeException("Only stateful enterprise bean components can have methods annotated @Destroys; " + type + " is not a stateful enterprise bean component");
- }
- }
- return null;
- }
-
- protected static void checkComponentImplementation(Class<?> type)
- {
- if (Reflections.isAbstract(type))
- {
- throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
- }
- }
-
- public Set<Annotation> getBindingTypes()
- {
- return bindingTypes;
- }
-
- public Annotation getDeploymentType()
- {
- return deploymentType;
- }
-
- public String getName()
- {
- return name;
- }
-
- public Annotation getScopeType()
- {
- return scopeType;
- }
-
- protected Class<? extends T> getType()
- {
- return type;
- }
-
- protected MergedStereotypesModel getMergedStereotypes()
- {
- return mergedStereotypes;
- }
-
- public abstract ComponentConstructor<T> getConstructor();
-
- @Override
- public String toString()
- {
- return "SimpleComponentModel[" + type.getName() + "]";
- }
-
-}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,57 @@
+package org.jboss.webbeans.model;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.webbeans.BindingType;
+
+import org.jboss.webbeans.bindings.CurrentBinding;
+import org.jboss.webbeans.injectable.ComponentConstructor;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.util.LoggerUtil;
+
+public abstract class AbstractComponentModel<T>
+{
+
+ public static final String LOGGER_NAME = "componentModel";
+
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ protected static Set<Annotation> initBindingTypes(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
+ {
+ Set<Annotation> xmlBindingTypes = xmlAnnotatedItem.getAnnotations(BindingType.class);
+ if (xmlBindingTypes.size() > 0)
+ {
+ // TODO support producer expression default binding type
+ log.finest("Using binding types " + xmlBindingTypes + " specified in XML");
+ return xmlBindingTypes;
+ }
+
+ Set<Annotation> bindingTypes = annotatedItem.getAnnotations(BindingType.class);
+
+ if (bindingTypes.size() == 0)
+ {
+ log.finest("Adding default @Current binding type");
+ bindingTypes.add(new CurrentBinding());
+ }
+ else
+ {
+ log.finest("Using binding types " + bindingTypes + " specified by annotations");
+ }
+ return bindingTypes;
+ }
+
+ public abstract Set<Annotation> getBindingTypes();
+
+ public abstract Annotation getScopeType();
+
+ protected abstract Class<? extends T> getType();
+
+ public abstract ComponentConstructor<T> getConstructor();
+
+ public abstract Annotation getDeploymentType();
+
+ public abstract String getName();
+
+}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -10,16 +10,16 @@
import org.jboss.webbeans.injectable.ComponentConstructor;
import org.jboss.webbeans.injectable.EnterpriseConstructor;
import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
-public class EnterpriseComponentModel<T> extends AbstractComponentModel<T>
+public class EnterpriseComponentModel<T> extends AbstractClassComponentModel<T>
{
private EnterpriseConstructor<T> constructor;
private InjectableMethod<?> removeMethod;
- public EnterpriseComponentModel(AnnotatedItem annotatedItem,
- AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
+ public EnterpriseComponentModel(AnnotatedType annotatedItem,
+ AnnotatedType xmlAnnotatedItem, ContainerImpl container)
{
super(annotatedItem, xmlAnnotatedItem, container);
EjbMetaData<T> ejbMetaData = container.getEjbManager().getEjbMetaData(getType());
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -9,42 +9,39 @@
import javax.webbeans.ScopeType;
import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.bindings.DependentBinding;
import org.jboss.webbeans.injectable.ComponentConstructor;
import org.jboss.webbeans.injectable.JMSConstructor;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.SimpleAnnotatedItem;
import org.jboss.webbeans.util.Reflections;
+// TODO Work out what to return on methods we don't support
+
public class JmsComponentModel<T> extends AbstractComponentModel<T>
{
// TODO Work out how to handle xml elements which don't correspond to annotations
+ private String jndiName;
+ private ComponentConstructor<T> constructor;
private Set<Annotation> bindingTypes;
- private Class<? extends T> type;
private Annotation scopeType;
- private String jndiName;
- private ComponentConstructor<T> constructor;
@SuppressWarnings("unchecked")
public JmsComponentModel(AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
{
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
- type = (Class<? extends T>)initType(xmlAnnotatedItem);
+ AnnotatedItem annotatedItem = new SimpleAnnotatedItem(new HashMap<Class<? extends Annotation>, Annotation>());
bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
- scopeType = new DependentBinding();
- checkBindingTypesAllowed(bindingTypes, type);
- checkScopeAllowed(xmlAnnotatedItem, type);
+ //scopeType = new DependentBiding();
+ checkBindingTypesAllowed(bindingTypes, null);
+ checkScopeAllowed(xmlAnnotatedItem, null);
// TODO Initialize queue. topic
this.constructor = new JMSConstructor<T>(jndiName);
}
-
-
@SuppressWarnings("unchecked")
protected static void checkBindingTypesAllowed(Set<Annotation> bindingTypes,
- Class<?> type)
+ String type)
{
if (bindingTypes.size() == 0)
{
@@ -87,7 +84,7 @@
@Override
protected Class<? extends T> getType()
{
- return type;
+ return null;
}
public String getJndiName()
@@ -100,5 +97,17 @@
{
return scopeType;
}
+
+ @Override
+ public Annotation getDeploymentType()
+ {
+ return null;
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -9,7 +9,7 @@
import javax.webbeans.Stereotype;
import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
/**
* Meta model for the merged stereotype for a component
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,72 @@
+package org.jboss.webbeans.model;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
+import java.util.Set;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.injectable.ComponentConstructor;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class ProducerMethodComponentModel<T> extends AbstractComponentModel<T>
+{
+
+ @SuppressWarnings("unchecked")
+ public ProducerMethodComponentModel(AnnotatedMethod annotatedItem, ContainerImpl container)
+ {
+ checkProducerMethod(annotatedItem, container);
+ }
+
+ @Override
+ public ComponentConstructor getConstructor()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public static void checkProducerMethod(AnnotatedMethod annotatedItem, ContainerImpl container)
+ {
+ if (Modifier.isStatic(annotatedItem.getAnnotatedMethod().getModifiers()))
+ {
+ throw new RuntimeException("Producer method cannot be static " + annotatedItem);
+ }
+ // TODO Check if declaring class is a WB component
+
+ }
+
+ @Override
+ public Set<Annotation> getBindingTypes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Annotation getDeploymentType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Annotation getScopeType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Class<? extends T> getType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -11,17 +11,18 @@
import org.jboss.webbeans.injectable.ComponentConstructor;
import org.jboss.webbeans.injectable.EnterpriseConstructor;
import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
-public class RemoteComponentModel<T> extends AbstractComponentModel<T>
+public class RemoteComponentModel<T> extends AbstractClassComponentModel<T>
{
private EnterpriseConstructor<T> constructor;
private InjectableMethod<?> removeMethod;
private String boundTo;
- public RemoteComponentModel(AnnotatedItem annotatedItem,
- AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
+ public RemoteComponentModel(AnnotatedType annotatedItem,
+ AnnotatedType xmlAnnotatedItem, ContainerImpl container)
{
super(annotatedItem, xmlAnnotatedItem, container);
EjbMetaData<T> ejbMetaData = container.getEjbManager().getEjbMetaData(getType());
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -10,11 +10,11 @@
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.injectable.SimpleConstructor;
import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.LoggerUtil;
import org.jboss.webbeans.util.Reflections;
-public class SimpleComponentModel<T> extends AbstractComponentModel<T>
+public class SimpleComponentModel<T> extends AbstractClassComponentModel<T>
{
public static final String LOGGER_NAME = "componentMetaModel";
@@ -31,10 +31,11 @@
* @param container
*/
@SuppressWarnings("unchecked")
- public SimpleComponentModel(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
+ public SimpleComponentModel(AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem, ContainerImpl container)
{
super(annotatedItem, xmlAnnotatedItem, container);
this.constructor = initConstructor(getType());
+ checkType(getType());
// TODO Interceptors
}
@@ -111,6 +112,13 @@
{
return removeMethod;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleComponentModel[" + getType().getName() + "]";
+ }
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -12,7 +12,8 @@
import javax.webbeans.ScopeType;
import javax.webbeans.Stereotype;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
/**
* A meta model for a stereotype, allows us to cache a stereotype and to validate it
@@ -32,7 +33,7 @@
private Set<Annotation> interceptorBindings;
@SuppressWarnings("unchecked")
- public StereotypeModel(AnnotatedItem annotatedClass)
+ public StereotypeModel(AnnotatedType annotatedClass)
{
initStereotypeClass(annotatedClass);
Stereotype stereotype = annotatedClass.getAnnotation(Stereotype.class);
@@ -55,7 +56,7 @@
}
@SuppressWarnings("unchecked")
- private void initStereotypeClass(AnnotatedItem annotatedClass)
+ private void initStereotypeClass(AnnotatedType annotatedClass)
{
if (Annotation.class.isAssignableFrom(annotatedClass.getAnnotatedClass()))
{
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -1,107 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-/**
- * Base class for implementing AnnotatedItem. This implementation assumes
- * the annotationMap is immutable.
- *
- * @author pmuir
- *
- */
-public abstract class AbstractAnnotatedItem implements AnnotatedItem
-{
-
- private Map<Class<? extends Annotation>, Annotation> annotationMap;
- private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations;
- private Set<Annotation> annotationSet;
- private Class<?> annotatedClass;
-
- public AbstractAnnotatedItem(Class<?> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
- {
- this.annotatedClass = annotatedClass;
- if (annotationMap == null)
- {
- throw new NullPointerException("annotationMap cannot be null");
- }
- this.annotationMap = annotationMap;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- return (T) annotationMap.get(annotationType);
- }
-
- public <T extends Annotation> Set<Annotation> getAnnotations(Class<T> metaAnnotationType)
- {
- if (metaAnnotations == null)
- {
- metaAnnotations = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
- }
- populateMetaAnnotationMap(metaAnnotationType, metaAnnotations, annotationMap);
- return metaAnnotations.get(metaAnnotationType);
- }
-
- public Set<Annotation> getAnnotations()
- {
- if (annotationSet == null)
- {
- annotationSet = populateAnnotationSet(new HashSet<Annotation>(), annotationMap);
- }
- return annotationSet;
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
- {
- return annotationMap.containsKey(annotatedType);
- }
-
- public Class<?> getAnnotatedClass()
- {
- return annotatedClass;
- }
-
- protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, Map<Class<? extends Annotation>, Annotation> annotationMap)
- {
- for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
- {
- annotationSet.add(entry.getValue());
- }
- return annotationSet;
- }
-
- protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<Annotation>> populateMetaAnnotationMap(Class<T> metaAnnotationType, Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations, Map<Class<? extends Annotation>, Annotation> annotationMap)
- {
- if (!metaAnnotations.containsKey(metaAnnotationType))
- {
- Set<Annotation> s = new HashSet<Annotation>();
- for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
- {
- if (entry.getValue().annotationType().isAnnotationPresent(metaAnnotationType))
- {
- s.add(entry.getValue());
- }
- }
- metaAnnotations.put(metaAnnotationType, s);
- }
- return metaAnnotations;
- }
-
- protected Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
- {
- return annotationMap;
- }
-
- @Override
- public String toString()
- {
- return annotatedClass + " " + annotationMap.toString();
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -1,51 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-/**
- * AnnotatedItem provides a uniform access to the annotations on an annotated
- * item defined either in Java or XML
- *
- * @author Pete Muir
- *
- */
-public interface AnnotatedItem
-{
-
- /**
- * Get all annotations on the item
- *
- * An empty set is returned if no annotations are present
- */
- public abstract <T extends Annotation> Set<T> getAnnotations();
-
- /**
- * Get all annotations which are annotated with the given meta annotation
- * type
- *
- * If no annotations are present which are annotated with the given meta
- * annotation an empty set is returned
- */
- public abstract <T extends Annotation> Set<Annotation> getAnnotations(
- Class<T> metaAnnotationType);
-
- /**
- * Get an annotation for the annotation type specified.
- *
- * If the annotation isn't present, null is returned
- */
- public <T extends Annotation> T getAnnotation(Class<T> annotationType);
-
- /**
- * Return true if the annotation type specified is present
- */
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
-
- /**
- * Return the class of the annotated item. If this annotatedItem isn't in use
- * then this method should return null
- */
- public Class<?> getAnnotatedClass();
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -1,32 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Implementation of annotatedItem that wraps a simple Java class and reads
- * annotations from there.
- *
- * @author pmuir
- *
- */
-public class ClassAnnotatedItem extends AbstractAnnotatedItem
-{
-
- public ClassAnnotatedItem(Class<?> clazz)
- {
- super(clazz, buildAnnotationMap(clazz));
-
- }
-
- protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(Class<?> clazz)
- {
- Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
- for (Annotation annotation : clazz.getAnnotations())
- {
- annotationMap.put(annotation.annotationType(), annotation);
- }
- return annotationMap;
- }
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -1,70 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Support for a mutable annotated item
- *
- */
-public class MutableAnnotatedItem extends AbstractAnnotatedItem
-{
-
- private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations;
- private Set<Annotation> annotationSet;
-
- public MutableAnnotatedItem(Class<?> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
- {
- super(annotatedClass, annotationMap);
- }
-
- private void setDirty()
- {
- metaAnnotations = null;
- this.annotationSet = null;
- }
-
- public <T extends Annotation> Set<Annotation> getAnnotations(Class<T> metaAnnotationType)
- {
- if (metaAnnotations == null)
- {
- metaAnnotations = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
- }
- populateMetaAnnotationMap(metaAnnotationType, metaAnnotations, getAnnotationMap());
- return metaAnnotations.get(metaAnnotationType);
- }
-
- public Set<Annotation> getAnnotations()
- {
- if (annotationSet == null)
- {
- annotationSet = new HashSet<Annotation>();
- populateAnnotationSet(annotationSet, getAnnotationMap());
- }
- return annotationSet;
- }
-
- /**
- * Add an annotation to the AnnotatedElement
- * @param annotation
- */
- public void add(Annotation annotation)
- {
- setDirty();
- getAnnotationMap().put(annotation.annotationType(), annotation);
- }
-
- public void addAll(Collection<Annotation> annotations)
- {
- for (Annotation annotation : annotations)
- {
- this.getAnnotationMap().put(annotation.annotationType(), annotation);
- }
- setDirty();
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -8,10 +8,11 @@
import javax.webbeans.Production;
import javax.webbeans.Stereotype;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.test.components.Antelope;
import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
import org.junit.Test;
public class ClassAnnotatedItemTest
@@ -20,7 +21,7 @@
@Test
public void testDeclaredAnnotations()
{
- AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+ AnnotatedType annotatedElement = new SimpleAnnotatedType(Order.class);
assert annotatedElement.getAnnotations().size() == 1;
assert annotatedElement.getAnnotation(Production.class) != null;
assert annotatedElement.getAnnotatedClass().equals(Order.class);
@@ -29,7 +30,7 @@
@Test
public void testMetaAnnotations()
{
- AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+ AnnotatedItem annotatedElement = new SimpleAnnotatedType(Order.class);
Set<Annotation> annotations = annotatedElement.getAnnotations(DeploymentType.class);
assert annotations.size() == 1;
Iterator<Annotation> it = annotations.iterator();
@@ -40,10 +41,10 @@
@Test
public void testEmpty()
{
- AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+ AnnotatedItem annotatedElement = new SimpleAnnotatedType(Order.class);
assert annotatedElement.getAnnotation(Stereotype.class) == null;
assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
- AnnotatedItem classWithNoAnnotations = new ClassAnnotatedItem(Antelope.class);
+ AnnotatedItem classWithNoAnnotations = new SimpleAnnotatedType(Antelope.class);
assert classWithNoAnnotations.getAnnotations().size() == 0;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -7,6 +7,8 @@
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.injectable.SimpleConstructor;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.SimpleComponentModel;
import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.components.Chicken;
@@ -18,9 +20,6 @@
import org.jboss.webbeans.test.components.Sheep;
import org.jboss.webbeans.test.components.Turkey;
import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +28,12 @@
private ContainerImpl container;
- private AnnotatedItem emptyAnnotatedItem;
+ private AnnotatedType emptyAnnotatedItem;
@Before
public void before()
{
- emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<? extends Annotation>, Annotation>());
container = new MockContainerImpl(null);
}
@@ -42,7 +41,7 @@
@Test
public void testImplicitConstructor()
{
- SimpleConstructor<Order> constructor = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container).getConstructor();
+ SimpleConstructor<Order> constructor = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container).getConstructor();
assert constructor.getConstructor().getDeclaringClass().equals(Order.class);
assert constructor.getConstructor().getParameterTypes().length == 0;
assert constructor.getParameters().size() == 0;
@@ -51,7 +50,7 @@
@Test
public void testSingleConstructor()
{
- SimpleConstructor<Donkey> constructor = new SimpleComponentModel<Donkey>(new ClassAnnotatedItem(Donkey.class), emptyAnnotatedItem, container).getConstructor();
+ SimpleConstructor<Donkey> constructor = new SimpleComponentModel<Donkey>(new SimpleAnnotatedType(Donkey.class), emptyAnnotatedItem, container).getConstructor();
assert constructor.getConstructor().getDeclaringClass().equals(Donkey.class);
assert constructor.getConstructor().getParameterTypes().length == 1;
assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
@@ -64,7 +63,7 @@
@Test
public void testInitializerAnnotatedConstructor()
{
- SimpleConstructor<Sheep> constructor = new SimpleComponentModel<Sheep>(new ClassAnnotatedItem(Sheep.class), emptyAnnotatedItem, container).getConstructor();
+ SimpleConstructor<Sheep> constructor = new SimpleComponentModel<Sheep>(new SimpleAnnotatedType(Sheep.class), emptyAnnotatedItem, container).getConstructor();
assert constructor.getConstructor().getDeclaringClass().equals(Sheep.class);
assert constructor.getConstructor().getParameterTypes().length == 2;
assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
@@ -81,7 +80,7 @@
@Test
public void testBindingTypeAnnotatedConstructor()
{
- SimpleConstructor<Duck> constructor = new SimpleComponentModel<Duck>(new ClassAnnotatedItem(Duck.class), emptyAnnotatedItem, container).getConstructor();
+ SimpleConstructor<Duck> constructor = new SimpleComponentModel<Duck>(new SimpleAnnotatedType(Duck.class), emptyAnnotatedItem, container).getConstructor();
assert constructor.getConstructor().getDeclaringClass().equals(Duck.class);
assert constructor.getConstructor().getParameterTypes().length == 2;
assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
@@ -101,7 +100,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Chicken>(new ClassAnnotatedItem(Chicken.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Chicken>(new SimpleAnnotatedType(Chicken.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -117,7 +116,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Turkey>(new ClassAnnotatedItem(Turkey.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Turkey>(new SimpleAnnotatedType(Turkey.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -133,7 +132,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Goat>(new ClassAnnotatedItem(Goat.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Goat>(new SimpleAnnotatedType(Goat.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -149,7 +148,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Goose>(new ClassAnnotatedItem(Goose.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Goose>(new SimpleAnnotatedType(Goose.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -8,6 +8,8 @@
import javax.webbeans.Dependent;
import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.EnterpriseComponentModel;
import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.components.Bear;
@@ -21,9 +23,6 @@
import org.jboss.webbeans.test.components.Puma;
import org.jboss.webbeans.test.components.Tiger;
import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
import org.jboss.webbeans.util.Reflections;
import org.junit.Before;
import org.junit.Test;
@@ -33,12 +32,12 @@
private ContainerImpl container;
- private AnnotatedItem emptyAnnotatedItem;
+ private AnnotatedType emptyAnnotatedItem;
@Before
public void before()
{
- emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<? extends Annotation>, Annotation>());
container = new MockContainerImpl(null);
}
@@ -46,7 +45,7 @@
@Test
public void testStateless()
{
- EnterpriseComponentModel<Lion> lion = new EnterpriseComponentModel<Lion>(new ClassAnnotatedItem(Lion.class), emptyAnnotatedItem, container);
+ EnterpriseComponentModel<Lion> lion = new EnterpriseComponentModel<Lion>(new SimpleAnnotatedType(Lion.class), emptyAnnotatedItem, container);
assert lion.getScopeType().annotationType().equals(Dependent.class);
Reflections.annotationSetMatches(lion.getBindingTypes(), Current.class);
assert lion.getName().equals("lion");
@@ -57,9 +56,9 @@
public void testStatelessDefinedInXml()
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Giraffe.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Giraffe.class, annotations);
- EnterpriseComponentModel<Giraffe> giraffe = new EnterpriseComponentModel<Giraffe>(new ClassAnnotatedItem(Giraffe.class), annotatedItem, container);
+ EnterpriseComponentModel<Giraffe> giraffe = new EnterpriseComponentModel<Giraffe>(new SimpleAnnotatedType(Giraffe.class), annotatedItem, container);
assert giraffe.getScopeType().annotationType().equals(Dependent.class);
Reflections.annotationSetMatches(giraffe.getBindingTypes(), Current.class);
}
@@ -70,7 +69,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Bear>(new ClassAnnotatedItem(Bear.class), emptyAnnotatedItem, container);
+ new EnterpriseComponentModel<Bear>(new SimpleAnnotatedType(Bear.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -100,7 +99,7 @@
public void testStateful()
{
- EnterpriseComponentModel<Tiger> tiger = new EnterpriseComponentModel<Tiger>(new ClassAnnotatedItem(Tiger.class), emptyAnnotatedItem, container);
+ EnterpriseComponentModel<Tiger> tiger = new EnterpriseComponentModel<Tiger>(new SimpleAnnotatedType(Tiger.class), emptyAnnotatedItem, container);
Reflections.annotationSetMatches(tiger.getBindingTypes(), Synchronous.class);
assert tiger.getRemoveMethod().getMethod().getName().equals("remove");
assert tiger.getName() == null;
@@ -111,7 +110,7 @@
public void testMultipleRemoveMethodsWithDestroys()
{
- EnterpriseComponentModel<Elephant> elephant = new EnterpriseComponentModel<Elephant>(new ClassAnnotatedItem(Elephant.class), emptyAnnotatedItem, container);
+ EnterpriseComponentModel<Elephant> elephant = new EnterpriseComponentModel<Elephant>(new SimpleAnnotatedType(Elephant.class), emptyAnnotatedItem, container);
assert elephant.getRemoveMethod().getMethod().getName().equals("remove2");
}
@@ -122,7 +121,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Puma>(new ClassAnnotatedItem(Puma.class), emptyAnnotatedItem, container);
+ new EnterpriseComponentModel<Puma>(new SimpleAnnotatedType(Puma.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -138,7 +137,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Cougar>(new ClassAnnotatedItem(Cougar.class), emptyAnnotatedItem, container);
+ new EnterpriseComponentModel<Cougar>(new SimpleAnnotatedType(Cougar.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -154,7 +153,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Cheetah>(new ClassAnnotatedItem(Cheetah.class), emptyAnnotatedItem, container);
+ new EnterpriseComponentModel<Cheetah>(new SimpleAnnotatedType(Cheetah.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -167,7 +166,7 @@
public void testRemoveMethodWithDefaultBinding()
{
- EnterpriseComponentModel<Panther> panther = new EnterpriseComponentModel<Panther>(new ClassAnnotatedItem(Panther.class), emptyAnnotatedItem, container);
+ EnterpriseComponentModel<Panther> panther = new EnterpriseComponentModel<Panther>(new SimpleAnnotatedType(Panther.class), emptyAnnotatedItem, container);
assert panther.getRemoveMethod().getMethod().getName().equals("remove");
assert panther.getRemoveMethod().getParameters().size() == 1;
@@ -180,7 +179,7 @@
@Test
public void testMessageDriven()
{
- EnterpriseComponentModel<Leopard> leopard = new EnterpriseComponentModel<Leopard>(new ClassAnnotatedItem(Leopard.class), emptyAnnotatedItem, container);
+ EnterpriseComponentModel<Leopard> leopard = new EnterpriseComponentModel<Leopard>(new SimpleAnnotatedType(Leopard.class), emptyAnnotatedItem, container);
Reflections.annotationSetMatches(leopard.getBindingTypes(), Current.class);
}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -1,40 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.Current;
-
-import org.jboss.webbeans.bindings.CurrentBinding;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
-import org.junit.Test;
-
-public class MutableAnnotatedItemTest
-{
-
- @Test
- public void testMutability()
- {
- MutableAnnotatedItem annotatedElement = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
- assert annotatedElement.getAnnotations().size() == 0;
- annotatedElement.add(new CurrentBinding());
- assert annotatedElement.getAnnotations().size() == 1;
- assert annotatedElement.getAnnotation(Current.class) != null;
- }
-
- @Test
- public void testMutableMetaAnnotations()
- {
- MutableAnnotatedItem annotatedElement = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
- annotatedElement.add(new CurrentBinding());
- Set<Annotation> annotations = annotatedElement.getAnnotations(BindingType.class);
- assert annotations.size() == 1;
- Iterator<Annotation> it = annotations.iterator();
- Annotation production = it.next();
- assert Current.class.equals(production.annotationType());
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -22,6 +22,8 @@
import org.jboss.webbeans.bindings.NamedBinding;
import org.jboss.webbeans.bindings.RequestScopedBinding;
import org.jboss.webbeans.bindings.StandardBinding;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.SimpleComponentModel;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
@@ -60,9 +62,6 @@
import org.jboss.webbeans.test.components.broken.ComponentWithTooManyDeploymentTypes;
import org.jboss.webbeans.test.components.broken.OuterComponent.InnerComponent;
import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
import org.jboss.webbeans.util.Reflections;
import org.junit.Before;
import org.junit.Test;
@@ -72,12 +71,12 @@
private ContainerImpl container;
- private AnnotatedItem emptyAnnotatedItem;
+ private AnnotatedType emptyAnnotatedItem;
@Before
public void before()
{
- emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<? extends Annotation>, Annotation>());
List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
enabledDeploymentTypes.add(new StandardBinding());
@@ -90,12 +89,12 @@
private void initStereotypes(ContainerImpl container)
{
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(AnimalStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(HornedMammalStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(MammalStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(FishStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RiverFishStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RequestScopedAnimalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(AnimalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(HornedMammalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(MammalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(FishStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(RiverFishStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(RequestScopedAnimalStereotype.class)));
}
// **** TESTS FOR DEPLOYMENT TYPE **** //
@@ -106,7 +105,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType(ComponentWithTooManyDeploymentTypes.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -120,16 +119,16 @@
{
Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeBinding());
- AnnotatedItem xmlDefinedDeploymentTypeAnnotatedItem = new MutableAnnotatedItem(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
+ AnnotatedType xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedType(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
- SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, container);
+ SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, container);
assert component.getDeploymentType().annotationType().equals(AnotherDeploymentType.class);
}
@Test
public void testXmlDefaultDeploymentType()
{
- AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
assert antelope.getDeploymentType().annotationType().equals(Production.class);
}
@@ -137,8 +136,8 @@
@Test
public void testXmlIgnoresJavaDeploymentType()
{
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
- SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new ClassAnnotatedItem(Tuna.class), annotatedItem, container);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new SimpleAnnotatedType(Tuna.class), annotatedItem, container);
assert tuna.getDeploymentType().annotationType().equals(Production.class);
}
@@ -147,9 +146,9 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Moose.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Moose.class, annotations);
- SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), annotatedItem, container);
+ SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType(Moose.class), annotatedItem, container);
assert moose.getDeploymentType().annotationType().equals(HornedAnimalDeploymentType.class);
}
@@ -162,9 +161,9 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Cat.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Cat.class, annotations);
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), annotatedItem, container);
+ SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), annotatedItem, container);
assert cat.getBindingTypes().size() == 1;
assert Reflections.annotationSetMatches(cat.getBindingTypes(), Asynchronous.class);
}
@@ -173,7 +172,7 @@
@Test
public void testBindingTypesDeclaredInJava()
{
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), emptyAnnotatedItem, container);
assert cat.getBindingTypes().size() == 1;
assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
}
@@ -184,7 +183,7 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Antelope.class, annotations);
SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, annotatedItem, container);
assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
@@ -194,7 +193,7 @@
@Test
public void testDefaultBindingType()
{
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
assert order.getBindingTypes().size() == 1;
order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -204,7 +203,7 @@
@Test
public void testScopeDeclaredInJava()
{
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), emptyAnnotatedItem, container);
assert trout.getScopeType().annotationType().equals(RequestScoped.class);
}
@@ -213,9 +212,9 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(RequestScoped.class, new RequestScopedBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Order.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Order.class, annotations);
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), annotatedItem, container);
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), annotatedItem, container);
assert order.getScopeType().annotationType().equals(RequestScoped.class);
}
@@ -224,8 +223,8 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(ConversationScoped.class, new ConversationScopedBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
}
@@ -233,16 +232,16 @@
public void testScopeMissingInXml()
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
assert trout.getScopeType().annotationType().equals(RequestScoped.class);
}
@Test
public void testNoScopeSpecified()
{
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
assert order.getScopeType().annotationType().equals(Dependent.class);
}
@@ -252,7 +251,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new ClassAnnotatedItem(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new SimpleAnnotatedType(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -270,7 +269,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(RequestScoped.class, new RequestScopedBinding());
annotations.put(ConversationScoped.class, new ConversationScopedBinding());
- AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
+ AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class, annotations);
new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
}
catch (Exception e)
@@ -285,8 +284,8 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
assert trout.getScopeType().annotationType().equals(RequestScoped.class);
}
@@ -296,12 +295,12 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeBinding());
annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
boolean exception = false;
try
{
- new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
+ new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), annotatedItem, container);
}
catch (Exception e)
{
@@ -316,9 +315,9 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeBinding());
annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
assert trout.getScopeType().annotationType().equals(RequestScoped.class);
}
@@ -328,9 +327,9 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeBinding());
annotations.put(RiverFishStereotype.class, new RiverFishStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
- SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
+ SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), annotatedItem, container);
assert haddock.getScopeType().annotationType().equals(ApplicationScoped.class);
}
@@ -339,7 +338,7 @@
@Test
public void testNamed()
{
- SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), emptyAnnotatedItem, container);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
@@ -356,8 +355,8 @@
return "";
}
});
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
assert trout.getName() != null;
assert trout.getName().equals("seaBass");
@@ -375,8 +374,8 @@
return "aTrout";
}
});
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
assert trout.getName().equals("aTrout");
}
@@ -384,14 +383,14 @@
@Test
public void testNotNamed()
{
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), emptyAnnotatedItem, container);
assert trout.getName() == null;
}
@Test
public void testNonDefaultNamed()
{
- SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType(Moose.class), emptyAnnotatedItem, container);
assert moose.getName().equals("aMoose");
}
@@ -412,9 +411,9 @@
return "currentSynchronousOrder";
}
});
- AnnotatedItem currentSynchronousOrderAnnotatedItem = new MutableAnnotatedItem(Order.class, orderXmlAnnotations);
+ AnnotatedType currentSynchronousOrderAnnotatedItem = new SimpleAnnotatedType(Order.class, orderXmlAnnotations);
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), currentSynchronousOrderAnnotatedItem, container);
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), currentSynchronousOrderAnnotatedItem, container);
assert Production.class.equals(order.getDeploymentType().annotationType());
assert "currentSynchronousOrder".equals(order.getName());
assert order.getBindingTypes().size() == 2;
@@ -425,7 +424,7 @@
@Test
public void testSingleStereotype()
{
- SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
+ SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType(Gorilla.class), emptyAnnotatedItem, container);
assert gorilla.getName() == null;
assert gorilla.getDeploymentType().annotationType().equals(Production.class);
assert gorilla.getBindingTypes().iterator().next().annotationType().equals(Current.class);
@@ -437,7 +436,7 @@
{
try
{
- new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType(Gorilla.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -452,7 +451,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Chair>(new ClassAnnotatedItem(Chair.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Chair>(new SimpleAnnotatedType(Chair.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -467,7 +466,7 @@
{
try
{
- new SimpleComponentModel<Goldfish>(new ClassAnnotatedItem(Goldfish.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Goldfish>(new SimpleAnnotatedType(Goldfish.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -483,7 +482,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Carp>(new ClassAnnotatedItem(Carp.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Carp>(new SimpleAnnotatedType(Carp.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -501,7 +500,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Cow>(new ClassAnnotatedItem(Cow.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Cow>(new SimpleAnnotatedType(Cow.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -516,7 +515,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Cow>(new ClassAnnotatedItem(InnerComponent.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<InnerComponent>(new SimpleAnnotatedType(InnerComponent.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -531,7 +530,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Horse>(new SimpleAnnotatedType(Horse.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -541,10 +540,10 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Dependent.class, new DependentBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Horse.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Horse.class, annotations);
try
{
- new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), annotatedItem, container);
+ new SimpleComponentModel<Horse>(new SimpleAnnotatedType(Horse.class), annotatedItem, container);
}
catch (Exception e)
{
@@ -558,7 +557,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), emptyAnnotatedItem, container);
+ new SimpleComponentModel<Pig>(new SimpleAnnotatedType(Pig.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -568,10 +567,10 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Dependent.class, new DependentBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Pig.class, annotations);
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Pig.class, annotations);
try
{
- new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), annotatedItem, container);
+ new SimpleComponentModel<Pig>(new SimpleAnnotatedType(Pig.class), annotatedItem, container);
}
catch (Exception e)
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-08-11 16:32:44 UTC (rev 95)
@@ -7,6 +7,7 @@
import javax.webbeans.Production;
import javax.webbeans.RequestScoped;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
@@ -17,7 +18,6 @@
import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyScopeTypes;
import org.jboss.webbeans.test.components.Animal;
import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
import org.junit.Test;
public class StereotypeMetaModelTest
@@ -26,7 +26,7 @@
@Test
public void testComponentStereotype()
{
- StereotypeModel componentStereotype = new StereotypeModel(new ClassAnnotatedItem(Component.class));
+ StereotypeModel componentStereotype = new StereotypeModel(new SimpleAnnotatedType(Component.class));
assert Production.class.equals(componentStereotype.getDefaultDeploymentType().annotationType());
assert componentStereotype.getDefaultScopeType() == null;
@@ -39,7 +39,7 @@
@Test
public void testModelStereotype()
{
- StereotypeModel modelStereotype = new StereotypeModel(new ClassAnnotatedItem(Model.class));
+ StereotypeModel modelStereotype = new StereotypeModel(new SimpleAnnotatedType(Model.class));
assert Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
assert RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
assert modelStereotype.isComponentNameDefaulted();
@@ -51,7 +51,7 @@
@Test
public void testAnimalStereotype()
{
- StereotypeModel animalStereotype = new StereotypeModel(new ClassAnnotatedItem(AnimalStereotype.class));
+ StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(AnimalStereotype.class));
assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
assert animalStereotype.getInterceptorBindings().size() == 0;
assert animalStereotype.getRequiredTypes().size() == 1;
@@ -64,7 +64,7 @@
@Test
public void testAnimalOrderStereotype()
{
- StereotypeModel animalStereotype = new StereotypeModel(new ClassAnnotatedItem(AnimalOrderStereotype.class));
+ StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(AnimalOrderStereotype.class));
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
assert animalStereotype.getRequiredTypes().size() == 2;
@@ -78,7 +78,7 @@
@Test
public void testRequestScopedAnimalStereotype()
{
- StereotypeModel animalStereotype = new StereotypeModel(new ClassAnnotatedItem(RequestScopedAnimalStereotype.class));
+ StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(RequestScopedAnimalStereotype.class));
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
assert animalStereotype.getRequiredTypes().size() == 1;
@@ -95,7 +95,7 @@
boolean exception = false;
try
{
- new StereotypeModel(new ClassAnnotatedItem(StereotypeWithTooManyScopeTypes.class));
+ new StereotypeModel(new SimpleAnnotatedType(StereotypeWithTooManyScopeTypes.class));
}
catch (Exception e)
{
@@ -110,7 +110,7 @@
boolean exception = false;
try
{
- new StereotypeModel(new ClassAnnotatedItem(StereotypeWithTooManyDeploymentTypes.class));
+ new StereotypeModel(new SimpleAnnotatedType(StereotypeWithTooManyDeploymentTypes.class));
}
catch (Exception e)
{
@@ -125,7 +125,7 @@
boolean exception = false;
try
{
- new StereotypeModel(new ClassAnnotatedItem(StereotypeWithNonEmptyNamed.class));
+ new StereotypeModel(new SimpleAnnotatedType(StereotypeWithNonEmptyNamed.class));
}
catch (Exception e)
{
@@ -140,7 +140,7 @@
boolean exception = false;
try
{
- new StereotypeModel(new ClassAnnotatedItem(StereotypeWithBindingTypes.class));
+ new StereotypeModel(new SimpleAnnotatedType(StereotypeWithBindingTypes.class));
}
catch (Exception e)
{
16 years, 4 months
[webbeans-commits] Webbeans SVN: r94 - in ri/trunk/webbeans-ri/src: test/java/org/jboss/webbeans/test and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:36:43 -0400 (Sun, 10 Aug 2008)
New Revision: 94
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/OuterComponent.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java
Log:
WBRI-22
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java 2008-08-10 15:36:24 UTC (rev 93)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java 2008-08-10 15:36:43 UTC (rev 94)
@@ -38,6 +38,14 @@
// TODO Interceptors
}
+ public static void checkType(Class<?> type)
+ {
+ if (type.isMemberClass())
+ {
+ throw new RuntimeException("Simple Web Bean " + type + " cannot be an inner class");
+ }
+ }
+
@SuppressWarnings("unchecked")
protected static <T> SimpleConstructor<T> initConstructor(Class<? extends T> type)
{
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java 2008-08-10 15:36:24 UTC (rev 93)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java 2008-08-10 15:36:43 UTC (rev 94)
@@ -1,566 +0,0 @@
-package org.jboss.webbeans.test;
-
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.ConversationScoped;
-import javax.webbeans.Current;
-import javax.webbeans.Dependent;
-import javax.webbeans.Named;
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.bindings.ConversationScopedBinding;
-import org.jboss.webbeans.bindings.CurrentBinding;
-import org.jboss.webbeans.bindings.DependentBinding;
-import org.jboss.webbeans.bindings.NamedBinding;
-import org.jboss.webbeans.bindings.RequestScopedBinding;
-import org.jboss.webbeans.bindings.StandardBinding;
-import org.jboss.webbeans.model.SimpleComponentModel;
-import org.jboss.webbeans.model.StereotypeModel;
-import org.jboss.webbeans.test.annotations.AnimalStereotype;
-import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
-import org.jboss.webbeans.test.annotations.Asynchronous;
-import org.jboss.webbeans.test.annotations.FishStereotype;
-import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
-import org.jboss.webbeans.test.annotations.HornedMammalStereotype;
-import org.jboss.webbeans.test.annotations.MammalStereotype;
-import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.test.annotations.RiverFishStereotype;
-import org.jboss.webbeans.test.annotations.Synchronous;
-import org.jboss.webbeans.test.bindings.AnimalStereotypeBinding;
-import org.jboss.webbeans.test.bindings.AnotherDeploymentTypeBinding;
-import org.jboss.webbeans.test.bindings.AsynchronousBinding;
-import org.jboss.webbeans.test.bindings.FishStereotypeBinding;
-import org.jboss.webbeans.test.bindings.HornedAnimalDeploymentTypeBinding;
-import org.jboss.webbeans.test.bindings.HornedMamalStereotypeBinding;
-import org.jboss.webbeans.test.bindings.RiverFishStereotypeBinding;
-import org.jboss.webbeans.test.bindings.SynchronousBinding;
-import org.jboss.webbeans.test.components.Antelope;
-import org.jboss.webbeans.test.components.Carp;
-import org.jboss.webbeans.test.components.Cat;
-import org.jboss.webbeans.test.components.Chair;
-import org.jboss.webbeans.test.components.ComponentWithTooManyScopeTypes;
-import org.jboss.webbeans.test.components.Cow;
-import org.jboss.webbeans.test.components.Goldfish;
-import org.jboss.webbeans.test.components.Gorilla;
-import org.jboss.webbeans.test.components.Haddock;
-import org.jboss.webbeans.test.components.Horse;
-import org.jboss.webbeans.test.components.Moose;
-import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.test.components.Pig;
-import org.jboss.webbeans.test.components.SeaBass;
-import org.jboss.webbeans.test.components.Tuna;
-import org.jboss.webbeans.test.components.broken.ComponentWithTooManyDeploymentTypes;
-import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
-import org.jboss.webbeans.util.Reflections;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ComponentMetaModelTest
-{
-
- private ContainerImpl container;
-
- private AnnotatedItem emptyAnnotatedItem;
-
- @Before
- public void before()
- {
- emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
-
- List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
- enabledDeploymentTypes.add(new StandardBinding());
- enabledDeploymentTypes.add(new AnotherDeploymentTypeBinding());
- enabledDeploymentTypes.add(new HornedAnimalDeploymentTypeBinding());
- container = new MockContainerImpl(enabledDeploymentTypes);
-
- initStereotypes(container);
- }
-
- private void initStereotypes(ContainerImpl container)
- {
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(AnimalStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(HornedMammalStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(MammalStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(FishStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RiverFishStereotype.class)));
- container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RequestScopedAnimalStereotype.class)));
- }
-
- @Test
- public void testTooManyDeploymentTypes()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- // **** TESTS FOR DEPLOYMENT TYPE **** //
-
- @Test
- public void testXmlDeploymentTypeOverridesJava()
- {
- Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeBinding());
- AnnotatedItem xmlDefinedDeploymentTypeAnnotatedItem = new MutableAnnotatedItem(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
-
- SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, container);
- assert component.getDeploymentType().annotationType().equals(AnotherDeploymentType.class);
- }
-
- @Test
- public void testXmlDefaultDeploymentType()
- {
- AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
- SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
- assert antelope.getDeploymentType().annotationType().equals(Production.class);
- }
-
- @Test
- public void testXmlIgnoresJavaDeploymentType()
- {
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
- SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new ClassAnnotatedItem(Tuna.class), annotatedItem, container);
- assert tuna.getDeploymentType().annotationType().equals(Production.class);
- }
-
- @Test
- public void testDeploymentTypePrecedenceSelection()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Moose.class, annotations);
-
- SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), annotatedItem, container);
- assert moose.getDeploymentType().annotationType().equals(HornedAnimalDeploymentType.class);
-
- }
-
- // **** TESTS FOR BINDING TYPE **** //
-
- @SuppressWarnings("unchecked")
- @Test
- public void testXmlBindingTypeOverridesJava()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Cat.class, annotations);
-
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), annotatedItem, container);
- assert cat.getBindingTypes().size() == 1;
- assert Reflections.annotationSetMatches(cat.getBindingTypes(), Asynchronous.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testBindingTypesDeclaredInJava()
- {
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), emptyAnnotatedItem, container);
- assert cat.getBindingTypes().size() == 1;
- assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testBindingTypesDeclaredInXml()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
-
- SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, annotatedItem, container);
- assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDefaultBindingType()
- {
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
- assert order.getBindingTypes().size() == 1;
- order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
- }
-
- // **** TESTS FOR SCOPES **** //
-
- @Test
- public void testScopeDeclaredInJava()
- {
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test
- public void testScopeDeclaredInXml()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(RequestScoped.class, new RequestScopedBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Order.class, annotations);
-
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), annotatedItem, container);
- assert order.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test
- public void testScopeDeclaredInXmlOverridesJava()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(ConversationScoped.class, new ConversationScopedBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
- assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
- }
-
- @Test
- public void testScopeMissingInXml()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
-
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test
- public void testNoScopeSpecified()
- {
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
- assert order.getScopeType().annotationType().equals(Dependent.class);
- }
-
- @Test
- public void testTooManyScopesSpecified()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new ClassAnnotatedItem(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testTooManyScopesSpecifiedInXml()
- {
- boolean exception = false;
- try
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(RequestScoped.class, new RequestScopedBinding());
- annotations.put(ConversationScoped.class, new ConversationScopedBinding());
- AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
- new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testScopeSpecifiedAndStereotyped()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test
- public void testMutipleIncompatibleScopeStereotypes()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
-
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
-
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test
- public void testMutipleCompatibleScopeStereotypes()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- annotations.put(RiverFishStereotype.class, new RiverFishStereotypeBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
-
- SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
- assert haddock.getScopeType().annotationType().equals(ApplicationScoped.class);
- }
-
- // **** TESTS FOR COMPONENT NAME **** /
-
- @Test
- public void testNamed()
- {
- SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), emptyAnnotatedItem, container);
- assert haddock.getName() != null;
- assert haddock.getName().equals("haddock");
- }
-
- @Test
- public void testXmlNamed()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedBinding()
- {
-
- public String value()
- {
- return "";
- }
- });
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
-
- assert trout.getName() != null;
- assert trout.getName().equals("seaBass");
- }
-
- @Test
- public void testNonDefaultXmlNamed()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedBinding()
- {
-
- public String value()
- {
- return "aTrout";
- }
- });
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
-
- assert trout.getName().equals("aTrout");
- }
-
- @Test
- public void testNotNamed()
- {
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
- assert trout.getName() == null;
- }
-
- @Test
- public void testNonDefaultNamed()
- {
- SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), emptyAnnotatedItem, container);
- assert moose.getName().equals("aMoose");
- }
-
-
- // **** TESTS FOR STEREOTYPES **** //
-
- @SuppressWarnings("unchecked")
- @Test
- public void testStereotypeDeclaredInXmlAndJava()
- {
- Map<Class<? extends Annotation>, Annotation> orderXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- orderXmlAnnotations.put(Current.class, new CurrentBinding());
- orderXmlAnnotations.put(Synchronous.class, new SynchronousBinding());
- orderXmlAnnotations.put(Named.class, new NamedBinding()
- {
- public String value()
- {
- return "currentSynchronousOrder";
- }
- });
- AnnotatedItem currentSynchronousOrderAnnotatedItem = new MutableAnnotatedItem(Order.class, orderXmlAnnotations);
-
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), currentSynchronousOrderAnnotatedItem, container);
- assert Production.class.equals(order.getDeploymentType().annotationType());
- assert "currentSynchronousOrder".equals(order.getName());
- assert order.getBindingTypes().size() == 2;
- assert Reflections.annotationSetMatches(order.getBindingTypes(), Current.class, Synchronous.class);
- assert order.getScopeType().annotationType().equals(Dependent.class);
- }
-
- @Test
- public void testSingleStereotype()
- {
- SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
- assert gorilla.getName() == null;
- assert gorilla.getDeploymentType().annotationType().equals(Production.class);
- assert gorilla.getBindingTypes().iterator().next().annotationType().equals(Current.class);
- assert gorilla.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test
- public void testRequiredTypeIsImplemented()
- {
- try
- {
- new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- assert false;
- }
-
- }
-
- @Test
- public void testRequiredTypeIsNotImplemented()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Chair>(new ClassAnnotatedItem(Chair.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- }
-
- @Test
- public void testScopeIsSupported()
- {
- try
- {
- new SimpleComponentModel<Goldfish>(new ClassAnnotatedItem(Goldfish.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- assert false;
- }
-
- }
-
- @Test
- public void testScopeIsNotSupported()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Carp>(new ClassAnnotatedItem(Carp.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- }
-
- //*** COMPONENT CLASS CHECKS ****//
-
- @Test
- public void testAbstractClassIsNotAllowed()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Cow>(new ClassAnnotatedItem(Cow.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testFinalClassMustBeDependentScoped()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Dependent.class, new DependentBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Horse.class, annotations);
- try
- {
- new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), annotatedItem, container);
- }
- catch (Exception e)
- {
- assert false;
- }
- }
-
- @Test
- public void testClassWithFinalMethodMustBeDependentScoped()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Dependent.class, new DependentBinding());
- AnnotatedItem annotatedItem = new MutableAnnotatedItem(Pig.class, annotations);
- try
- {
- new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), annotatedItem, container);
- }
- catch (Exception e)
- {
- assert false;
- }
- }
-
-}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java (from rev 88, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-08-10 15:36:43 UTC (rev 94)
@@ -0,0 +1,582 @@
+package org.jboss.webbeans.test;
+
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.ConversationScoped;
+import javax.webbeans.Current;
+import javax.webbeans.Dependent;
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.bindings.ConversationScopedBinding;
+import org.jboss.webbeans.bindings.CurrentBinding;
+import org.jboss.webbeans.bindings.DependentBinding;
+import org.jboss.webbeans.bindings.NamedBinding;
+import org.jboss.webbeans.bindings.RequestScopedBinding;
+import org.jboss.webbeans.bindings.StandardBinding;
+import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
+import org.jboss.webbeans.test.annotations.Asynchronous;
+import org.jboss.webbeans.test.annotations.FishStereotype;
+import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
+import org.jboss.webbeans.test.annotations.HornedMammalStereotype;
+import org.jboss.webbeans.test.annotations.MammalStereotype;
+import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
+import org.jboss.webbeans.test.annotations.RiverFishStereotype;
+import org.jboss.webbeans.test.annotations.Synchronous;
+import org.jboss.webbeans.test.bindings.AnimalStereotypeBinding;
+import org.jboss.webbeans.test.bindings.AnotherDeploymentTypeBinding;
+import org.jboss.webbeans.test.bindings.AsynchronousBinding;
+import org.jboss.webbeans.test.bindings.FishStereotypeBinding;
+import org.jboss.webbeans.test.bindings.HornedAnimalDeploymentTypeBinding;
+import org.jboss.webbeans.test.bindings.HornedMamalStereotypeBinding;
+import org.jboss.webbeans.test.bindings.RiverFishStereotypeBinding;
+import org.jboss.webbeans.test.bindings.SynchronousBinding;
+import org.jboss.webbeans.test.components.Antelope;
+import org.jboss.webbeans.test.components.Carp;
+import org.jboss.webbeans.test.components.Cat;
+import org.jboss.webbeans.test.components.Chair;
+import org.jboss.webbeans.test.components.ComponentWithTooManyScopeTypes;
+import org.jboss.webbeans.test.components.Cow;
+import org.jboss.webbeans.test.components.Goldfish;
+import org.jboss.webbeans.test.components.Gorilla;
+import org.jboss.webbeans.test.components.Haddock;
+import org.jboss.webbeans.test.components.Horse;
+import org.jboss.webbeans.test.components.Moose;
+import org.jboss.webbeans.test.components.Order;
+import org.jboss.webbeans.test.components.Pig;
+import org.jboss.webbeans.test.components.SeaBass;
+import org.jboss.webbeans.test.components.Tuna;
+import org.jboss.webbeans.test.components.broken.ComponentWithTooManyDeploymentTypes;
+import org.jboss.webbeans.test.components.broken.OuterComponent.InnerComponent;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.util.ClassAnnotatedItem;
+import org.jboss.webbeans.util.MutableAnnotatedItem;
+import org.jboss.webbeans.util.Reflections;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SimpleComponentModelTest
+{
+
+ private ContainerImpl container;
+
+ private AnnotatedItem emptyAnnotatedItem;
+
+ @Before
+ public void before()
+ {
+ emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+
+ List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
+ enabledDeploymentTypes.add(new StandardBinding());
+ enabledDeploymentTypes.add(new AnotherDeploymentTypeBinding());
+ enabledDeploymentTypes.add(new HornedAnimalDeploymentTypeBinding());
+ container = new MockContainerImpl(enabledDeploymentTypes);
+
+ initStereotypes(container);
+ }
+
+ private void initStereotypes(ContainerImpl container)
+ {
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(AnimalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(HornedMammalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(MammalStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(FishStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RiverFishStereotype.class)));
+ container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RequestScopedAnimalStereotype.class)));
+ }
+
+ // **** TESTS FOR DEPLOYMENT TYPE **** //
+
+ @Test
+ public void testTooManyDeploymentTypes()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testXmlDeploymentTypeOverridesJava()
+ {
+ Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeBinding());
+ AnnotatedItem xmlDefinedDeploymentTypeAnnotatedItem = new MutableAnnotatedItem(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
+
+ SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, container);
+ assert component.getDeploymentType().annotationType().equals(AnotherDeploymentType.class);
+ }
+
+ @Test
+ public void testXmlDefaultDeploymentType()
+ {
+ AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
+ assert antelope.getDeploymentType().annotationType().equals(Production.class);
+ }
+
+ @Test
+ public void testXmlIgnoresJavaDeploymentType()
+ {
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new ClassAnnotatedItem(Tuna.class), annotatedItem, container);
+ assert tuna.getDeploymentType().annotationType().equals(Production.class);
+ }
+
+ @Test
+ public void testDeploymentTypePrecedenceSelection()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Moose.class, annotations);
+
+ SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), annotatedItem, container);
+ assert moose.getDeploymentType().annotationType().equals(HornedAnimalDeploymentType.class);
+
+ }
+
+ // **** TESTS FOR BINDING TYPE **** //
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testXmlBindingTypeOverridesJava()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Asynchronous.class, new AsynchronousBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Cat.class, annotations);
+
+ SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), annotatedItem, container);
+ assert cat.getBindingTypes().size() == 1;
+ assert Reflections.annotationSetMatches(cat.getBindingTypes(), Asynchronous.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testBindingTypesDeclaredInJava()
+ {
+ SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), emptyAnnotatedItem, container);
+ assert cat.getBindingTypes().size() == 1;
+ assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testBindingTypesDeclaredInXml()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Asynchronous.class, new AsynchronousBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
+
+ SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, annotatedItem, container);
+ assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDefaultBindingType()
+ {
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
+ assert order.getBindingTypes().size() == 1;
+ order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+ }
+
+ // **** TESTS FOR SCOPES **** //
+
+ @Test
+ public void testScopeDeclaredInJava()
+ {
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testScopeDeclaredInXml()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(RequestScoped.class, new RequestScopedBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Order.class, annotations);
+
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), annotatedItem, container);
+ assert order.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testScopeDeclaredInXmlOverridesJava()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(ConversationScoped.class, new ConversationScopedBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
+ }
+
+ @Test
+ public void testScopeMissingInXml()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testNoScopeSpecified()
+ {
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
+ assert order.getScopeType().annotationType().equals(Dependent.class);
+ }
+
+ @Test
+ public void testTooManyScopesSpecified()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new ClassAnnotatedItem(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testTooManyScopesSpecifiedInXml()
+ {
+ boolean exception = false;
+ try
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(RequestScoped.class, new RequestScopedBinding());
+ annotations.put(ConversationScoped.class, new ConversationScopedBinding());
+ AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
+ new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testScopeSpecifiedAndStereotyped()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testMutipleIncompatibleScopeStereotypes()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
+
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testMutipleCompatibleScopeStereotypes()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ annotations.put(RiverFishStereotype.class, new RiverFishStereotypeBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
+
+ SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
+ assert haddock.getScopeType().annotationType().equals(ApplicationScoped.class);
+ }
+
+ // **** TESTS FOR COMPONENT NAME **** /
+
+ @Test
+ public void testNamed()
+ {
+ SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), emptyAnnotatedItem, container);
+ assert haddock.getName() != null;
+ assert haddock.getName().equals("haddock");
+ }
+
+ @Test
+ public void testXmlNamed()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Named.class, new NamedBinding()
+ {
+
+ public String value()
+ {
+ return "";
+ }
+ });
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+
+ assert trout.getName() != null;
+ assert trout.getName().equals("seaBass");
+ }
+
+ @Test
+ public void testNonDefaultXmlNamed()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Named.class, new NamedBinding()
+ {
+
+ public String value()
+ {
+ return "aTrout";
+ }
+ });
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+
+ assert trout.getName().equals("aTrout");
+ }
+
+ @Test
+ public void testNotNamed()
+ {
+ SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
+ assert trout.getName() == null;
+ }
+
+ @Test
+ public void testNonDefaultNamed()
+ {
+ SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), emptyAnnotatedItem, container);
+ assert moose.getName().equals("aMoose");
+ }
+
+
+ // **** TESTS FOR STEREOTYPES **** //
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testStereotypeDeclaredInXmlAndJava()
+ {
+ Map<Class<? extends Annotation>, Annotation> orderXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ orderXmlAnnotations.put(Current.class, new CurrentBinding());
+ orderXmlAnnotations.put(Synchronous.class, new SynchronousBinding());
+ orderXmlAnnotations.put(Named.class, new NamedBinding()
+ {
+ public String value()
+ {
+ return "currentSynchronousOrder";
+ }
+ });
+ AnnotatedItem currentSynchronousOrderAnnotatedItem = new MutableAnnotatedItem(Order.class, orderXmlAnnotations);
+
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), currentSynchronousOrderAnnotatedItem, container);
+ assert Production.class.equals(order.getDeploymentType().annotationType());
+ assert "currentSynchronousOrder".equals(order.getName());
+ assert order.getBindingTypes().size() == 2;
+ assert Reflections.annotationSetMatches(order.getBindingTypes(), Current.class, Synchronous.class);
+ assert order.getScopeType().annotationType().equals(Dependent.class);
+ }
+
+ @Test
+ public void testSingleStereotype()
+ {
+ SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
+ assert gorilla.getName() == null;
+ assert gorilla.getDeploymentType().annotationType().equals(Production.class);
+ assert gorilla.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+ assert gorilla.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test
+ public void testRequiredTypeIsImplemented()
+ {
+ try
+ {
+ new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ assert false;
+ }
+
+ }
+
+ @Test
+ public void testRequiredTypeIsNotImplemented()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Chair>(new ClassAnnotatedItem(Chair.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ }
+
+ @Test
+ public void testScopeIsSupported()
+ {
+ try
+ {
+ new SimpleComponentModel<Goldfish>(new ClassAnnotatedItem(Goldfish.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ assert false;
+ }
+
+ }
+
+ @Test
+ public void testScopeIsNotSupported()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Carp>(new ClassAnnotatedItem(Carp.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ }
+
+ //*** COMPONENT CLASS CHECKS ****//
+
+ @Test
+ public void testAbstractClassIsNotAllowed()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Cow>(new ClassAnnotatedItem(Cow.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testInnerClassIsNotAllowed()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Cow>(new ClassAnnotatedItem(InnerComponent.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testFinalClassMustBeDependentScoped()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Dependent.class, new DependentBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Horse.class, annotations);
+ try
+ {
+ new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), annotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ assert false;
+ }
+ }
+
+ @Test
+ public void testClassWithFinalMethodMustBeDependentScoped()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Dependent.class, new DependentBinding());
+ AnnotatedItem annotatedItem = new MutableAnnotatedItem(Pig.class, annotations);
+ try
+ {
+ new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), annotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ assert false;
+ }
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/OuterComponent.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/OuterComponent.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/OuterComponent.java 2008-08-10 15:36:43 UTC (rev 94)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.components.broken;
+
+import javax.webbeans.Production;
+
+public class OuterComponent
+{
+
+ @Production
+ public class InnerComponent
+ {
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/OuterComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
[webbeans-commits] Webbeans SVN: r93 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:36:24 -0400 (Sun, 10 Aug 2008)
New Revision: 93
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
Log:
spelling
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-10 15:22:21 UTC (rev 92)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-10 15:36:24 UTC (rev 93)
@@ -288,7 +288,7 @@
log.finest("Checking if required type " + requiredType + " is implemented");
if (!requiredType.isAssignableFrom(type))
{
- throw new RuntimeException("Required type " + requiredType + " isn't implement on " + type);
+ throw new RuntimeException("Required type " + requiredType + " isn't implemented on " + type);
}
}
}
16 years, 4 months
[webbeans-commits] Webbeans SVN: r92 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:22:21 -0400 (Sun, 10 Aug 2008)
New Revision: 92
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletRequestSessionMap.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java
Log:
minor
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2008-08-10 15:12:42 UTC (rev 91)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletLifecycle.java 2008-08-10 15:22:21 UTC (rev 92)
@@ -26,5 +26,6 @@
public static ServletContext getServletContext()
{
return servletContext;
- }
+ }
+
}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletRequestSessionMap.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletRequestSessionMap.java 2008-08-10 15:12:42 UTC (rev 91)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/ServletRequestSessionMap.java 2008-08-10 15:22:21 UTC (rev 92)
@@ -1,115 +0,0 @@
-package org.jboss.webbeans.servlet;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- *
- * @author Shane Bryzak
- *
- */
-public class ServletRequestSessionMap
-{
- private HttpServletRequest request;
-
- public ServletRequestSessionMap(HttpServletRequest request)
- {
- this.request = request;
- }
-
- public void clear()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsKey(Object key)
- {
- HttpSession session = request.getSession(false);
- return session==null ? false : session.getAttribute( (String) key )!=null;
- }
-
- public boolean containsValue(Object value)
- {
- throw new UnsupportedOperationException();
- }
-
- public Set<java.util.Map.Entry<String, Object>> entrySet()
- {
- throw new UnsupportedOperationException();
- }
-
- public Object get(Object key)
- {
- HttpSession session = request.getSession(false);
- return session==null ? null : session.getAttribute( (String) key );
- }
-
- public boolean isEmpty()
- {
- throw new UnsupportedOperationException();
- }
-
- public Set<String> keySet()
- {
- HttpSession session = request.getSession(false);
- if (session==null)
- {
- return Collections.EMPTY_SET;
- }
- else
- {
- Set<String> keys = new HashSet<String>();
- Enumeration<String> names = session.getAttributeNames();
- while ( names.hasMoreElements() )
- {
- keys.add( names.nextElement() );
- }
- return keys;
- }
- }
-
- public Object put(String key, Object value)
- {
- HttpSession session = request.getSession(true);
- Object result = session.getAttribute(key);
- session.setAttribute(key, value);
- return result;
- }
-
- public void putAll(Map<? extends String, ? extends Object> t)
- {
- throw new UnsupportedOperationException();
- }
-
- public Object remove(Object key)
- {
- HttpSession session = request.getSession(false);
- if (session==null)
- {
- return null;
- }
- else
- {
- Object result = session.getAttribute( (String) key );
- session.removeAttribute( (String) key );
- return result;
- }
- }
-
- public int size()
- {
- throw new UnsupportedOperationException();
- }
-
- public Collection<Object> values()
- {
- throw new UnsupportedOperationException();
- }
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java 2008-08-10 15:12:42 UTC (rev 91)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/servlet/WebBeansFilter.java 2008-08-10 15:22:21 UTC (rev 92)
@@ -9,7 +9,6 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.webbeans.Container;
-import javax.webbeans.Context;
import javax.webbeans.RequestScoped;
import org.jboss.webbeans.BasicContext;
16 years, 4 months
[webbeans-commits] Webbeans SVN: r91 - ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:12:42 -0400 (Sun, 10 Aug 2008)
New Revision: 91
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java
Log:
oops
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java 2008-08-10 15:12:21 UTC (rev 90)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java 2008-08-10 15:12:42 UTC (rev 91)
@@ -1,7 +1,6 @@
package org.jboss.webbeans.init;
import javax.servlet.ServletContext;
-import javax.webbeans.Container;
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.deployment.DeploymentStrategy;
16 years, 4 months
[webbeans-commits] Webbeans SVN: r90 - ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:12:21 -0400 (Sun, 10 Aug 2008)
New Revision: 90
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java
Log:
oops
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java 2008-08-10 15:09:58 UTC (rev 89)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java 2008-08-10 15:12:21 UTC (rev 90)
@@ -2,8 +2,6 @@
import java.net.URL;
-import javax.webbeans.Container;
-
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.deployment.DeploymentStrategy;
import org.jboss.webbeans.scannotation.ClasspathUrlFinder;
@@ -16,7 +14,7 @@
public void testDeploymentStrategy()
{
URL[] urls = {ClasspathUrlFinder.findClassBase(DeploymentStrategyTest.class)};
- Container container = new ContainerImpl(null);
+ ContainerImpl container = new ContainerImpl(null);
DeploymentStrategy deploymentStrategy = new DeploymentStrategy(Thread.currentThread().getContextClassLoader(), container);
deploymentStrategy.scan(urls, "org.jboss.webbeans.test.annotations.broken", "org.jboss.webbeans.test.bindings.broken", "org.jboss.webbeans.test.components.broken");
}
16 years, 4 months
[webbeans-commits] Webbeans SVN: r89 - in ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans: init and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:09:58 -0400 (Sun, 10 Aug 2008)
New Revision: 89
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java
Log:
No need to check this, we are in control
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java 2008-08-10 15:02:38 UTC (rev 88)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java 2008-08-10 15:09:58 UTC (rev 89)
@@ -37,16 +37,10 @@
public static String[] DEFAULT_IGNORED_PACKAGES = {"java", "com.sun", "sun", "javasssit"};
- public DeploymentStrategy(ClassLoader classLoader, Container container)
+ public DeploymentStrategy(ClassLoader classLoader, ContainerImpl container)
{
this.classLoader = classLoader;
-
- if (!(container instanceof ContainerImpl))
- {
- throw new IllegalArgumentException("Container must be an instance of ContainerImpl");
- }
-
- this.container = (ContainerImpl) container;
+ this.container = container;
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java 2008-08-10 15:02:38 UTC (rev 88)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/init/Initialization.java 2008-08-10 15:09:58 UTC (rev 89)
@@ -27,7 +27,7 @@
public Initialization create()
{
- Container container = new ContainerImpl(null);
+ ContainerImpl container = new ContainerImpl(null);
servletContext.setAttribute(WEBBEANS_CONTAINER_KEY, container);
16 years, 4 months
[webbeans-commits] Webbeans SVN: r88 - in ri/trunk/webbeans-ri: src/main/java/org/jboss/webbeans and 8 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:02:38 -0400 (Sun, 10 Aug 2008)
New Revision: 88
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/AnnotationDB.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/ClasspathUrlFinder.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/FileIterator.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/InputStreamWrapper.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/IteratorFactory.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/JarIterator.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithBindingTypes.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithNonEmptyNamed.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyDeploymentTypes.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyScopeTypes.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/ComponentWithTooManyDeploymentTypes.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithBindingTypes.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithNonEmptyNamed.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyDeploymentTypes.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyScopeTypes.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/ComponentWithTooManyDeploymentTypes.java
Modified:
ri/trunk/webbeans-ri/pom.xml
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
Log:
Remove scannotation, fix deployment, move purposefully broken stuff into it's own package
Modified: ri/trunk/webbeans-ri/pom.xml
===================================================================
--- ri/trunk/webbeans-ri/pom.xml 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/pom.xml 2008-08-10 15:02:38 UTC (rev 88)
@@ -37,17 +37,10 @@
</dependency>
<dependency>
- <groupId>org.scannotation</groupId>
- <artifactId>scannotation</artifactId>
- </dependency>
-
- <dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
-
-
</dependencies>
</project>
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -1,14 +1,13 @@
package org.jboss.webbeans.deployment;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
+import javassist.bytecode.ClassFile;
+
import javax.webbeans.Container;
import javax.webbeans.DeploymentType;
import javax.webbeans.Stereotype;
@@ -17,12 +16,12 @@
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.model.SimpleComponentModel;
import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.scannotation.AnnotationDB;
+import org.jboss.webbeans.scannotation.ClasspathUrlFinder;
import org.jboss.webbeans.util.ClassAnnotatedItem;
import org.jboss.webbeans.util.LoggerUtil;
import org.jboss.webbeans.util.MutableAnnotatedItem;
import org.jboss.webbeans.util.Reflections;
-import org.scannotation.AnnotationDB;
-import org.scannotation.ClasspathUrlFinder;
/**
* @author Pete Muir
@@ -36,6 +35,8 @@
private ClassLoader classLoader;
private ContainerImpl container;
+ public static String[] DEFAULT_IGNORED_PACKAGES = {"java", "com.sun", "sun", "javasssit"};
+
public DeploymentStrategy(ClassLoader classLoader, Container container)
{
this.classLoader = classLoader;
@@ -47,11 +48,41 @@
this.container = (ContainerImpl) container;
}
+
- public void scan(URL[] urls)
+ public void scan(URL[] urls, final String ... ignoredPackages)
{
- AnnotationDB db = new AnnotationDB();
+ AnnotationDB db = new AnnotationDB()
+ {
+ @Override
+ protected boolean ignoreScan(ClassFile classFile)
+ {
+ for (String ignoredPackage : DEFAULT_IGNORED_PACKAGES)
+ {
+ if (classFile.getName().startsWith(ignoredPackage))
+ {
+ return true;
+ }
+ }
+ for (String ignoredPackage : ignoredPackages)
+ {
+ if (classFile.getName().startsWith(ignoredPackage))
+ {
+ return true;
+ }
+ }
+ if (classFile.getName().startsWith("javax.webbeans"))
+ {
+ return false;
+ }
+ else if (classFile.getName().startsWith("javax"))
+ {
+ return true;
+ }
+ return false;
+ }
+ };
try
{
db.scanArchives(urls);
@@ -70,46 +101,64 @@
private void addStereotypes(Map<String, Set<String>> index)
{
Set<String> stereotypeClassNames = index.get(Stereotype.class.getName());
- try
+ if (stereotypeClassNames != null)
{
- for (String className : stereotypeClassNames)
+ try
{
- log.info("Creating stereotype " + className);
- StereotypeModel stereotypeModel = new StereotypeModel(new ClassAnnotatedItem(Reflections.classForName(className)));
- container.getStereotypeManager().addStereotype(stereotypeModel);
- log.info("Stereotype: " + stereotypeModel);
+ for (String className : stereotypeClassNames)
+ {
+ log.info("Creating stereotype " + className);
+ Class<?> stereotypeClass = Reflections.classForName(className);
+ if (stereotypeClass.isAnnotation())
+ {
+ StereotypeModel stereotypeModel = new StereotypeModel(new ClassAnnotatedItem(stereotypeClass));
+ container.getStereotypeManager().addStereotype(stereotypeModel);
+ log.info("Stereotype: " + stereotypeModel);
+ }
+
+ }
}
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
}
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
}
private void addComponents(Map<String, Set<String>> index)
{
Set<String> annotationNames = index.get(DeploymentType.class.getName());
-
- try
+ if (annotationNames != null)
{
- for (String annotationType : annotationNames)
+ try
{
- Set<String> classNames = index.get(annotationType);
- for (String className : classNames)
+ for (String annotationType : annotationNames)
{
- log.finest("Creating componnt" + className);
- SimpleComponentModel componentModel = new SimpleComponentModel(
- new ClassAnnotatedItem(Reflections.classForName(className)),
- new MutableAnnotatedItem(null, new HashMap()), container);
- container.addComponent(new ComponentInstanceImpl(componentModel));
- log.info("Web Bean: " + componentModel);
+ Set<String> classNames = index.get(annotationType);
+ if (classNames != null)
+ {
+
+ for (String className : classNames)
+ {
+ log.finest("Creating componnt" + className);
+ Class<?> componentClass = Reflections.classForName(className);
+ if (!componentClass.isAnnotation())
+ {
+ SimpleComponentModel componentModel = new SimpleComponentModel(
+ new ClassAnnotatedItem(componentClass),
+ new MutableAnnotatedItem(null, new HashMap()), container);
+ container.addComponent(new ComponentInstanceImpl(componentModel));
+ log.info("Web Bean: " + componentModel);
+ }
+ }
+ }
}
}
+ catch (ClassNotFoundException ex)
+ {
+ throw new RuntimeException(ex);
+ }
}
- catch (ClassNotFoundException ex)
- {
- throw new RuntimeException(ex);
- }
}
public void scan()
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -157,7 +157,7 @@
if (deploymentTypes.size() > 1)
{
- throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified)");
+ throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + annotatedItem.getAnnotatedClass());
}
if (deploymentTypes.size() == 1)
{
@@ -415,5 +415,11 @@
}
public abstract ComponentConstructor<T> getConstructor();
+
+ @Override
+ public String toString()
+ {
+ return "SimpleComponentModel[" + type.getName() + "]";
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -50,7 +50,7 @@
Set<Annotation> bindingTypes = annotatedClass.getAnnotations(BindingType.class);
if (bindingTypes.size() > 0)
{
- throw new RuntimeException("Cannot declare binding types on a stereotpe");
+ throw new RuntimeException("Cannot declare binding types on a stereotype " + annotatedClass);
}
}
@@ -63,7 +63,7 @@
}
else
{
- throw new RuntimeException("@Stereotype can only be applied to an annotation");
+ throw new RuntimeException("@Stereotype can only be applied to an annotation, it was applied to " + annotatedClass);
}
}
@@ -98,7 +98,7 @@
{
if (!"".equals(annotatedElement.getAnnotation(Named.class).value()))
{
- throw new RuntimeException("Cannot specify a value for a @Named stereotype");
+ throw new RuntimeException("Cannot specify a value for a @Named stereotype " + annotatedElement);
}
componentNameDefaulted = true;
}
@@ -109,7 +109,7 @@
Set<Annotation> scopeTypes = annotatedElement.getAnnotations(ScopeType.class);
if (scopeTypes.size() > 1)
{
- throw new RuntimeException("At most one scope type may be specified");
+ throw new RuntimeException("At most one scope type may be specified for " + annotatedElement);
}
else if (scopeTypes.size() == 1)
{
@@ -122,7 +122,7 @@
Set<Annotation> deploymentTypes = annotatedElement.getAnnotations(DeploymentType.class);
if (deploymentTypes.size() > 1)
{
- throw new RuntimeException("At most one deployment type may be specified");
+ throw new RuntimeException("At most one deployment type may be specified on " + annotatedElement);
}
else if (deploymentTypes.size() == 1)
{
@@ -192,7 +192,7 @@
@Override
public String toString()
{
- return "[" + stereotypeClass + "]";
+ return "StereotypeModel[" + stereotypeClass.getName() + "]";
}
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/AnnotationDB.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/AnnotationDB.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/AnnotationDB.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,397 @@
+package org.jboss.webbeans.scannotation;
+
+
+import javassist.bytecode.AnnotationsAttribute;
+import javassist.bytecode.ClassFile;
+import javassist.bytecode.FieldInfo;
+import javassist.bytecode.MethodInfo;
+import javassist.bytecode.ParameterAnnotationsAttribute;
+import javassist.bytecode.annotation.Annotation;
+
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The class allows you to scan an arbitrary set of "archives" for .class files. These class files
+ * are parsed to see what annotations they use. Two indexes are created. The javax, java, sun, com.sun, and javassist
+ * packages will not be scanned by default.
+ * <p/>
+ * One is a map of annotations and what classes
+ * use those annotations. This could be used, for example, by an EJB deployer to find all the EJBs contained
+ * in the archive
+ * <p/>
+ * Another is a mpa of classes and what annotations those classes use.
+ *
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @author Pete Muir
+ * @version $Revision: 1 $
+ */
+public abstract class AnnotationDB implements Serializable
+{
+ protected Map<String, Set<String>> annotationIndex = new HashMap<String, Set<String>>();
+ protected Map<String, Set<String>> implementsIndex = new HashMap<String, Set<String>>();
+ protected Map<String, Set<String>> classIndex = new HashMap<String, Set<String>>();
+
+ protected transient boolean scanClassAnnotations = true;
+ protected transient boolean scanMethodAnnotations = true;
+ protected transient boolean scanParameterAnnotations = true;
+ protected transient boolean scanFieldAnnotations = true;
+
+ public class CrossReferenceException extends Exception
+ {
+ private Set<String> unresolved;
+
+ public CrossReferenceException(Set<String> unresolved)
+ {
+ this.unresolved = unresolved;
+ }
+
+ public Set<String> getUnresolved()
+ {
+ return unresolved;
+ }
+ }
+
+ /**
+ * This method will cross reference annotations in the annotation index with any meta-annotations that they have
+ * and create additional entries as needed. For example:
+ *
+ * @HttpMethod("GET") public @interface GET {}
+ * <p/>
+ * The HttpMethod index will have additional classes added to it for any classes annotated with annotations that
+ * have the HttpMethod meta-annotation.
+ * <p/>
+ * WARNING: If the annotation class has not already been scaned, this method will load all annotation classes indexed
+ * as a resource so they must be in your classpath
+ */
+ public void crossReferenceMetaAnnotations() throws CrossReferenceException
+ {
+ Set<String> unresolved = new HashSet<String>();
+
+ Set<String> index = new HashSet<String>();
+ index.addAll(annotationIndex.keySet());
+
+ for (String annotation : index)
+ {
+ if (classIndex.containsKey(annotation))
+ {
+ for (String xref : classIndex.get(annotation))
+ {
+ annotationIndex.get(xref).addAll(annotationIndex.get(annotation));
+ }
+ continue;
+ }
+ InputStream bits = Thread.currentThread().getContextClassLoader().getResourceAsStream(annotation.replace('.', '/') + ".class");
+ if (bits == null)
+ {
+ unresolved.add(annotation);
+ continue;
+ }
+ boolean scanned = false;
+ try
+ {
+ scanned = scanClass(bits);
+ }
+ catch (IOException e)
+ {
+ unresolved.add(annotation);
+ }
+ if (scanned)
+ {
+ for (String xref : classIndex.get(annotation))
+ {
+ annotationIndex.get(xref).addAll(annotationIndex.get(annotation));
+ }
+ }
+
+ }
+ if (unresolved.size() > 0) throw new CrossReferenceException(unresolved);
+ }
+
+ /**
+ * Sometimes you want to see if a particular class implements an interface with certain annotations
+ * After you have loaded all your classpaths with the scanArchive() method, call this method to cross reference
+ * a class's implemented interfaces. The cross references will be added to the annotationIndex and
+ * classIndex indexes
+ *
+ * @param ignoredPackages var arg list of packages to ignore
+ * @throws CrossReferenceException an Exception thrown if referenced interfaces haven't been scanned
+ */
+ public void crossReferenceImplementedInterfaces() throws CrossReferenceException
+ {
+ Set<String> unresolved = new HashSet<String>();
+ for (String clazz : implementsIndex.keySet())
+ {
+ Set<String> intfs = implementsIndex.get(clazz);
+ for (String intf : intfs)
+ {
+
+ Set<String> xrefAnnotations = classIndex.get(intf);
+ if (xrefAnnotations == null)
+ {
+ unresolved.add(intf);
+ }
+ else
+ {
+ Set<String> classAnnotations = classIndex.get(clazz);
+ if (classAnnotations == null)
+ {
+ classIndex.put(clazz, xrefAnnotations);
+ }
+ else classAnnotations.addAll(xrefAnnotations);
+ for (String annotation : xrefAnnotations)
+ {
+ Set<String> classes = annotationIndex.get(annotation);
+ classes.add(clazz);
+ }
+ }
+ }
+ }
+ if (unresolved.size() > 0) throw new CrossReferenceException(unresolved);
+
+ }
+
+ protected abstract boolean ignoreScan(ClassFile classFile);
+
+ /**
+ * returns a map keyed by the fully qualified string name of a annotation class. The Set returne is
+ * a list of classes that use that annotation somehow.
+ */
+ public Map<String, Set<String>> getAnnotationIndex()
+ {
+ return annotationIndex;
+ }
+
+ /**
+ * returns a map keyed by the list of classes scanned. The value set returned is a list of annotations
+ * used by that class.
+ */
+ public Map<String, Set<String>> getClassIndex()
+ {
+ return classIndex;
+ }
+
+
+ /**
+ * Whether or not you want AnnotationDB to scan for class level annotations
+ *
+ * @param scanClassAnnotations
+ */
+ public void setScanClassAnnotations(boolean scanClassAnnotations)
+ {
+ this.scanClassAnnotations = scanClassAnnotations;
+ }
+
+ /**
+ * Wheter or not you want AnnotationDB to scan for method level annotations
+ *
+ * @param scanMethodAnnotations
+ */
+ public void setScanMethodAnnotations(boolean scanMethodAnnotations)
+ {
+ this.scanMethodAnnotations = scanMethodAnnotations;
+ }
+
+ /**
+ * Whether or not you want AnnotationDB to scan for parameter level annotations
+ *
+ * @param scanParameterAnnotations
+ */
+ public void setScanParameterAnnotations(boolean scanParameterAnnotations)
+ {
+ this.scanParameterAnnotations = scanParameterAnnotations;
+ }
+
+ /**
+ * Whether or not you want AnnotationDB to scan for parameter level annotations
+ *
+ * @param scanFieldAnnotations
+ */
+ public void setScanFieldAnnotations(boolean scanFieldAnnotations)
+ {
+ this.scanFieldAnnotations = scanFieldAnnotations;
+ }
+
+
+ /**
+ * Scan a url that represents an "archive" this is a classpath directory or jar file
+ *
+ * @param urls variable list of URLs to scan as archives
+ * @throws IOException
+ */
+ public void scanArchives(URL... urls) throws IOException
+ {
+ for (URL url : urls)
+ {
+ Iterator<InputStream> it = IteratorFactory.create(url);
+
+ InputStream stream;
+ while ((stream = it.next()) != null) scanClass(stream);
+ }
+
+ }
+
+ /**
+ * Parse a .class file for annotations
+ *
+ * @param bits input stream pointing to .class file bits
+ * @throws IOException
+ */
+ public boolean scanClass(InputStream bits) throws IOException
+ {
+ DataInputStream dstream = new DataInputStream(new BufferedInputStream(bits));
+ ClassFile cf = null;
+ try
+ {
+ cf = new ClassFile(dstream);
+ if (!ignoreScan(cf))
+ {
+ classIndex.put(cf.getName(), new HashSet<String>());
+ if (scanClassAnnotations) ;
+ scanClass(cf);
+ if (scanMethodAnnotations || scanParameterAnnotations) scanMethods(cf);
+ if (scanFieldAnnotations) scanFields(cf);
+
+ // create an index of interfaces the class implements
+ if (cf.getInterfaces() != null)
+ {
+ Set<String> intfs = new HashSet<String>();
+ for (String intf : cf.getInterfaces()) intfs.add(intf);
+ implementsIndex.put(cf.getName(), intfs);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+ finally
+ {
+ dstream.close();
+ bits.close();
+ }
+ }
+
+ protected void scanClass(ClassFile cf)
+ {
+ String className = cf.getName();
+ AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
+ AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
+
+ if (visible != null) populate(visible.getAnnotations(), className);
+ if (invisible != null) populate(invisible.getAnnotations(), className);
+ }
+
+ /**
+ * Scanns both the method and its parameters for annotations.
+ *
+ * @param cf
+ */
+ protected void scanMethods(ClassFile cf)
+ {
+ List methods = cf.getMethods();
+ if (methods == null) return;
+ for (Object obj : methods)
+ {
+ MethodInfo method = (MethodInfo) obj;
+ if (scanMethodAnnotations)
+ {
+ AnnotationsAttribute visible = (AnnotationsAttribute) method.getAttribute(AnnotationsAttribute.visibleTag);
+ AnnotationsAttribute invisible = (AnnotationsAttribute) method.getAttribute(AnnotationsAttribute.invisibleTag);
+
+ if (visible != null) populate(visible.getAnnotations(), cf.getName());
+ if (invisible != null) populate(invisible.getAnnotations(), cf.getName());
+ }
+ if (scanParameterAnnotations)
+ {
+ ParameterAnnotationsAttribute paramsVisible = (ParameterAnnotationsAttribute) method.getAttribute(ParameterAnnotationsAttribute.visibleTag);
+ ParameterAnnotationsAttribute paramsInvisible = (ParameterAnnotationsAttribute) method.getAttribute(ParameterAnnotationsAttribute.invisibleTag);
+
+ if (paramsVisible != null && paramsVisible.getAnnotations() != null)
+ {
+ for (Annotation[] anns : paramsVisible.getAnnotations())
+ {
+ populate(anns, cf.getName());
+ }
+ }
+ if (paramsInvisible != null && paramsInvisible.getAnnotations() != null)
+ {
+ for (Annotation[] anns : paramsInvisible.getAnnotations())
+ {
+ populate(anns, cf.getName());
+ }
+ }
+ }
+ }
+ }
+
+ protected void scanFields(ClassFile cf)
+ {
+ List fields = cf.getFields();
+ if (fields == null) return;
+ for (Object obj : fields)
+ {
+ FieldInfo field = (FieldInfo) obj;
+ AnnotationsAttribute visible = (AnnotationsAttribute) field.getAttribute(AnnotationsAttribute.visibleTag);
+ AnnotationsAttribute invisible = (AnnotationsAttribute) field.getAttribute(AnnotationsAttribute.invisibleTag);
+
+ if (visible != null) populate(visible.getAnnotations(), cf.getName());
+ if (invisible != null) populate(invisible.getAnnotations(), cf.getName());
+ }
+
+
+ }
+
+ protected void populate(Annotation[] annotations, String className)
+ {
+ if (annotations == null) return;
+ Set<String> classAnnotations = classIndex.get(className);
+ for (Annotation ann : annotations)
+ {
+ Set<String> classes = annotationIndex.get(ann.getTypeName());
+ if (classes == null)
+ {
+ classes = new HashSet<String>();
+ annotationIndex.put(ann.getTypeName(), classes);
+ }
+ classes.add(className);
+ classAnnotations.add(ann.getTypeName());
+ }
+ }
+
+ /**
+ * Prints out annotationIndex
+ *
+ * @param writer
+ */
+ public void outputAnnotationIndex(PrintWriter writer)
+ {
+ for (String ann : annotationIndex.keySet())
+ {
+ writer.print(ann);
+ writer.print(": ");
+ Set<String> classes = annotationIndex.get(ann);
+ Iterator<String> it = classes.iterator();
+ while (it.hasNext())
+ {
+ writer.print(it.next());
+ if (it.hasNext()) writer.print(", ");
+ }
+ writer.println();
+ }
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/AnnotationDB.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/ClasspathUrlFinder.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/ClasspathUrlFinder.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/ClasspathUrlFinder.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,190 @@
+package org.jboss.webbeans.scannotation;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * Various functions to locate URLs to scan
+ *
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class ClasspathUrlFinder
+{
+
+ /**
+ * Find the classpath URLs for a specific classpath resource. The classpath URL is extracted
+ * from loader.getResources() using the baseResource.
+ *
+ * @param baseResource
+ * @return
+ */
+ public static URL[] findResourceBases(String baseResource, ClassLoader loader)
+ {
+ ArrayList<URL> list = new ArrayList<URL>();
+ try
+ {
+ Enumeration<URL> urls = loader.getResources(baseResource);
+ while (urls.hasMoreElements())
+ {
+ URL url = urls.nextElement();
+ list.add(findResourceBase(url, baseResource));
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return list.toArray(new URL[list.size()]);
+ }
+
+ /**
+ * Find the classpath URLs for a specific classpath resource. The classpath URL is extracted
+ * from loader.getResources() using the baseResource.
+ *
+ * @param baseResource
+ * @return
+ */
+ public static URL[] findResourceBases(String baseResource)
+ {
+ return findResourceBases(baseResource, Thread.currentThread().getContextClassLoader());
+ }
+
+ private static URL findResourceBase(URL url, String baseResource)
+ {
+ String urlString = url.toString();
+ int idx = urlString.lastIndexOf(baseResource);
+ urlString = urlString.substring(0, idx);
+ URL deployUrl = null;
+ try
+ {
+ deployUrl = new URL(urlString);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return deployUrl;
+ }
+
+ /**
+ * Find the classpath URL for a specific classpath resource. The classpath URL is extracted
+ * from Thread.currentThread().getContextClassLoader().getResource() using the baseResource.
+ *
+ * @param baseResource
+ * @return
+ */
+ public static URL findResourceBase(String baseResource)
+ {
+ return findResourceBase(baseResource, Thread.currentThread().getContextClassLoader());
+ }
+
+ /**
+ * Find the classpath URL for a specific classpath resource. The classpath URL is extracted
+ * from loader.getResource() using the baseResource.
+ *
+ * @param baseResource
+ * @param loader
+ * @return
+ */
+ public static URL findResourceBase(String baseResource, ClassLoader loader)
+ {
+ URL url = loader.getResource(baseResource);
+ return findResourceBase(url, baseResource);
+ }
+
+ /**
+ * Find the classpath for the particular class
+ *
+ * @param clazz
+ * @return
+ */
+ public static URL findClassBase(Class clazz)
+ {
+ String resource = clazz.getName().replace('.', '/') + ".class";
+ return findResourceBase(resource, clazz.getClassLoader());
+ }
+
+ /**
+ * Uses the java.class.path system property to obtain a list of URLs that represent the CLASSPATH
+ *
+ * @return
+ */
+ public static URL[] findClassPaths()
+ {
+ List<URL> list = new ArrayList<URL>();
+ String classpath = System.getProperty("java.class.path");
+ StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
+
+ while (tokenizer.hasMoreTokens())
+ {
+ String path = tokenizer.nextToken();
+ File fp = new File(path);
+ if (!fp.exists()) throw new RuntimeException("File in java.class.path does not exist: " + fp);
+ try
+ {
+ list.add(fp.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return list.toArray(new URL[list.size()]);
+ }
+
+ /**
+ * Uses the java.class.path system property to obtain a list of URLs that represent the CLASSPATH
+ * <p/>
+ * paths is used as a filter to only include paths that have the specific relative file within it
+ *
+ * @param paths comma list of files that should exist in a particular path
+ * @return
+ */
+ public static URL[] findClassPaths(String... paths)
+ {
+ ArrayList<URL> list = new ArrayList<URL>();
+
+ String classpath = System.getProperty("java.class.path");
+ StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
+ for (int i = 0; i < paths.length; i++)
+ {
+ paths[i] = paths[i].trim();
+ }
+
+ while (tokenizer.hasMoreTokens())
+ {
+ String path = tokenizer.nextToken().trim();
+ boolean found = false;
+ for (String wantedPath : paths)
+ {
+ if (path.endsWith(File.separator + wantedPath))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found) continue;
+ File fp = new File(path);
+ if (!fp.exists()) throw new RuntimeException("File in java.class.path does not exists: " + fp);
+ try
+ {
+ list.add(fp.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return list.toArray(new URL[list.size()]);
+ }
+
+
+}
+
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/ClasspathUrlFinder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/FileIterator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/FileIterator.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/FileIterator.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,73 @@
+package org.jboss.webbeans.scannotation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class FileIterator implements Iterator<InputStream>
+{
+ private List<File> files;
+ private int index = 0;
+
+ public FileIterator(File file)
+ {
+ files = new ArrayList<File>();
+ try
+ {
+ create(files, file);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected static void create(List<File> list, File dir) throws Exception
+ {
+ File[] files = dir.listFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory())
+ {
+ create(list, files[i]);
+ }
+ else
+ {
+ list.add(files[i]);
+ }
+ }
+ }
+
+ public InputStream next()
+ {
+ if (index >= files.size()) return null;
+ File fp = (File) files.get(index++);
+ try
+ {
+ return new FileInputStream(fp);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean hasNext()
+ {
+ throw new UnsupportedOperationException("Cannot call hasNext() on FileIterator");
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException("Cannot call remove() on FileIterator");
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/FileIterator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/InputStreamWrapper.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/InputStreamWrapper.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/InputStreamWrapper.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,72 @@
+package org.jboss.webbeans.scannotation;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * Delegate to everything but close(). This object will not close the stream
+ *
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class InputStreamWrapper extends InputStream
+{
+ private InputStream delegate;
+
+ public InputStreamWrapper(InputStream delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public int read()
+ throws IOException
+ {
+ return delegate.read();
+ }
+
+ public int read(byte[] bytes)
+ throws IOException
+ {
+ return delegate.read(bytes);
+ }
+
+ public int read(byte[] bytes, int i, int i1)
+ throws IOException
+ {
+ return delegate.read(bytes, i, i1);
+ }
+
+ public long skip(long l)
+ throws IOException
+ {
+ return delegate.skip(l);
+ }
+
+ public int available()
+ throws IOException
+ {
+ return delegate.available();
+ }
+
+ public void close()
+ throws IOException
+ {
+ // ignored
+ }
+
+ public void mark(int i)
+ {
+ delegate.mark(i);
+ }
+
+ public void reset()
+ throws IOException
+ {
+ delegate.reset();
+ }
+
+ public boolean markSupported()
+ {
+ return delegate.markSupported();
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/InputStreamWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/IteratorFactory.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/IteratorFactory.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/IteratorFactory.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,44 @@
+package org.jboss.webbeans.scannotation;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class IteratorFactory
+{
+
+ public static Iterator<InputStream> create(URL url) throws IOException
+ {
+ String urlString = url.toString();
+ if (urlString.endsWith("!/"))
+ {
+ urlString = urlString.substring(4);
+ urlString = urlString.substring(0, urlString.length() - 2);
+ url = new URL(urlString);
+ }
+
+
+ if (!urlString.endsWith("/"))
+ {
+ return new JarIterator(url.openStream());
+ }
+ else
+ {
+ File f = new File(url.getPath());
+ if (f.isDirectory())
+ {
+ return new FileIterator(f);
+ }
+ else
+ {
+ return new JarIterator(url.openStream());
+ }
+ }
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/IteratorFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/JarIterator.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/JarIterator.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/JarIterator.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,98 @@
+package org.jboss.webbeans.scannotation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+/**
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class JarIterator implements Iterator<InputStream>
+{
+ JarInputStream jar;
+ JarEntry next;
+ boolean initial = true;
+ boolean closed = false;
+
+ public JarIterator(File file) throws IOException
+ {
+ this(new FileInputStream(file));
+ }
+
+
+ public JarIterator(InputStream is) throws IOException
+ {
+ jar = new JarInputStream(is);
+ }
+
+ private void setNext()
+ {
+ initial = true;
+ try
+ {
+ if (next != null)
+ {
+ jar.closeEntry();
+ }
+ next = null;
+ do
+ {
+ next = jar.getNextJarEntry();
+ }
+ while (next != null && next.isDirectory());
+ if (next == null)
+ {
+ close();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("failed to browse jar", e);
+ }
+ }
+
+ public InputStream next()
+ {
+ if (closed || (next == null && !initial))
+ {
+ return null;
+ }
+ setNext();
+ if (next == null)
+ {
+ return null;
+ }
+ return new InputStreamWrapper(jar);
+ }
+
+ private void close()
+ {
+ try
+ {
+ closed = true;
+ jar.close();
+ }
+ catch (IOException ignored)
+ {
+
+ }
+
+ }
+
+
+ public boolean hasNext()
+ {
+ throw new UnsupportedOperationException("Cannot call hasNext() on a JarIterator");
+ }
+
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException("Cannot call remove() on a JarIterator");
+ }
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/scannotation/JarIterator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentMetaModelTest.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -46,7 +46,6 @@
import org.jboss.webbeans.test.components.Carp;
import org.jboss.webbeans.test.components.Cat;
import org.jboss.webbeans.test.components.Chair;
-import org.jboss.webbeans.test.components.ComponentWithTooManyDeploymentTypes;
import org.jboss.webbeans.test.components.ComponentWithTooManyScopeTypes;
import org.jboss.webbeans.test.components.Cow;
import org.jboss.webbeans.test.components.Goldfish;
@@ -58,6 +57,7 @@
import org.jboss.webbeans.test.components.Pig;
import org.jboss.webbeans.test.components.SeaBass;
import org.jboss.webbeans.test.components.Tuna;
+import org.jboss.webbeans.test.components.broken.ComponentWithTooManyDeploymentTypes;
import org.jboss.webbeans.test.mock.MockContainerImpl;
import org.jboss.webbeans.util.AnnotatedItem;
import org.jboss.webbeans.util.ClassAnnotatedItem;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -6,8 +6,8 @@
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.deployment.DeploymentStrategy;
+import org.jboss.webbeans.scannotation.ClasspathUrlFinder;
import org.junit.Test;
-import org.scannotation.ClasspathUrlFinder;
public class DeploymentStrategyTest
{
@@ -18,7 +18,7 @@
URL[] urls = {ClasspathUrlFinder.findClassBase(DeploymentStrategyTest.class)};
Container container = new ContainerImpl(null);
DeploymentStrategy deploymentStrategy = new DeploymentStrategy(Thread.currentThread().getContextClassLoader(), container);
- deploymentStrategy.scan(urls);
+ deploymentStrategy.scan(urls, "org.jboss.webbeans.test.annotations.broken", "org.jboss.webbeans.test.bindings.broken", "org.jboss.webbeans.test.components.broken");
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -11,10 +11,10 @@
import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.test.annotations.StereotypeWithTooManyScopeTypes;
-import org.jboss.webbeans.test.annotations.StereotypeWithNonEmptyNamed;
-import org.jboss.webbeans.test.annotations.StereotypeWithTooManyDeploymentTypes;
-import org.jboss.webbeans.test.annotations.StereotypeWithBindingTypes;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithBindingTypes;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithNonEmptyNamed;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyDeploymentTypes;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyScopeTypes;
import org.jboss.webbeans.test.components.Animal;
import org.jboss.webbeans.test.components.Order;
import org.jboss.webbeans.util.ClassAnnotatedItem;
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithBindingTypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithBindingTypes.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithBindingTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -1,17 +0,0 @@
-package org.jboss.webbeans.test.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import javax.webbeans.Stereotype;
-
-@Stereotype
-@Target( { TYPE })
-@Retention(RUNTIME)
-@Asynchronous
-public @interface StereotypeWithBindingTypes
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithNonEmptyNamed.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithNonEmptyNamed.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithNonEmptyNamed.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -1,19 +0,0 @@
-package org.jboss.webbeans.test.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.webbeans.Named;
-import javax.webbeans.Stereotype;
-
-@Stereotype
-@Target( { TYPE })
-@Retention(RUNTIME)
-@Named("foo")
-public @interface StereotypeWithNonEmptyNamed
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyDeploymentTypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyDeploymentTypes.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyDeploymentTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -1,20 +0,0 @@
-package org.jboss.webbeans.test.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.webbeans.Production;
-import javax.webbeans.Stereotype;
-
-@Stereotype
-@Target( { TYPE })
-@Retention(RUNTIME)
-@Production
-@AnotherDeploymentType
-public @interface StereotypeWithTooManyDeploymentTypes
-{
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyScopeTypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyScopeTypes.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyScopeTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -1,21 +0,0 @@
-package org.jboss.webbeans.test.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.Stereotype;
-
-@Stereotype
-@Target( { TYPE })
-@Retention(RUNTIME)
-@ApplicationScoped
-@RequestScoped
-public @interface StereotypeWithTooManyScopeTypes
-{
-
-}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithBindingTypes.java (from rev 83, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithBindingTypes.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithBindingTypes.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithBindingTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.test.annotations.broken;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.webbeans.Stereotype;
+
+import org.jboss.webbeans.test.annotations.Asynchronous;
+
+@Stereotype
+@Target( { TYPE })
+@Retention(RUNTIME)
+@Asynchronous
+public @interface StereotypeWithBindingTypes
+{
+
+}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithNonEmptyNamed.java (from rev 78, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithNonEmptyNamed.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithNonEmptyNamed.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithNonEmptyNamed.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,19 @@
+package org.jboss.webbeans.test.annotations.broken;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.Named;
+import javax.webbeans.Stereotype;
+
+@Stereotype
+@Target( { TYPE })
+@Retention(RUNTIME)
+@Named("foo")
+public @interface StereotypeWithNonEmptyNamed
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithNonEmptyNamed.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyDeploymentTypes.java (from rev 78, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyDeploymentTypes.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyDeploymentTypes.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyDeploymentTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.annotations.broken;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.Production;
+import javax.webbeans.Stereotype;
+
+import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
+
+@Stereotype
+@Target( { TYPE })
+@Retention(RUNTIME)
+@Production
+@AnotherDeploymentType
+public @interface StereotypeWithTooManyDeploymentTypes
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyDeploymentTypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyScopeTypes.java (from rev 83, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/StereotypeWithTooManyScopeTypes.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyScopeTypes.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/broken/StereotypeWithTooManyScopeTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.test.annotations.broken;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.Stereotype;
+
+@Stereotype
+@Target( { TYPE })
+@Retention(RUNTIME)
+@ApplicationScoped
+@RequestScoped
+public @interface StereotypeWithTooManyScopeTypes
+{
+
+}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/ComponentWithTooManyDeploymentTypes.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/ComponentWithTooManyDeploymentTypes.java 2008-08-10 15:00:47 UTC (rev 87)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/ComponentWithTooManyDeploymentTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -1,12 +0,0 @@
-package org.jboss.webbeans.test.components;
-
-import javax.webbeans.Production;
-
-import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
-
-@Production
-@AnotherDeploymentType
-public class ComponentWithTooManyDeploymentTypes
-{
-
-}
Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/ComponentWithTooManyDeploymentTypes.java (from rev 78, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/ComponentWithTooManyDeploymentTypes.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/ComponentWithTooManyDeploymentTypes.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/ComponentWithTooManyDeploymentTypes.java 2008-08-10 15:02:38 UTC (rev 88)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.components.broken;
+
+import javax.webbeans.Production;
+
+import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
+
+@Production
+@AnotherDeploymentType
+public class ComponentWithTooManyDeploymentTypes
+{
+
+}
Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/components/broken/ComponentWithTooManyDeploymentTypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
[webbeans-commits] Webbeans SVN: r87 - ri/trunk/examples/webbeans-pizzashack.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 11:00:47 -0400 (Sun, 10 Aug 2008)
New Revision: 87
Modified:
ri/trunk/examples/webbeans-pizzashack/
Log:
ignores
Property changes on: ri/trunk/examples/webbeans-pizzashack
___________________________________________________________________
Name: svn:ignore
- pom.properties
target
.classpath
+ pom.properties
target
.classpath
.project
16 years, 4 months
[webbeans-commits] Webbeans SVN: r85 - ri/trunk/examples/webbeans-pizzashack.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-08-10 10:58:52 -0400 (Sun, 10 Aug 2008)
New Revision: 85
Removed:
ri/trunk/examples/webbeans-pizzashack/.project
Log:
Don't want .project in SVN
Deleted: ri/trunk/examples/webbeans-pizzashack/.project
===================================================================
--- ri/trunk/examples/webbeans-pizzashack/.project 2008-08-10 14:57:56 UTC (rev 84)
+++ ri/trunk/examples/webbeans-pizzashack/.project 2008-08-10 14:58:52 UTC (rev 85)
@@ -1,13 +0,0 @@
-<projectDescription>
- <name>webbeans-pizzashack</name>
- <comment>Web Beans Examples: Pizzashack</comment>
- <projects/>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
16 years, 4 months