Author: pete.muir(a)jboss.org
Date: 2008-06-27 10:14:53 -0400 (Fri, 27 Jun 2008)
New Revision: 19
Added:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/MergedComponentStereotypes.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/DependentBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/NamedBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/ProductionBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/StandardBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/LoggerUtil.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalOrderStereotype.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalStereotype.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/RequestScopedAnimalStereotype.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/Synchronous.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/bindings/
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/bindings/SynchronousBinding.java
Removed:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/CurrentBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/DependentBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ProductionBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StandardBinding.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedWebBean.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedWebBean.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedWebBeanTest.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalOrderStereotype.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalStereotype.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/RequestScopedAnimalStereotype.java
Modified:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ContainerImpl.java
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StereotypeMetaModel.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ComponentInstanceTest.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/Gorilla.java
Log:
JUL based logging with filter support (WBRI-14), support for merging in XML based
annotations, split out algorithms into static methods for reuse, better class hierachy for
AnnotatedItem, more tests
Modified:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -6,6 +6,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Logger;
import javax.webbeans.BindingType;
import javax.webbeans.ComponentInstance;
@@ -15,7 +16,10 @@
import javax.webbeans.ScopeType;
import javax.webbeans.Stereotype;
-import org.jboss.webbeans.util.AnnotatedWebBean;
+import org.jboss.webbeans.bindings.CurrentBinding;
+import org.jboss.webbeans.bindings.DependentBinding;
+import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.util.LoggerUtil;
/**
* Web Beans Component meta model
@@ -26,72 +30,82 @@
public class ComponentInstanceImpl<T> extends ComponentInstance<T>
{
+
+
+ public static final String LOGGER_NAME = "componentInstance";
+
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ private Class<?> type;
private Set<Annotation> bindingTypes;
private Annotation componentType;
private String name;
private Annotation scopeType;
- private Set<Annotation> possibleDeploymentTypes;
- private Set<Annotation> possibleScopeTypes;
- private boolean componentNameDefaulted;
- private Set<Class<?>> requiredTypes;
- private Set<Class<? extends Annotation>> supportedScopes;
- public ComponentInstanceImpl(AnnotatedWebBean annotatedElement, ContainerImpl
container)
+ /**
+ *
+ * @param annotatedItem Annotations read from java classes
+ * @param xmlAnnotatedItem Annotations read from XML
+ * @param container
+ */
+ public ComponentInstanceImpl(AnnotatedItem annotatedItem, AnnotatedItem
xmlAnnotatedItem, ContainerImpl container)
{
- initStereotypes(annotatedElement, container);
- initBindingTypes(annotatedElement);
- initComponentType(annotatedElement, container);
- initScopeType(annotatedElement);
- initName(annotatedElement);
- checkRequiredTypesImplemented(annotatedElement);
- checkScopeAllowed(annotatedElement);
+ 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 = getType(annotatedItem, xmlAnnotatedItem);
+ log.fine("Building Web Bean component metadata for " + type);
+ MergedComponentStereotypes stereotypes = new
MergedComponentStereotypes(annotatedItem, xmlAnnotatedItem, container);
+ this.bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
+ this.componentType = initComponentType(stereotypes, annotatedItem,
xmlAnnotatedItem, container);
+ this.scopeType = initScopeType(stereotypes, annotatedItem, xmlAnnotatedItem);
+ this.name = initName(stereotypes, annotatedItem, xmlAnnotatedItem);
+ checkRequiredTypesImplemented(stereotypes, type);
+ checkScopeAllowed(stereotypes, scopeType);
// TODO Interceptors
}
- private void initStereotypes(AnnotatedWebBean annotatedElement, ContainerImpl
container)
+ /*
+ * A series of static methods which implement the algorithms defined in the Web Beans
spec for component meta data
+ */
+
+ protected static Class<?> getType(AnnotatedItem annotatedItem, AnnotatedItem
xmlAnnotatedItem)
{
- possibleDeploymentTypes = new HashSet<Annotation>();
- possibleScopeTypes = new HashSet<Annotation>();
- requiredTypes = new HashSet<Class<?>>();
- supportedScopes = new HashSet<Class<? extends Annotation>>();
- for (Annotation stereotypeAnnotation :
annotatedElement.getAnnotations(Stereotype.class))
- {
- StereotypeMetaModel stereotype =
container.getStereotypeManager().getStereotype(stereotypeAnnotation.annotationType());
- if (stereotype.getDefaultDeploymentType() != null)
- {
- possibleDeploymentTypes.add(stereotype.getDefaultDeploymentType());
- }
- if (stereotype.getDefaultScopeType() != null)
- {
- possibleScopeTypes.add(stereotype.getDefaultScopeType());
- }
- requiredTypes.addAll(stereotype.getRequiredTypes());
- supportedScopes.addAll(stereotype.getSupportedScopes());
- if (stereotype.isComponentNameDefaulted())
- {
- componentNameDefaulted = true;
- }
- }
+ // TODO Consider XML type
+ return annotatedItem.getAnnotatedClass();
}
- private void checkScopeAllowed(AnnotatedWebBean annotatedClass)
+ /**
+ * Check that the scope type is allowed by the stereotypes on the component
+ */
+ protected static void checkScopeAllowed(MergedComponentStereotypes stereotypes,
Annotation scopeType)
{
- if (supportedScopes.size() > 0)
+ if (stereotypes.getSupportedScopes().size() > 0)
{
- if (!supportedScopes.contains(scopeType))
+ if (!stereotypes.getSupportedScopes().contains(scopeType))
{
throw new RuntimeException("Scope " + scopeType + " is not an
allowed by the component's stereotype");
}
}
}
- private void checkRequiredTypesImplemented(AnnotatedWebBean annotatedClass)
+ /**
+ * Check that the types required by the stereotypes on the component are implemented
+ */
+ protected static void checkRequiredTypesImplemented(MergedComponentStereotypes
stereotypes, Class<?> type)
{
- if (requiredTypes.size() > 0)
+ if (stereotypes.getRequiredTypes().size() > 0)
{
// TODO This needs to check a lot more. Or we do through checking assignability
- List<Class> classes =
Arrays.asList(annotatedClass.getAnnotatedClass().getInterfaces());
- if (!classes.containsAll(requiredTypes))
+ List<Class> classes = Arrays.asList(type.getInterfaces());
+ if (!classes.containsAll(stereotypes.getRequiredTypes()))
{
// TODO Ugh, improve this exception
throw new RuntimeException("Not all required types are
implemented");
@@ -99,78 +113,128 @@
}
}
- private void initScopeType(AnnotatedWebBean annotatedElement)
+ /**
+ * Return the scope of the component
+ */
+ protected static Annotation initScopeType(MergedComponentStereotypes stereotypes,
AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
{
- Set<Annotation> scopes = annotatedElement.getAnnotations(ScopeType.class);
- if (scopes.size() > 1)
+ Set<Annotation> xmlScopes =
xmlAnnotatedItem.getAnnotations(ScopeType.class);
+ if (xmlScopes.size() > 1)
{
- throw new RuntimeException("At most one scope may be specified");
+ throw new RuntimeException("At most one scope may be specified in
XML");
}
- else if (scopes.size() == 1)
+
+ if (xmlScopes.size() == 1)
{
- this.scopeType = scopes.iterator().next();
+ log.info("Scope specified in XML");
+ return xmlScopes.iterator().next();
}
- else if (possibleScopeTypes.size() == 1)
+
+ Set<Annotation> scopes = annotatedItem.getAnnotations(ScopeType.class);
+ if (scopes.size() > 1)
{
- this.scopeType = possibleScopeTypes.iterator().next();
+ throw new RuntimeException("At most one scope may be specified");
}
- else if (possibleScopeTypes.size() > 0)
+
+ if (scopes.size() == 1)
{
- //TODO DO something
+ log.info("Scope specified by annotation");
+ return scopes.iterator().next();
}
- else
+
+ if (stereotypes.getPossibleScopeTypes().size() > 0)
{
- this.scopeType = new DependentBinding();
+ return stereotypes.getPossibleScopeTypes().iterator().next();
}
+
+ return new DependentBinding();
}
- private void initComponentType(AnnotatedWebBean annotatedElement, ContainerImpl
container)
+ protected static Annotation initComponentType(MergedComponentStereotypes stereotypes,
AnnotatedItem annotatedElement, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
{
+ /*
+ * TODO deployment types actually identify components to deploy - and so
+ * if declared in XML and java then there are two components to deploy -
+ * this needs to be handled at a higher level
+ *
+ * TODO Ignore deployment type annotations on class if declared in XML
+ */
+ Set<Annotation> xmlDeploymentTypes =
annotatedElement.getAnnotations(DeploymentType.class);
+
+ if (xmlDeploymentTypes.size() > 1)
+ {
+ throw new RuntimeException("At most one deployment type may be specified in
XML");
+ }
+
+ if (xmlDeploymentTypes.size() == 1)
+ {
+ return xmlDeploymentTypes.iterator().next();
+ }
+
Set<Annotation> deploymentTypes =
annotatedElement.getAnnotations(DeploymentType.class);
+
if (deploymentTypes.size() > 1)
{
+ // TODO Improve the exception
throw new RuntimeException("At most one deployment type may be
specified");
}
- else if (deploymentTypes.size() == 1)
+ if (deploymentTypes.size() == 1)
{
- this.componentType = deploymentTypes.iterator().next();
+ return deploymentTypes.iterator().next();
}
- else
+
+ if (stereotypes.getPossibleDeploymentTypes().size() > 0)
{
- this.componentType = getDeploymentType(container.getEnabledDeploymentTypes(),
possibleDeploymentTypes);
+ return getDeploymentType(container.getEnabledDeploymentTypes(),
stereotypes.getPossibleDeploymentTypes());
}
+
+ // TODO If declared in XML then we can return Production here
+ // TODO We shouldn't get here, but what to do if we have?
+ return null;
}
- private void initBindingTypes(AnnotatedWebBean annotatedElement)
+ protected static Set<Annotation> initBindingTypes(AnnotatedItem
annotatedElement, AnnotatedItem xmlAnnotatedItem)
{
- bindingTypes = annotatedElement.getAnnotations(BindingType.class);
+ Set<Annotation> xmlBindingTypes =
xmlAnnotatedItem.getAnnotations(BindingType.class);
+ if (xmlBindingTypes.size() > 0)
+ {
+ // TODO support producer expression default binding type
+ return xmlBindingTypes;
+ }
- // Add the default binding if needed
+ Set<Annotation> bindingTypes =
annotatedElement.getAnnotations(BindingType.class);
if (bindingTypes.size() == 0)
{
bindingTypes.add(new CurrentBinding());
}
+ return bindingTypes;
}
- private void initName(AnnotatedWebBean annotatedElement)
+ protected static String initName(MergedComponentStereotypes stereotypes, AnnotatedItem
annotatedItem, AnnotatedItem xmlAnnotatedItem)
{
- if (annotatedElement.isAnnotationPresent(Named.class))
+ boolean componentNameDefaulted = false;
+ String name = null;
+ if (xmlAnnotatedItem.isAnnotationPresent(Named.class))
{
- String name = annotatedElement.getAnnotation(Named.class).value();
+ name = xmlAnnotatedItem.getAnnotation(Named.class).value();
if ("".equals(name))
{
componentNameDefaulted = true;
}
- else
+ }
+ else if (annotatedItem.isAnnotationPresent(Named.class))
+ {
+ name = annotatedItem.getAnnotation(Named.class).value();
+ if ("".equals(name))
{
- componentNameDefaulted = false;
- this.name = name;
+ componentNameDefaulted = true;
}
}
- if (componentNameDefaulted)
+ if ("".equals(name) && (componentNameDefaulted ||
stereotypes.isComponentNameDefaulted()))
{
// TODO Write default name alogorithm
}
+ return name;
}
public static Annotation getDeploymentType(List<Annotation>
enabledDeploymentTypes, Set<Annotation> possibleDeploymentTypes)
@@ -183,7 +247,7 @@
}
else
{
- return new ProductionBinding();
+ return null;
}
}
Modified: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ContainerImpl.java
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ContainerImpl.java 2008-06-27
14:12:41 UTC (rev 18)
+++ ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ContainerImpl.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -11,6 +11,9 @@
import javax.webbeans.Observer;
import javax.webbeans.TypeLiteral;
+import org.jboss.webbeans.bindings.ProductionBinding;
+import org.jboss.webbeans.bindings.StandardBinding;
+
public class ContainerImpl implements Container
{
Deleted: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/CurrentBinding.java
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/CurrentBinding.java 2008-06-27
14:12:41 UTC (rev 18)
+++ ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/CurrentBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,6 +0,0 @@
-package org.jboss.webbeans;
-
-import javax.webbeans.Current;
-import javax.webbeans.DynamicBinding;
-
-public class CurrentBinding extends DynamicBinding<Current> implements Current {}
Deleted: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/DependentBinding.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/DependentBinding.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/DependentBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,9 +0,0 @@
-package org.jboss.webbeans;
-
-import javax.webbeans.Dependent;
-import javax.webbeans.DynamicBinding;
-
-public class DependentBinding extends DynamicBinding<Dependent> implements
Dependent
-{
-
-}
Added:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/MergedComponentStereotypes.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/MergedComponentStereotypes.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/MergedComponentStereotypes.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,88 @@
+package org.jboss.webbeans;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Stereotype;
+
+import org.jboss.webbeans.util.AnnotatedItem;
+
+/**
+ * Meta model for the merged stereotype for a component
+ * @author pmuir
+ *
+ */
+public class MergedComponentStereotypes
+{
+
+ private Set<Annotation> possibleDeploymentTypes;
+ private Set<Annotation> possibleScopeTypes;
+ private boolean componentNameDefaulted;
+ private Set<Class<?>> requiredTypes;
+ private Set<Class<? extends Annotation>> supportedScopes;
+
+ public MergedComponentStereotypes(AnnotatedItem annotatedItem, AnnotatedItem
xmlAnnotatedItem, ContainerImpl container)
+ {
+ possibleDeploymentTypes = new HashSet<Annotation>();
+ possibleScopeTypes = new HashSet<Annotation>();
+ requiredTypes = new HashSet<Class<?>>();
+ supportedScopes = new HashSet<Class<? extends Annotation>>();
+
+ // All stereotypes declared in java and xml are merged
+ Set<Annotation> stereotypeAnnotations = new HashSet<Annotation>();
+ stereotypeAnnotations.addAll(annotatedItem.getAnnotations(Stereotype.class));
+ stereotypeAnnotations.addAll(xmlAnnotatedItem.getAnnotations(Stereotype.class));
+
+ for (Annotation stereotypeAnnotation : stereotypeAnnotations)
+ {
+ // Retrieve and merge all metadata from stereotypes
+ StereotypeMetaModel stereotype =
container.getStereotypeManager().getStereotype(stereotypeAnnotation.annotationType());
+ if (stereotype.getDefaultDeploymentType() != null)
+ {
+ possibleDeploymentTypes.add(stereotype.getDefaultDeploymentType());
+ }
+ if (stereotype.getDefaultScopeType() != null)
+ {
+ possibleScopeTypes.add(stereotype.getDefaultScopeType());
+ }
+ requiredTypes.addAll(stereotype.getRequiredTypes());
+ supportedScopes.addAll(stereotype.getSupportedScopes());
+ if (stereotype.isComponentNameDefaulted())
+ {
+ componentNameDefaulted = true;
+ }
+ }
+
+ if (this.possibleScopeTypes.size() > 1)
+ {
+ throw new RuntimeException("All stereotypes must specify the same scope OR
a scope must be specified on the component");
+ }
+ }
+
+ public Set<Annotation> getPossibleDeploymentTypes()
+ {
+ return possibleDeploymentTypes;
+ }
+
+ public Set<Annotation> getPossibleScopeTypes()
+ {
+ return possibleScopeTypes;
+ }
+
+ public boolean isComponentNameDefaulted()
+ {
+ return componentNameDefaulted;
+ }
+
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/MergedComponentStereotypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ProductionBinding.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ProductionBinding.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ProductionBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,9 +0,0 @@
-package org.jboss.webbeans;
-
-import javax.webbeans.DynamicBinding;
-import javax.webbeans.Production;
-
-public class ProductionBinding extends DynamicBinding<Production> implements
Production
-{
-
-}
Deleted: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StandardBinding.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StandardBinding.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StandardBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,9 +0,0 @@
-package org.jboss.webbeans;
-
-import javax.webbeans.DynamicBinding;
-import javax.webbeans.Standard;
-
-public class StandardBinding extends DynamicBinding<Standard> implements Standard
-{
-
-}
Modified:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StereotypeMetaModel.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StereotypeMetaModel.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StereotypeMetaModel.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -2,9 +2,7 @@
import java.lang.annotation.Annotation;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import javax.webbeans.BindingType;
@@ -14,7 +12,7 @@
import javax.webbeans.ScopeType;
import javax.webbeans.Stereotype;
-import org.jboss.webbeans.util.AnnotatedWebBean;
+import org.jboss.webbeans.util.AnnotatedItem;
/**
* A meta model for a stereotype, allows us to cache a stereotype and to validate it
@@ -34,7 +32,7 @@
private Set<Annotation> interceptorBindings;
@SuppressWarnings("unchecked")
- public StereotypeMetaModel(AnnotatedWebBean annotatedClass)
+ public StereotypeMetaModel(AnnotatedItem annotatedClass)
{
initStereotypeClass(annotatedClass);
Stereotype stereotype = annotatedClass.getAnnotation(Stereotype.class);
@@ -47,7 +45,7 @@
checkBindingTypes(annotatedClass);
}
- private void checkBindingTypes(AnnotatedWebBean annotatedClass)
+ private void checkBindingTypes(AnnotatedItem annotatedClass)
{
Set<Annotation> bindingTypes =
annotatedClass.getAnnotations(BindingType.class);
if (bindingTypes.size() > 0)
@@ -57,7 +55,7 @@
}
@SuppressWarnings("unchecked")
- private void initStereotypeClass(AnnotatedWebBean annotatedClass)
+ private void initStereotypeClass(AnnotatedItem annotatedClass)
{
if (Annotation.class.isAssignableFrom(annotatedClass.getAnnotatedClass()))
{
@@ -69,12 +67,12 @@
}
}
- private void initInterceptorBindings(AnnotatedWebBean annotatedClass)
+ private void initInterceptorBindings(AnnotatedItem annotatedClass)
{
interceptorBindings = annotatedClass.getAnnotations(InterceptorBindingType.class);
}
- private void initSupportedScopes(AnnotatedWebBean annotatedElement, Stereotype
stereotype)
+ private void initSupportedScopes(AnnotatedItem annotatedElement, Stereotype
stereotype)
{
this.supportedScopes = new HashSet<Class<? extends Annotation>>();
Class<? extends Annotation>[] supportedScopes =
stereotype.supportedScopes();
@@ -84,7 +82,7 @@
}
}
- private void initRequiredTypes(AnnotatedWebBean annotatedElement, Stereotype
stereotype)
+ private void initRequiredTypes(AnnotatedItem annotatedElement, Stereotype stereotype)
{
this.requiredTypes = new HashSet<Class<?>>();
Class<?>[] requiredTypes = stereotype.requiredTypes();
@@ -94,7 +92,7 @@
}
}
- private void initComponentNameDefaulted(AnnotatedWebBean annotatedElement)
+ private void initComponentNameDefaulted(AnnotatedItem annotatedElement)
{
if (annotatedElement.isAnnotationPresent(Named.class))
{
@@ -106,7 +104,7 @@
}
}
- private void initDefaultScopeType(AnnotatedWebBean annotatedElement)
+ private void initDefaultScopeType(AnnotatedItem annotatedElement)
{
Set<Annotation> scopeTypes =
annotatedElement.getAnnotations(ScopeType.class);
if (scopeTypes.size() > 1)
@@ -119,7 +117,7 @@
}
}
- private void initDefaultDeploymentType(AnnotatedWebBean annotatedElement)
+ private void initDefaultDeploymentType(AnnotatedItem annotatedElement)
{
Set<Annotation> deploymentTypes =
annotatedElement.getAnnotations(DeploymentType.class);
if (deploymentTypes.size() > 1)
Copied:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java (from
rev 15, ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/CurrentBinding.java)
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.bindings;
+
+import javax.webbeans.Current;
+import javax.webbeans.DynamicBinding;
+
+public class CurrentBinding extends DynamicBinding<Current> implements Current {}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/CurrentBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/DependentBinding.java
(from rev 17,
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/DependentBinding.java)
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/DependentBinding.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/DependentBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.bindings;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.DynamicBinding;
+
+public class DependentBinding extends DynamicBinding<Dependent> implements
Dependent
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/DependentBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/NamedBinding.java
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/NamedBinding.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/NamedBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.bindings;
+
+import javax.webbeans.DynamicBinding;
+import javax.webbeans.Named;
+
+public abstract class NamedBinding extends DynamicBinding<Named> implements Named
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/NamedBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/ProductionBinding.java
(from rev 17,
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/ProductionBinding.java)
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/ProductionBinding.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/ProductionBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.bindings;
+
+import javax.webbeans.DynamicBinding;
+import javax.webbeans.Production;
+
+public class ProductionBinding extends DynamicBinding<Production> implements
Production
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/ProductionBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/StandardBinding.java
(from rev 17,
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/StandardBinding.java)
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/StandardBinding.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/StandardBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.bindings;
+
+import javax.webbeans.DynamicBinding;
+import javax.webbeans.Standard;
+
+public class StandardBinding extends DynamicBinding<Standard> implements Standard
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/bindings/StandardBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,107 @@
+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
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
(from rev 17,
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedWebBean.java)
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,51 @@
+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
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedWebBean.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedWebBean.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/AnnotatedWebBean.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,50 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-/**
- * AnnotatedWebBean provides a uniform access to the annotations on a Web Bean,
- * defined either in Java or XML
- *
- * @author Pete Muir
- *
- */
-public interface AnnotatedWebBean
-{
-
- /**
- * 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
- */
- public Class<?> getAnnotatedClass();
-
-}
\ No newline at end of file
Copied:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java (from
rev 17,
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedWebBean.java)
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,32 @@
+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;
+ }
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/LoggerUtil.java
===================================================================
--- ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/LoggerUtil.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/LoggerUtil.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,38 @@
+package org.jboss.webbeans.util;
+
+import java.util.logging.Filter;
+import java.util.logging.Logger;
+
+public class LoggerUtil
+{
+
+ public static final String FILTER_PROPERTY =
"org.jboss.webbeans.logger.filter";
+
+ public static final String WEBBEANS_LOGGER = "javax.webbeans.";
+
+ private static Filter filter;
+
+ static
+ {
+ String filterClassName = System.getProperty(FILTER_PROPERTY);
+ if (filterClassName != null && !"".equals(filterClassName))
+ try
+ {
+ filter = (Filter) Class.forName(filterClassName).newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Unable to instantiate logging
filter");
+ }
+
+ }
+
+ public static Logger getLogger(String name)
+ {
+ name = WEBBEANS_LOGGER + name;
+ Logger logger = Logger.getLogger(name);
+ logger.setFilter(filter);
+ return logger;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/LoggerUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,70 @@
+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();
+ }
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedWebBean.java
===================================================================
---
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedWebBean.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/main/java/org/jboss/webbeans/util/MutableAnnotatedWebBean.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,112 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-public class MutableAnnotatedWebBean implements AnnotatedWebBean
-{
-
- private Map<Class<? extends Annotation>, Annotation> annotations;
-
- private Map<Class<? extends Annotation>, Set<Annotation>>
metaAnnotations;
- private Set<Annotation> annotationSet;
- private Class<?> annotatedClass;
-
- private MutableAnnotatedWebBean()
- {
- this.annotations = new HashMap<Class<? extends Annotation>,
Annotation>();
- }
-
- public MutableAnnotatedWebBean(Class<?> clazz)
- {
- this();
- this.annotatedClass = clazz;
- for (Annotation annotation : clazz.getAnnotations())
- {
- add(annotation);
- }
- }
-
- @SuppressWarnings("unchecked")
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- return (T) annotations.get(annotationType);
- }
-
- 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>>();
- }
- if (!metaAnnotations.containsKey(metaAnnotationType))
- {
- Set<Annotation> s = new HashSet<Annotation>();
- for (Entry<Class<? extends Annotation>, Annotation> entry :
annotations.entrySet())
- {
- if
(entry.getValue().annotationType().isAnnotationPresent(metaAnnotationType))
- {
- s.add(entry.getValue());
- }
- }
- metaAnnotations.put(metaAnnotationType, s);
- }
- return metaAnnotations.get(metaAnnotationType);
- }
-
-
- public Set<Annotation> getAnnotations()
- {
- if (annotationSet == null)
- {
- annotationSet = new HashSet<Annotation>();
- for (Entry<Class<? extends Annotation>, Annotation> entry :
annotations.entrySet())
- {
- annotationSet.add(entry.getValue());
- }
- }
- return annotationSet;
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
- {
- return annotations.containsKey(annotatedType);
- }
-
- /**
- * Add an annotation to the AnnotatedElement
- * @param annotation
- */
- public void add(Annotation annotation)
- {
- setDirty();
- annotations.put(annotation.annotationType(), annotation);
- }
-
- public void addAll(Collection<Annotation> annotations)
- {
- for (Annotation annotation : annotations)
- {
- this.annotations.put(annotation.annotationType(), annotation);
- }
- setDirty();
- }
-
- public Class<?> getAnnotatedClass()
- {
- return annotatedClass;
- }
-
-}
Copied:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
(from rev 17,
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedWebBeanTest.java)
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,53 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.webbeans.DeploymentType;
+import javax.webbeans.Named;
+import javax.webbeans.Production;
+import javax.webbeans.Stereotype;
+
+import org.jboss.webbeans.test.components.ClassWithNoAnnotations;
+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
+{
+
+ @Test
+ public void testDeclaredAnnotations()
+ {
+ AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+ assert annotatedElement.getAnnotations().size() == 2;
+ assert annotatedElement.getAnnotation(Production.class) != null;
+ assert annotatedElement.getAnnotation(Named.class) != null;
+ System.out.println(annotatedElement.getAnnotatedClass());
+ assert annotatedElement.getAnnotatedClass().equals(Order.class);
+ }
+
+ @Test
+ public void testMetaAnnotations()
+ {
+ AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+ Set<Annotation> annotations =
annotatedElement.getAnnotations(DeploymentType.class);
+ assert annotations.size() == 1;
+ Iterator<Annotation> it = annotations.iterator();
+ Annotation production = it.next();
+ assert Production.class.equals(production.annotationType());
+ }
+
+ @Test
+ public void testEmpty()
+ {
+ AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+ assert annotatedElement.getAnnotation(Stereotype.class) == null;
+ assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
+ AnnotatedItem classWithNoAnnotations = new
ClassAnnotatedItem(ClassWithNoAnnotations.class);
+ assert classWithNoAnnotations.getAnnotations().size() == 0;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ComponentInstanceTest.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ComponentInstanceTest.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/ComponentInstanceTest.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,18 +1,31 @@
package org.jboss.webbeans.test;
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.webbeans.ComponentInstance;
import javax.webbeans.Current;
import javax.webbeans.Dependent;
+import javax.webbeans.Named;
import javax.webbeans.Production;
import org.jboss.webbeans.ComponentInstanceImpl;
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.StereotypeMetaModel;
-import org.jboss.webbeans.test.components.AnimalStereotype;
+import org.jboss.webbeans.bindings.CurrentBinding;
+import org.jboss.webbeans.bindings.NamedBinding;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.Synchronous;
+import org.jboss.webbeans.test.bindings.SynchronousBinding;
import org.jboss.webbeans.test.components.Gorilla;
import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.util.MutableAnnotatedWebBean;
+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.BeforeClass;
import org.junit.Test;
public class ComponentInstanceTest
@@ -20,12 +33,34 @@
private ContainerImpl container;
+ private static AnnotatedItem emptyAnnotatedItem;
+
+ private static AnnotatedItem currentSynchronousOrder;
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ 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";
+ }
+ });
+ currentSynchronousOrder = new MutableAnnotatedItem(Order.class,
orderXmlAnnotations);
+
+ emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ }
+
@Before
public void before()
{
// TODO Probably need a mock container
container = new ContainerImpl();
- StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
MutableAnnotatedWebBean(AnimalStereotype.class));
+ StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
ClassAnnotatedItem(AnimalStereotype.class));
container.getStereotypeManager().addStereotype(animalStereotype);
}
@@ -34,7 +69,7 @@
public void testOrder()
{
- ComponentInstance<Order> order = new ComponentInstanceImpl<Order>(new
MutableAnnotatedWebBean(Order.class), container);
+ ComponentInstance<Order> order = new ComponentInstanceImpl<Order>(new
ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
assert Production.class.equals(order.getComponentType().annotationType());
assert "order".equals(order.getName());
assert order.getBindingTypes().size() == 1;
@@ -43,10 +78,26 @@
//assert order.getTypes() == ??
}
+ @SuppressWarnings("unchecked")
@Test
+ public void testCurrentSynchronousOrder()
+ {
+ ComponentInstance<Order> order = new ComponentInstanceImpl<Order>(new
ClassAnnotatedItem(Order.class), currentSynchronousOrder, container);
+ assert Production.class.equals(order.getComponentType().annotationType());
+ assert "currentSynchronousOrder".equals(order.getName());
+ assert order.getBindingTypes().size() == 2;
+ for (Annotation annotation : order.getBindingTypes())
+ {
+ // TODO Write a utility class to do this type of test
+ assert annotation.annotationType().equals(Current.class) ||
annotation.annotationType().equals(Synchronous.class);
+ }
+ assert order.getScopeType().annotationType().equals(Dependent.class);
+ }
+
+ @Test
public void testGorilla()
{
- ComponentInstance<Gorilla> gorilla = new
ComponentInstanceImpl<Gorilla>(new MutableAnnotatedWebBean(Gorilla.class),
container);
+ ComponentInstance<Gorilla> gorilla = new
ComponentInstanceImpl<Gorilla>(new ClassAnnotatedItem(Gorilla.class),
emptyAnnotatedItem, container);
assert gorilla.getName() == null;
// TODO Ensure that the a java declared component declares a deployment type
//assert gorilla.getComponentType() == null;
Added:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,40 @@
+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());
+ }
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedWebBeanTest.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedWebBeanTest.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/MutableAnnotatedWebBeanTest.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,81 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.Current;
-import javax.webbeans.DeploymentType;
-import javax.webbeans.Named;
-import javax.webbeans.Production;
-import javax.webbeans.ScopeType;
-import javax.webbeans.Stereotype;
-
-import org.jboss.webbeans.CurrentBinding;
-import org.jboss.webbeans.test.components.ClassWithNoAnnotations;
-import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.util.AnnotatedWebBean;
-import org.jboss.webbeans.util.MutableAnnotatedWebBean;
-import org.junit.Test;
-
-public class MutableAnnotatedWebBeanTest
-{
-
- @Test
- public void testDeclaredAnnotations()
- {
- AnnotatedWebBean annotatedElement = new MutableAnnotatedWebBean(Order.class);
- assert annotatedElement.getAnnotations().size() == 2;
- assert annotatedElement.getAnnotation(Production.class) != null;
- assert annotatedElement.getAnnotation(Named.class) != null;
- System.out.println(annotatedElement.getAnnotatedClass());
- assert annotatedElement.getAnnotatedClass().equals(Order.class);
- }
-
- @Test
- public void testMutability()
- {
- MutableAnnotatedWebBean annotatedElement = new
MutableAnnotatedWebBean(Order.class);
- assert annotatedElement.getAnnotations().size() == 2;
- annotatedElement.add(new CurrentBinding());
- assert annotatedElement.getAnnotations().size() == 3;
- assert annotatedElement.getAnnotation(Production.class) != null;
- assert annotatedElement.getAnnotation(Named.class) != null;
- assert annotatedElement.getAnnotation(Current.class) != null;
- }
-
- @Test
- public void testMetaAnnotations()
- {
- AnnotatedWebBean annotatedElement = new MutableAnnotatedWebBean(Order.class);
- Set<Annotation> annotations =
annotatedElement.getAnnotations(DeploymentType.class);
- assert annotations.size() == 1;
- Iterator<Annotation> it = annotations.iterator();
- Annotation production = it.next();
- assert Production.class.equals(production.annotationType());
- }
-
- @Test
- public void testMutableMetaAnnotations()
- {
- MutableAnnotatedWebBean annotatedElement = new
MutableAnnotatedWebBean(Order.class);
- 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());
- }
-
- @Test
- public void testEmpty()
- {
- AnnotatedWebBean annotatedElement = new MutableAnnotatedWebBean(Order.class);
- assert annotatedElement.getAnnotation(Stereotype.class) == null;
- assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
- AnnotatedWebBean classWithNoAnnotations = new
MutableAnnotatedWebBean(ClassWithNoAnnotations.class);
- assert classWithNoAnnotations.getAnnotations().size() == 0;
- }
-
-}
Modified:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -8,12 +8,12 @@
import javax.webbeans.RequestScoped;
import org.jboss.webbeans.StereotypeMetaModel;
+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.components.Animal;
-import org.jboss.webbeans.test.components.AnimalOrderStereotype;
-import org.jboss.webbeans.test.components.AnimalStereotype;
import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.test.components.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.util.MutableAnnotatedWebBean;
+import org.jboss.webbeans.util.ClassAnnotatedItem;
import org.junit.Test;
public class StereotypeMetaModelTest
@@ -22,7 +22,7 @@
@Test
public void testComponentStereotype()
{
- StereotypeMetaModel componentStereotype = new StereotypeMetaModel(new
MutableAnnotatedWebBean(Component.class));
+ StereotypeMetaModel componentStereotype = new StereotypeMetaModel(new
ClassAnnotatedItem(Component.class));
assert
Production.class.equals(componentStereotype.getDefaultDeploymentType().annotationType());
assert componentStereotype.getDefaultScopeType() == null;
@@ -35,7 +35,7 @@
@Test
public void testModelStereotype()
{
- StereotypeMetaModel modelStereotype = new StereotypeMetaModel(new
MutableAnnotatedWebBean(Model.class));
+ StereotypeMetaModel modelStereotype = new StereotypeMetaModel(new
ClassAnnotatedItem(Model.class));
assert
Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
assert
RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
assert modelStereotype.isComponentNameDefaulted();
@@ -47,7 +47,7 @@
@Test
public void testAnimalStereotype()
{
- StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
MutableAnnotatedWebBean(AnimalStereotype.class));
+ StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
ClassAnnotatedItem(AnimalStereotype.class));
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
assert animalStereotype.getRequiredTypes().size() == 1;
@@ -60,7 +60,7 @@
@Test
public void testAnimalOrderStereotype()
{
- StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
MutableAnnotatedWebBean(AnimalOrderStereotype.class));
+ StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
ClassAnnotatedItem(AnimalOrderStereotype.class));
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
assert animalStereotype.getRequiredTypes().size() == 2;
@@ -74,7 +74,7 @@
@Test
public void testRequestScopedAnimalStereotype()
{
- StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
MutableAnnotatedWebBean(RequestScopedAnimalStereotype.class));
+ StereotypeMetaModel animalStereotype = new StereotypeMetaModel(new
ClassAnnotatedItem(RequestScopedAnimalStereotype.class));
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
assert animalStereotype.getRequiredTypes().size() == 1;
Copied:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalOrderStereotype.java
(from rev 17,
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalOrderStereotype.java)
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalOrderStereotype.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalOrderStereotype.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,20 @@
+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;
+
+import org.jboss.webbeans.test.components.Animal;
+import org.jboss.webbeans.test.components.Order;
+
+(a)Stereotype(requiredTypes={Animal.class, Order.class})
+@Target( { TYPE })
+@Retention(RUNTIME)
+public @interface AnimalOrderStereotype
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalOrderStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalStereotype.java
(from rev 17,
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalStereotype.java)
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalStereotype.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalStereotype.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,19 @@
+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;
+
+import org.jboss.webbeans.test.components.Animal;
+
+(a)Stereotype(requiredTypes=Animal.class)
+@Target( { TYPE })
+@Retention(RUNTIME)
+public @interface AnimalStereotype
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/AnimalStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/RequestScopedAnimalStereotype.java
(from rev 17,
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/RequestScopedAnimalStereotype.java)
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/RequestScopedAnimalStereotype.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/RequestScopedAnimalStereotype.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,20 @@
+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.RequestScoped;
+import javax.webbeans.Stereotype;
+
+import org.jboss.webbeans.test.components.Animal;
+
+(a)Stereotype(requiredTypes=Animal.class, supportedScopes=RequestScoped.class)
+@Target( { TYPE })
+@Retention(RUNTIME)
+public @interface RequestScopedAnimalStereotype
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/RequestScopedAnimalStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/Synchronous.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/Synchronous.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/Synchronous.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Synchronous
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/annotations/Synchronous.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/bindings/SynchronousBinding.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/bindings/SynchronousBinding.java
(rev 0)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/bindings/SynchronousBinding.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.test.bindings;
+
+import javax.webbeans.DynamicBinding;
+
+import org.jboss.webbeans.test.annotations.Synchronous;
+
+public class SynchronousBinding extends DynamicBinding<Synchronous> implements
Synchronous
+{
+
+}
Property changes on:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/bindings/SynchronousBinding.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalOrderStereotype.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalOrderStereotype.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalOrderStereotype.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,17 +0,0 @@
-package org.jboss.webbeans.test.components;
-
-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;
-
-(a)Stereotype(requiredTypes={Animal.class, Order.class})
-@Target( { TYPE })
-@Retention(RUNTIME)
-public @interface AnimalOrderStereotype
-{
-
-}
Deleted:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalStereotype.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalStereotype.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/AnimalStereotype.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,17 +0,0 @@
-package org.jboss.webbeans.test.components;
-
-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;
-
-(a)Stereotype(requiredTypes=Animal.class)
-@Target( { TYPE })
-@Retention(RUNTIME)
-public @interface AnimalStereotype
-{
-
-}
Modified:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/Gorilla.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/Gorilla.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/Gorilla.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,5 +1,7 @@
package org.jboss.webbeans.test.components;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+
@AnimalStereotype
public class Gorilla implements Animal
{
Deleted:
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/RequestScopedAnimalStereotype.java
===================================================================
---
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/RequestScopedAnimalStereotype.java 2008-06-27
14:12:41 UTC (rev 18)
+++
ri/trunk/webbeans-impl/src/test/java/org/jboss/webbeans/test/components/RequestScopedAnimalStereotype.java 2008-06-27
14:14:53 UTC (rev 19)
@@ -1,18 +0,0 @@
-package org.jboss.webbeans.test.components;
-
-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.RequestScoped;
-import javax.webbeans.Stereotype;
-
-(a)Stereotype(requiredTypes=Animal.class, supportedScopes=RequestScoped.class)
-@Target( { TYPE })
-@Retention(RUNTIME)
-public @interface RequestScopedAnimalStereotype
-{
-
-}