[webbeans-commits] Webbeans SVN: r150 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/event and 6 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sat Oct 25 15:12:52 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-10-25 15:12:52 -0400 (Sat, 25 Oct 2008)
New Revision: 150
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/BeanConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractProducerBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/BeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerExpressionBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/ComponentConstructor.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/AbstractEnterpriseComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractProducerComponentModel.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/EventComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerExpressionComponent.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.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
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/EnterpriseConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/JMSConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/MethodConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/SimpleConstructor.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/StereotypeModel.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.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/EventComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.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/StereotypeModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
Log:
Replace all instances of component with bean
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -7,6 +7,7 @@
import javax.webbeans.manager.Bean;
import javax.webbeans.manager.Context;
import javax.webbeans.manager.Manager;
+
import org.jboss.webbeans.util.MapWrapper;
/**
@@ -64,7 +65,7 @@
return null;
}
- // TODO should component creation be synchronized?
+ // TODO should bean creation be synchronized?
instance = bean.create();
@@ -89,7 +90,7 @@
else
{
// TODO is this the correct exception to throw? See section 9.1 of spec
- throw new RuntimeException("Component " + bean.getName() + " cannot be removed as it " + "does not exist in [" + scopeType + "] context.");
+ throw new RuntimeException("Bean " + bean.getName() + " cannot be removed as it " + "does not exist in [" + scopeType + "] context.");
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -5,27 +5,27 @@
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.model.AbstractComponentModel;
+import org.jboss.webbeans.model.bean.BeanModel;
public class BeanImpl<T> extends Bean<T>
{
-public static final String LOGGER_NAME = "componentMetaModel";
+ public static final String LOGGER_NAME = "bean";
- private AbstractComponentModel<T, ?> model;
+ private BeanModel<T, ?> beanModel;
private ManagerImpl manager;
- public BeanImpl(AbstractComponentModel<T, ?> model, ManagerImpl manager)
+ public BeanImpl(BeanModel<T, ?> model, ManagerImpl manager)
{
super(manager);
- this.model = model;
+ this.beanModel = model;
}
@Override
public T create()
{
- return model.getConstructor().invoke(manager);
+ return beanModel.getConstructor().invoke(manager);
}
@Override
@@ -38,31 +38,31 @@
@Override
public Set<Annotation> getBindingTypes()
{
- return model.getBindingTypes();
+ return beanModel.getBindingTypes();
}
@Override
public Class<? extends Annotation> getDeploymentType()
{
- return model.getDeploymentType();
+ return beanModel.getDeploymentType();
}
@Override
public String getName()
{
- return model.getName();
+ return beanModel.getName();
}
@Override
public Class<? extends Annotation> getScopeType()
{
- return model.getScopeType();
+ return beanModel.getScopeType();
}
@Override
public Set<Class<?>> getTypes()
{
- return model.getApiTypes();
+ return beanModel.getApiTypes();
}
@Override
@@ -82,12 +82,12 @@
@Override
public String toString()
{
- return model.toString();
+ return beanModel.toString();
}
- public AbstractComponentModel<T, ?> getModel()
+ public BeanModel<T, ?> getModel()
{
- return model;
+ return beanModel;
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ModelManager.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -4,9 +4,9 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.webbeans.model.AbstractComponentModel;
import org.jboss.webbeans.model.ScopeModel;
import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.model.bean.BeanModel;
import org.jboss.webbeans.util.MapWrapper;
public class ModelManager
@@ -29,7 +29,7 @@
private Map<Class<? extends Annotation>, StereotypeModel<?>> stereotypes = new HashMap<Class<? extends Annotation>, StereotypeModel<?>>();
- private Map<Class<?>, AbstractComponentModel<?, ?>> componentModels = new HashMap<Class<?>, AbstractComponentModel<?,?>>();
+ private Map<Class<?>, BeanModel<?, ?>> beanModels = new HashMap<Class<?>, BeanModel<?,?>>();
private ScopeModelMap scopes = new ScopeModelMap();
@@ -44,14 +44,14 @@
return stereotypes.get(annotationType);
}
- public void addComponentModel(AbstractComponentModel<?, ?> componentModel)
+ public void addBeanModel(BeanModel<?, ?> beanModel)
{
- componentModels.put(componentModel.getType(), componentModel);
+ beanModels.put(beanModel.getType(), beanModel);
}
- public AbstractComponentModel<?, ?> getComponentModel(Class<?> clazz)
+ public BeanModel<?, ?> getBeanModel(Class<?> clazz)
{
- return componentModels.get(clazz);
+ return beanModels.get(clazz);
}
public <T extends Annotation> ScopeModel<T> getScopeModel(Class<T> scopeType)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -116,7 +116,7 @@
private Collection<? extends Annotation> getBindingTypes()
{
- // Get the binding types directly from the model for the component
+ // Get the binding types directly from the model for the bean
return this.eventBindings;
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -9,7 +9,7 @@
import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.injectable.InjectableParameter;
import org.jboss.webbeans.injectable.InjectableParameterWrapper;
-import org.jboss.webbeans.model.AbstractComponentModel;
+import org.jboss.webbeans.model.bean.BeanModel;
/**
* <p>
@@ -31,21 +31,21 @@
public class ObserverImpl<T> implements Observer<T>
{
- private final AbstractComponentModel<?, ?> componentModel;
+ private final BeanModel<?, ?> beanModel;
private final InjectableMethod<? extends Object> observerMethod;
private final Class<T> eventType;
/**
* Creates an Observer which describes and encapsulates an observer method (7.3).
*
- * @param componentModel The model for the component which defines the
+ * @param beanModel The model for the bean which defines the
* observer method
* @param observer The observer method to notify
* @param eventType The type of event being observed
*/
- public ObserverImpl(AbstractComponentModel<?, ?> componentModel, InjectableMethod<?> observer, Class<T> eventType)
+ public ObserverImpl(BeanModel<?, ?> beanModel, InjectableMethod<?> observer, Class<T> eventType)
{
- this.componentModel = componentModel;
+ this.beanModel = beanModel;
this.observerMethod = observer;
this.eventType = eventType;
}
@@ -68,7 +68,7 @@
*/
public void notify(final T event)
{
- // Get the most specialized instance of the component
+ // Get the most specialized instance of the bean
Object instance = null /*getInstance(manager)*/;
if (instance != null)
{
@@ -104,7 +104,7 @@
*/
protected Object getInstance(Manager manager)
{
- // Return the most specialized instance of the component
- return manager.getInstanceByType(componentModel.getType(), componentModel.getBindingTypes().toArray(new Annotation[0]));
+ // Return the most specialized instance of the bean
+ return manager.getInstanceByType(beanModel.getType(), beanModel.getBindingTypes().toArray(new Annotation[0]));
}
}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/BeanConstructor.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/ComponentConstructor.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/BeanConstructor.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/BeanConstructor.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.injectable;
+
+import org.jboss.webbeans.ManagerImpl;
+
+public interface BeanConstructor<T>
+{
+
+ public T invoke(ManagerImpl manager);
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/BeanConstructor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/ComponentConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/ComponentConstructor.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/ComponentConstructor.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.injectable;
-
-import org.jboss.webbeans.ManagerImpl;
-
-public interface ComponentConstructor<T>
-{
-
- public T invoke(ManagerImpl manager);
-
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/EnterpriseConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/EnterpriseConstructor.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/EnterpriseConstructor.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -4,7 +4,7 @@
import org.jboss.webbeans.ejb.EjbMetaData;
-public class EnterpriseConstructor<T> implements ComponentConstructor<T>
+public class EnterpriseConstructor<T> implements BeanConstructor<T>
{
private EjbMetaData<T> ejbMetaData;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/JMSConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/JMSConstructor.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/JMSConstructor.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -3,7 +3,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.util.JNDI;
-public class JMSConstructor<T> implements ComponentConstructor<T>
+public class JMSConstructor<T> implements BeanConstructor<T>
{
Class<? extends T> type;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/MethodConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/MethodConstructor.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/MethodConstructor.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -5,7 +5,7 @@
import org.jboss.webbeans.ManagerImpl;
public class MethodConstructor<T> extends InjectableMethod<T> implements
- ComponentConstructor<T>
+ BeanConstructor<T>
{
public MethodConstructor(Method method)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/SimpleConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/SimpleConstructor.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injectable/SimpleConstructor.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -9,10 +9,10 @@
import org.jboss.webbeans.introspector.SimpleAnnotatedConstructor;
import org.jboss.webbeans.util.LoggerUtil;
-public class SimpleConstructor<T> extends Unit<T, Constructor<T>> implements ComponentConstructor<T>
+public class SimpleConstructor<T> extends Unit<T, Constructor<T>> implements BeanConstructor<T>
{
- public static final String LOGGER_NAME = "componentConstructor";
+ public static final String LOGGER_NAME = "beanConstructor";
private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,149 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.util.logging.Logger;
-
-import javax.webbeans.BindingType;
-
-import org.jboss.webbeans.ManagerImpl;
-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, Class<T>>
-{
-
- private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
-
- private AnnotatedType<T> annotatedItem;
- private AnnotatedType<T> xmlAnnotatedItem;
-
- /**
- *
- * @param annotatedItem Annotations read from java classes
- * @param xmlAnnotatedItem Annotations read from XML
- * @param manager
- */
- public AbstractClassComponentModel(AnnotatedType<T> annotatedItem, AnnotatedType<T> xmlAnnotatedItem)
- {
- 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.annotatedItem = annotatedItem;
- this.xmlAnnotatedItem = xmlAnnotatedItem;
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- checkRequiredTypesImplemented();
- checkScopeAllowed();
- // TODO This is too high
- checkComponentImplementation();
- // TODO Interceptors
- }
-
- @Override
- protected AnnotatedType<T> getAnnotatedItem()
- {
- return annotatedItem;
- }
-
- @Override
- protected AnnotatedType<T> getXmlAnnotatedItem()
- {
- return xmlAnnotatedItem;
- }
-
- protected void initType()
- {
- if (getAnnotatedItem().getDelegate() != null && getXmlAnnotatedItem().getDelegate() != null && !getAnnotatedItem().getDelegate().equals(getXmlAnnotatedItem().getDelegate()))
- {
- throw new IllegalArgumentException("Cannot build a component which specifies different classes in XML and Java");
- }
- else if (getXmlAnnotatedItem().getDelegate() != null)
- {
- log.finest("Component type specified in XML");
- this.type = getXmlAnnotatedItem().getDelegate();
- }
- else if (getAnnotatedItem().getDelegate() != null)
- {
- log.finest("Component type specified in Java");
- this.type = getAnnotatedItem().getDelegate();
- }
- else
- {
- throw new IllegalArgumentException("Cannot build a component which doesn't specify a type");
- }
- }
-
- @Override
- protected void initInjectionPoints()
- {
- super.initInjectionPoints();
- annotatedItem.getMetaAnnotatedFields(BindingType.class);
- }
-
- @Override
- protected String getDefaultName()
- {
- String name = Strings.decapitalize(getType().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 void checkRequiredTypesImplemented()
- {
- for (Class<?> requiredType : getMergedStereotypes().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 void checkScopeAllowed()
- {
- log.finest("Checking if " + getScopeType() + " is allowed for " + type);
- if (getMergedStereotypes().getSupportedScopes().size() > 0)
- {
- if (!getMergedStereotypes().getSupportedScopes().contains(getScopeType()))
- {
- throw new RuntimeException("Scope " + getScopeType() + " is not an allowed by the stereotype for " + type);
- }
- }
- }
-
- protected void checkComponentImplementation()
- {
- if (Reflections.isAbstract(getType()))
- {
- throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
- }
- }
-
-}
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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,332 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
-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.Named;
-import javax.webbeans.Production;
-import javax.webbeans.ScopeType;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.injectable.Injectable;
-import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.injectable.InjectableParameter;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.util.LoggerUtil;
-
-public abstract class AbstractComponentModel<T, E>
-{
-
- public static final String LOGGER_NAME = "componentModel";
-
- private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
-
- private Set<Annotation> bindingTypes;
- protected String name;
- protected Class<? extends Annotation> scopeType;
- private MergedStereotypesModel<T, E> mergedStereotypes;
- protected Class<? extends Annotation> deploymentType;
- protected Class<? extends T> type;
- protected InjectableMethod<?> removeMethod;
- private Set<Class<?>> apiTypes;
- protected Set<Injectable<?, ?>> injectionPoints;
-
- protected void init(ManagerImpl container)
- {
- mergedStereotypes = new MergedStereotypesModel<T, E>(getAnnotatedItem(), getXmlAnnotatedItem(), container);
- initType();
- log.fine("Building Web Bean component metadata for " + getType());
- initBindingTypes();
- initName();
- initDeploymentType(container);
- checkDeploymentType();
- initScopeType();
- initApiTypes();
- }
-
- protected void initInjectionPoints()
- {
- injectionPoints = new HashSet<Injectable<?,?>>();
- if (removeMethod != null)
- {
- for (InjectableParameter<?> injectable : removeMethod.getParameters())
- {
- injectionPoints.add(injectable);
- }
- }
- }
-
- protected abstract void initType();
-
- protected void initApiTypes()
- {
- apiTypes = getTypeHierachy(getType());
- }
-
- protected Set<Class<?>> getTypeHierachy(Class<?> clazz)
- {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- if (!(clazz == null || clazz == Object.class))
- {
- classes.add(clazz);
- classes.addAll(getTypeHierachy(clazz.getSuperclass()));
- for (Class<?> c : clazz.getInterfaces())
- {
- classes.addAll(getTypeHierachy(c));
- }
- }
- return classes;
- }
-
- protected abstract AnnotatedItem<T, E> getAnnotatedItem();
-
- protected abstract AnnotatedItem<T, E> getXmlAnnotatedItem();
-
- protected void initBindingTypes()
- {
- Set<Annotation> xmlBindingTypes = getXmlAnnotatedItem().getAnnotations(BindingType.class);
- if (xmlBindingTypes.size() > 0)
- {
- // TODO support producer expression default binding type
- log.finest("Using binding types " + xmlBindingTypes + " specified in XML");
- this.bindingTypes= xmlBindingTypes;
- return;
- }
- else
- {
- Set<Annotation> bindingTypes = getAnnotatedItem().getAnnotations(BindingType.class);
-
- if (bindingTypes.size() == 0)
- {
- log.finest("Adding default @Current binding type");
- bindingTypes.add(new CurrentAnnotationLiteral());
- }
- else
- {
- log.finest("Using binding types " + bindingTypes + " specified by annotations");
- }
- this.bindingTypes = bindingTypes;
- return;
- }
- }
-
- /**
- * Return the scope of the component
- */
- protected void initScopeType()
- {
- Set<Annotation> xmlScopes = getXmlAnnotatedItem().getAnnotations(ScopeType.class);
- if (xmlScopes.size() > 1)
- {
- throw new RuntimeException("At most one scope may be specified in XML");
- }
-
- if (xmlScopes.size() == 1)
- {
- this.scopeType = xmlScopes.iterator().next().annotationType();
- log.finest("Scope " + scopeType + " specified in XML");
- return;
- }
-
- Set<Annotation> scopes = getAnnotatedItem().getAnnotations(ScopeType.class);
- if (scopes.size() > 1)
- {
- throw new RuntimeException("At most one scope may be specified");
- }
-
- if (scopes.size() == 1)
- {
- this.scopeType = scopes.iterator().next().annotationType();
- log.finest("Scope " + scopeType + " specified b annotation");
- return;
- }
-
- if (getMergedStereotypes().getPossibleScopeTypes().size() == 1)
- {
- this.scopeType = getMergedStereotypes().getPossibleScopeTypes().iterator().next().annotationType();
- log.finest("Scope " + scopeType + " specified by stereotype");
- return;
- }
- else if (getMergedStereotypes().getPossibleScopeTypes().size() > 1)
- {
- throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the component");
- }
- this.scopeType = Dependent.class;
- log.finest("Using default @Dependent scope");
- }
-
- protected void initName()
- {
- boolean componentNameDefaulted = false;
- if (getXmlAnnotatedItem().isAnnotationPresent(Named.class))
- {
- String xmlName = getXmlAnnotatedItem().getAnnotation(Named.class).value();
- if ("".equals(xmlName))
- {
- log.finest("Using default name (specified in XML)");
- componentNameDefaulted = true;
- }
- else
- {
- log.finest("Using name " + xmlName + " specified in XML");
- this.name = xmlName;
- return;
- }
- }
- else if (getAnnotatedItem().isAnnotationPresent(Named.class))
- {
- String javaName = getAnnotatedItem().getAnnotation(Named.class).value();
- if ("".equals(javaName))
- {
- log.finest("Using default name (specified by annotations)");
- componentNameDefaulted = true;
- }
- else
- {
- log.finest("Using name " + javaName + " specified in XML");
- this.name = javaName;
- return;
- }
- }
- if (componentNameDefaulted || getMergedStereotypes().isComponentNameDefaulted())
- {
- this.name = getDefaultName();
- return;
- }
- }
-
- protected void initDeploymentType(ManagerImpl container)
- {
- Set<Annotation> xmlDeploymentTypes = getXmlAnnotatedItem().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)
- {
- this.deploymentType = xmlDeploymentTypes.iterator().next().annotationType();
- log.finest("Deployment type " + deploymentType + " specified in XML");
- return;
- }
-
-
- Set<Annotation> deploymentTypes = getAnnotatedItem().getAnnotations(DeploymentType.class);
-
- if (deploymentTypes.size() > 1)
- {
- throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().getDelegate());
- }
- if (deploymentTypes.size() == 1)
- {
- this.deploymentType = deploymentTypes.iterator().next().annotationType();
- log.finest("Deployment type " + deploymentType + " specified by annotation");
- return;
- }
-
- if (getMergedStereotypes().getPossibleDeploymentTypes().size() > 0)
- {
- this.deploymentType = getDeploymentType(container.getEnabledDeploymentTypes(), getMergedStereotypes().getPossibleDeploymentTypes());
- log.finest("Deployment type " + deploymentType + " specified by stereotype");
- return;
- }
-
- if (getXmlAnnotatedItem().getDelegate() != null)
- {
- this.deploymentType = Production.class;
- log.finest("Using default @Production deployment type");
- return;
- }
- }
-
- protected void checkDeploymentType()
- {
- if (deploymentType == null)
- {
- throw new RuntimeException("type: " + getType() + " must specify a deployment type");
- }
- }
-
- public static Class<? extends Annotation> getDeploymentType(List<Class<? extends Annotation>> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
- {
- for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
- {
- if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i))))
- {
- return enabledDeploymentTypes.get(i);
- }
- }
- return null;
- }
-
- protected MergedStereotypesModel<T, E> getMergedStereotypes()
- {
- return mergedStereotypes;
- }
-
- protected abstract String getDefaultName();
-
- public Set<Annotation> getBindingTypes()
- {
- return bindingTypes;
- }
-
- public Class<? extends Annotation> getScopeType()
- {
- return scopeType;
- }
-
- public Class<? extends T> getType()
- {
- return type;
- }
-
- public Set<Class<?>> getApiTypes()
- {
- return apiTypes;
- }
-
- public abstract ComponentConstructor<T> getConstructor();
-
- /**
- * Convenience method that return's the component's "location" for logging
- * and exception throwing
- */
- public abstract String getLocation();
-
- public Class<? extends Annotation> getDeploymentType()
- {
- return deploymentType;
- }
-
- public String getName()
- {
- return name;
- }
-
- public InjectableMethod<?> getRemoveMethod()
- {
- return removeMethod;
- }
-
- public Set<Injectable<?, ?>> getInjectionPoints()
- {
- return injectionPoints;
- }
-
- public boolean isAssignableFrom(AnnotatedItem<?, ?> annotatedItem)
- {
- return this.getAnnotatedItem().isAssignableFrom(annotatedItem);
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractEnterpriseComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractEnterpriseComponentModel.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractEnterpriseComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,52 +0,0 @@
-package org.jboss.webbeans.model;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.Dependent;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.introspector.AnnotatedType;
-
-public abstract class AbstractEnterpriseComponentModel<T> extends
- AbstractClassComponentModel<T>
-{
-
- private EjbMetaData<T> ejbMetaData;
-
- public AbstractEnterpriseComponentModel(AnnotatedType<T> annotatedItem,
- AnnotatedType<T> xmlAnnotatedItem)
- {
- super(annotatedItem, xmlAnnotatedItem);
-
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- ejbMetaData = container.getEjbManager().getEjbMetaData(getType());
- checkEnterpriseScopeAllowed();
- }
-
- protected EjbMetaData<T> getEjbMetaData()
- {
- return ejbMetaData;
- }
-
- /**
- * Check that the scope type is allowed by the stereotypes on the component and the component type
- * @param type
- */
- protected void checkEnterpriseScopeAllowed()
- {
- if (getEjbMetaData().isStateless() && !getScopeType().equals(Dependent.class))
- {
- throw new RuntimeException("Scope " + getScopeType() + " is not allowed on stateless enterpise bean components for " + getType() + ". Only @Dependent is allowed on stateless enterprise bean components");
- }
- if (getEjbMetaData().isSingleton() && (!getScopeType().equals(Dependent.class) || !getScopeType().equals(ApplicationScoped.class)))
- {
- throw new RuntimeException("Scope " + getScopeType() + " is not allowed on singleton enterpise bean components for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise bean components");
- }
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractProducerComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractProducerComponentModel.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractProducerComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.reflect.Method;
-
-public abstract class AbstractProducerComponentModel<T> extends
- AbstractComponentModel<T, Method>
-{
-
-
-}
\ No newline at end of file
Deleted: 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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,121 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.webbeans.Destructor;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.injectable.EnterpriseConstructor;
-import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.injectable.InjectableParameter;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.util.Reflections;
-
-public class EnterpriseComponentModel<T> extends AbstractEnterpriseComponentModel<T>
-{
-
- private EnterpriseConstructor<T> constructor;
-
- private String location;
-
- public EnterpriseComponentModel(AnnotatedType<T> annotatedItem,
- AnnotatedType<T> xmlAnnotatedItem, ManagerImpl container)
- {
- super(annotatedItem, xmlAnnotatedItem);
- init(container);
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- this.constructor = new EnterpriseConstructor<T>(getEjbMetaData());
- initRemoveMethod(container);
- initInjectionPoints();
- }
-
- @Override
- protected void initInjectionPoints()
- {
- super.initInjectionPoints();
- if (removeMethod != null)
- {
- for (InjectableParameter<?> injectable : removeMethod.getParameters())
- {
- injectionPoints.add(injectable);
- }
- }
- }
-
- public ComponentConstructor<T> getConstructor()
- {
- return constructor;
- }
-
- @Override
- public String toString()
- {
- return "EnterpriseComponentModel[" + getType().getName() + "]";
- }
-
- @Override
- public String getLocation()
- {
- if (location == null)
- {
- location = "type: Enterprise Component; declaring class: " + getType() +";";
- }
- return location;
- }
-
-// TODO loggigng
- protected void initRemoveMethod(ManagerImpl container)
- {
- if (getEjbMetaData().isStateful())
- {
- if (getEjbMetaData().getRemoveMethods().size() == 1)
- {
- super.removeMethod = new InjectableMethod<Object>(getEjbMetaData().getRemoveMethods().get(0));
- }
- else if (getEjbMetaData().getRemoveMethods().size() > 1)
- {
- List<Method> possibleRemoveMethods = new ArrayList<Method>();
- for (Method removeMethod : getEjbMetaData().getRemoveMethods())
- {
- if (removeMethod.isAnnotationPresent(Destructor.class))
- {
- possibleRemoveMethods.add(removeMethod);
- }
- }
- if (possibleRemoveMethods.size() == 1)
- {
- super.removeMethod = new InjectableMethod<Object>(possibleRemoveMethods.get(0));
- }
- else if (possibleRemoveMethods.size() > 1)
- {
- throw new RuntimeException("Multiple remove methods are annotated @Destroys for " + getType());
- }
- else if (possibleRemoveMethods.size() == 0)
- {
- throw new RuntimeException("Multiple remove methods are declared, and none are annotated @Destroys for " + getType());
- }
- }
- else if (getEjbMetaData().getRemoveMethods().size() == 0)
- {
- throw new RuntimeException("Stateful enterprise bean component has no remove methods declared for " + getType());
- }
- }
- else
- {
- List<Method> destroysMethods = Reflections.getMethods(getType(), Destructor.class);
- if (destroysMethods.size() > 0)
- {
- throw new RuntimeException("Only stateful enterprise bean components can have methods annotated @Destroys; " + getType() + " is not a stateful enterprise bean component");
- }
- }
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,146 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.util.logging.Logger;
-
-import javax.webbeans.Dependent;
-import javax.webbeans.Standard;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.SimpleAnnotatedField;
-import org.jboss.webbeans.util.LoggerUtil;
-
-/**
- * Web Beans component meta model for the container instantiated, injectable,
- * observable events (Section 7.4).
- *
- * @author David Allen
- *
- */
-public class EventComponentModel<T> extends AbstractComponentModel<T, Field>
-{
- private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
-
- private String location;
- private SimpleAnnotatedField<T> annotatedItem;
- private SimpleAnnotatedField<T> xmlAnnotatedItem;
- private ComponentConstructor<T> constructor;
-
- public EventComponentModel(SimpleAnnotatedField<T> annotatedItem, SimpleAnnotatedField<T> xmlAnnotatedItem, ManagerImpl manager)
- {
- this.annotatedItem = annotatedItem;
- this.xmlAnnotatedItem = xmlAnnotatedItem;
- this.init(manager);
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- this.initConstructor();
- }
-
- /**
- * Initializes the constructor field of this class.
- */
- protected void initConstructor()
- {
- // There should only be one constructor for the event implementation used here
- // TODO Probably don't need to use reflection as this is a container supplied class
- Constructor<T> classConstructor = this.annotatedItem.getType().getConstructors()[0];
- constructor = new SimpleConstructor<T>(classConstructor);
- }
-
- @Override
- public ComponentConstructor<T> getConstructor()
- {
- return constructor;
- }
-
- @Override
- public String getLocation()
- {
- if (location == null)
- {
- location = "type: Event Component;";
- }
- return location;
- }
-
- @Override
- public String toString()
- {
- return "EventComponentModel[" + getType().getName() + "]";
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.model.AbstractClassComponentModel#initType()
- */
- @Override
- protected void initType()
- {
- if (getXmlAnnotatedItem().getDelegate() != null)
- {
- log.finest("Component type specified in XML");
- this.type = xmlAnnotatedItem.getType();
- } else if (getAnnotatedItem().getDelegate() != null)
- {
- log.finest("Component type specified in Java");
- this.type = annotatedItem.getType();
- }
- }
-
- @Override
- protected AnnotatedItem<T, Field> getAnnotatedItem()
- {
- return this.annotatedItem;
- }
-
- @Override
- protected String getDefaultName()
- {
- // No name per 7.4
- return null;
- }
-
- @Override
- protected AnnotatedItem<T, Field> getXmlAnnotatedItem()
- {
- return this.xmlAnnotatedItem;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.model.AbstractComponentModel#initDeploymentType(org.jboss.webbeans.ManagerImpl)
- */
- @Override
- protected void initDeploymentType(ManagerImpl container)
- {
- // This is always @Standard per 7.4
- this.deploymentType = Standard.class;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.model.AbstractComponentModel#initName()
- */
- @Override
- protected void initName()
- {
- // No name per 7.4
- this.name = null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.model.AbstractComponentModel#initScopeType()
- */
- @Override
- protected void initScopeType()
- {
- // This is always @Dependent per 7.4
- this.scopeType = Dependent.class;
- }
-
-}
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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -12,7 +12,7 @@
import org.jboss.webbeans.introspector.AnnotatedItem;
/**
- * Meta model for the merged stereotype for a component
+ * Meta model for the merged stereotype for a bean
* @author pmuir
*
*/
@@ -21,7 +21,7 @@
private Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes;
private Set<Annotation> possibleScopeTypes;
- private boolean componentNameDefaulted;
+ private boolean beanNameDefaulted;
private Set<Class<?>> requiredTypes;
private Set<Class<? extends Annotation>> supportedScopes;
@@ -55,9 +55,9 @@
}
requiredTypes.addAll(stereotype.getRequiredTypes());
supportedScopes.addAll(stereotype.getSupportedScopes());
- if (stereotype.isComponentNameDefaulted())
+ if (stereotype.isBeanNameDefaulted())
{
- componentNameDefaulted = true;
+ beanNameDefaulted = true;
}
}
}
@@ -72,9 +72,9 @@
return possibleScopeTypes;
}
- public boolean isComponentNameDefaulted()
+ public boolean isBeanNameDefaulted()
{
- return componentNameDefaulted;
+ return beanNameDefaulted;
}
public Set<Class<?>> getRequiredTypes()
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerExpressionComponent.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerExpressionComponent.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerExpressionComponent.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,90 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-
-import javax.webbeans.Dependent;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.SimpleAnnotatedItem;
-
-public class ProducerExpressionComponent<T> extends AbstractProducerComponentModel<T>
-{
-
- private AnnotatedItem<T, Method> xmlAnnotatedItem;
- private AnnotatedItem<T, Method> annotatedItem = new SimpleAnnotatedItem<T, Method>(new HashMap<Class<? extends Annotation>, Annotation>());
- private String location;
-
- public ProducerExpressionComponent(AnnotatedItem<T, Method> xmlAnnotatedMethod, ManagerImpl container)
- {
- this.xmlAnnotatedItem = xmlAnnotatedMethod;
- init(container);
- }
-
- protected void checkApiType()
- {
- if (!getScopeType().equals(Dependent.class))
- {
- if (Modifier.isFinal(getType().getModifiers()))
- {
- throw new RuntimeException(getLocation() + "Final producer method must have @Dependent scope");
- }
- }
-
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- initInjectionPoints();
- }
-
-
- @Override
- protected AnnotatedItem<T, Method> getAnnotatedItem()
- {
- return annotatedItem;
- }
-
- @Override
- public ComponentConstructor<T> getConstructor()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected String getDefaultName()
- {
- throw new RuntimeException(getLocation() + " Cannot set a default name on producer expressions");
- }
-
- @Override
- public String getLocation()
- {
- if (location == null)
- {
- location = "type: Producer Expression; declaring document: TODO;";
- }
- return location;
- }
-
- @Override
- protected AnnotatedItem<T, Method> getXmlAnnotatedItem()
- {
- return xmlAnnotatedItem;
- }
-
- @Override
- protected void initType()
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted: 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 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,204 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.Set;
-
-import javax.webbeans.Dependent;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.injectable.InjectableParameter;
-import org.jboss.webbeans.injectable.MethodConstructor;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.SimpleAnnotatedItem;
-import org.jboss.webbeans.util.Reflections;
-
-public class ProducerMethodComponentModel<T> extends AbstractProducerComponentModel<T>
-{
-
- private MethodConstructor<T> constructor;
-
- private AnnotatedItem<T, Method> xmlAnnotatedItem = new SimpleAnnotatedItem<T, Method>(new HashMap<Class<? extends Annotation>, Annotation>());
- private AnnotatedMethod<T> annotatedMethod;
-
- private AbstractComponentModel<?, ?> declaringComponent;
-
- // Cached values
- private String location;
- private Type declaredComponentType;
-
- public ProducerMethodComponentModel(AnnotatedMethod<T> annotatedMethod, ManagerImpl container)
- {
- this.annotatedMethod = annotatedMethod;
- init(container);
- }
-
- @Override
- protected void init(ManagerImpl manager)
- {
- super.init(manager);
- checkProducerMethod();
- this.constructor = new MethodConstructor<T>(getAnnotatedItem().getDelegate());
- initRemoveMethod(manager);
- initInjectionPoints();
- }
-
- @Override
- protected void initInjectionPoints()
- {
- super.initInjectionPoints();
- for (InjectableParameter<?> injectable : constructor.getParameters())
- {
- injectionPoints.add(injectable);
- }
- if (removeMethod != null)
- {
- for (InjectableParameter<?> injectable : removeMethod.getParameters())
- {
- injectionPoints.add(injectable);
- }
- }
- }
-
- @Override
- protected void initDeploymentType(ManagerImpl container)
- {
- super.initDeploymentType(container);
- if (getDeploymentType() == null)
- {
- if (getDeclaringComponent() == null)
- {
- initDeclaringComponent(container);
- }
- deploymentType = declaringComponent.getDeploymentType();
- }
- }
-
- protected void initDeclaringComponent(ManagerImpl container)
- {
- declaringComponent = container.getModelManager().getComponentModel(getAnnotatedItem().getDelegate().getDeclaringClass());
- }
-
- @Override
- public ComponentConstructor<T> getConstructor()
- {
- return constructor;
- }
-
- protected void checkProducerMethod()
- {
- if (Modifier.isStatic(getAnnotatedItem().getDelegate().getModifiers()))
- {
- throw new RuntimeException("Producer method cannot be static " + annotatedMethod);
- }
- // TODO Check if declaring class is a WB component
- if (!getScopeType().equals(Dependent.class) && Modifier.isFinal(getAnnotatedItem().getDelegate().getModifiers()))
- {
- throw new RuntimeException("Final producer method must have @Dependent scope " + annotatedMethod);
- }
- }
-
- protected void initRemoveMethod(ManagerImpl container)
- {
- Set<Method> disposalMethods = container.resolveDisposalMethods(getType(), getBindingTypes().toArray(new Annotation[0]));
- if (disposalMethods.size() == 1)
- {
- removeMethod = new InjectableMethod<Object>(disposalMethods.iterator().next());
- }
- else if (disposalMethods.size() > 1)
- {
- // TODO List out found disposal methods
- throw new RuntimeException(getLocation() + "Cannot declare multiple disposal methods for this producer method");
- }
- }
-
- @Override
- public String toString()
- {
- return "ProducerMethodComponentModel[" + getType().getName() + "]";
- }
-
- @Override
- protected AnnotatedMethod<T> getAnnotatedItem()
- {
- return annotatedMethod;
- }
-
- @Override
- protected String getDefaultName()
- {
- String propertyName = Reflections.getPropertyName(getAnnotatedItem().getDelegate());
- if (propertyName != null)
- {
- return propertyName;
- }
- else
- {
- return getAnnotatedItem().getDelegate().getName();
- }
- }
-
- @Override
- protected AnnotatedItem<T, Method> getXmlAnnotatedItem()
- {
- return xmlAnnotatedItem;
- }
-
- @Override
- protected void initType()
- {
- try
- {
- this.type = annotatedMethod.getType();
- }
- catch (ClassCastException e)
- {
- throw new RuntimeException(getLocation() + " Cannot cast producer method return type " + annotatedMethod.getAnnotatedMethod().getReturnType() + " to component type " + (getDeclaredComponentType() == null ? " unknown " : getDeclaredComponentType()), e);
- }
- }
-
- private Type getDeclaredComponentType()
- {
- if (declaredComponentType == null)
- {
- Type type = getClass();
- if (type instanceof ParameterizedType)
- {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- if (parameterizedType.getActualTypeArguments().length == 1)
- {
- declaredComponentType = parameterizedType.getActualTypeArguments()[0];
- }
- }
- }
- return declaredComponentType;
- }
-
- @Override
- public String getLocation()
- {
- if (location == null)
- {
- location = "type: Producer Method; declaring class: " + annotatedMethod.getAnnotatedMethod().getDeclaringClass() +"; producer method: " + annotatedMethod.getAnnotatedMethod().toString() + ";";
- }
- return location;
- }
-
- public InjectableMethod<?> getDisposalMethod()
- {
- return removeMethod;
- }
-
- public AbstractComponentModel<?, ?> getDeclaringComponent()
- {
- return declaringComponent;
- }
-
-}
Deleted: 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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,129 +0,0 @@
-package org.jboss.webbeans.model;
-
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.introspector.AnnotatedType;
-
-public class RemoteComponentModel<T> extends AbstractEnterpriseComponentModel<T>
-{
-
- public RemoteComponentModel(AnnotatedType<T> annotatedItem,
- AnnotatedType<T> xmlAnnotatedItem)
- {
- super(annotatedItem, xmlAnnotatedItem);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public ComponentConstructor<T> getConstructor()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getLocation()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*private EnterpriseConstructor<T> constructor;
- private String boundTo;
- private String location;
-
- public RemoteComponentModel(AnnotatedType annotatedItem,
- AnnotatedType xmlAnnotatedItem, ManagerImpl container)
- {
- super(annotatedItem, xmlAnnotatedItem);
- init(container);
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- // TODO initialize constructor
- initBoundTo();
- initRemoveMethod();
- }
-
- protected void initRemoveMethod()
- {
- Set<Method> destroyMethods = new HashSet<Method>();
- for (Method method : getAnnotatedItem().getDelegate().getMethods())
- {
- if (method.isAnnotationPresent(Destroys.class))
- {
- destroyMethods.add(method);
- }
- }
- if (destroyMethods.size() == 1)
- {
- Method destroyMethod = destroyMethods.iterator().next();
- if (destroyMethod.getParameterTypes().length > 0)
- {
- throw new RuntimeException(getLocation() + " The method annotated @Destroys cannot take any parameters");
- }
- else
- {
- removeMethod = new InjectableMethod(destroyMethod);
- }
- }
- else if (destroyMethods.size() > 1)
- {
- // TODO Enumerate the destroy methods
- throw new RuntimeException(getLocation() + " There can only be a maximum of one method declared @Destorys");
- }
-
- }
-
- @Override
- protected void checkComponentImplementation()
- {
- // No - op for remote components
- // TODO THis is wrong probably
- }
-
- protected void initBoundTo()
- {
- if (getXmlAnnotatedItem().isAnnotationPresent(BoundTo.class))
- {
- this.boundTo = getXmlAnnotatedItem().getAnnotation(BoundTo.class).value();
- return;
- }
- if (getAnnotatedItem().isAnnotationPresent(BoundTo.class))
- {
- this.boundTo = getAnnotatedItem().getAnnotation(BoundTo.class).value();
- return;
- }
- throw new RuntimeException("Remote component doesn't specify @BoundTo or <bound-to /> for " + getType());
- }
-
- public ComponentConstructor<T> getConstructor()
- {
- return constructor;
- }
-
-
- public String getBoundTo()
- {
- return boundTo;
- }
-
- @Override
- public String toString()
- {
- return "RemoteComponentModel[" + getType().getName() + "]";
- }
-
- @Override
- public String getLocation()
- {
- if (location == null)
- {
- location = "type: Remote Enterprise Component; declaring class: " + getType() +";";
- }
- return location;
- }*/
-
-}
Deleted: 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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -1,147 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-import java.util.logging.Logger;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.Initializer;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.injectable.InjectableParameter;
-import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.util.LoggerUtil;
-import org.jboss.webbeans.util.Reflections;
-
-public class SimpleComponentModel<T> extends AbstractClassComponentModel<T>
-{
-
- private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
-
- private SimpleConstructor<T> constructor;
-
- private String location;
-
- /**
- *
- * @param annotatedItem Annotations read from java classes
- * @param xmlAnnotatedItem Annotations read from XML
- * @param container
- */
- public SimpleComponentModel(AnnotatedType<T> annotatedItem, AnnotatedType<T> xmlAnnotatedItem, ManagerImpl container)
- {
- super(annotatedItem, xmlAnnotatedItem);
- init(container);
- }
-
- @Override
- protected void init(ManagerImpl container)
- {
- super.init(container);
- initConstructor();
- checkType(getType());
- initInjectionPoints();
- // TODO Interceptors
- }
-
- @Override
- protected void initInjectionPoints()
- {
- super.initInjectionPoints();
- for (InjectableParameter<?> injectable : constructor.getParameters())
- {
- injectionPoints.add(injectable);
- }
- }
-
- public static void checkType(Class<?> type)
- {
- if (type.isMemberClass())
- {
- throw new RuntimeException("Simple Web Bean " + type + " cannot be an inner class");
- }
- }
-
- protected void initConstructor()
- {
- if (getType().getConstructors().length == 1)
- {
- Constructor<T> constructor = (Constructor<T>) getType().getConstructors()[0];
- log.finest("Exactly one constructor (" + constructor +") defined, using it as the component constructor for " + getType());
- this.constructor = new SimpleConstructor<T>(constructor);
- return;
- }
-
- if (getType().getConstructors().length > 1)
- {
- List<Constructor<T>> initializerAnnotatedConstructors = Reflections.getConstructors(getType(), Initializer.class);
- List<Constructor<T>> bindingTypeAnnotatedConstructors = Reflections.getConstructorsForMetaAnnotatedParameter(getType(), BindingType.class);
- log.finest("Found " + initializerAnnotatedConstructors + " constructors annotated with @Initializer for " + getType());
- log.finest("Found " + bindingTypeAnnotatedConstructors + " with parameters annotated with binding types for " + getType());
- if ((initializerAnnotatedConstructors.size() + bindingTypeAnnotatedConstructors.size()) > 1)
- {
- if (initializerAnnotatedConstructors.size() > 1)
- {
- throw new RuntimeException("Cannot have more than one constructor annotated with @Initializer for " + getType());
- }
-
- else if (bindingTypeAnnotatedConstructors.size() > 1)
- {
- throw new RuntimeException("Cannot have more than one constructor with binding types specified on constructor parameters for " + getType());
- }
- else
- {
- throw new RuntimeException("Specify a constructor either annotated with @Initializer or with parameters annotated with binding types for " + getType());
- }
- }
- else if (initializerAnnotatedConstructors.size() == 1)
- {
- Constructor<T> constructor = initializerAnnotatedConstructors.get(0);
- log.finest("Exactly one constructor (" + constructor +") annotated with @Initializer defined, using it as the component constructor for " + getType());
- this.constructor = new SimpleConstructor<T>(constructor);
- return;
- }
- else if (bindingTypeAnnotatedConstructors.size() == 1)
- {
- Constructor<T> constructor = bindingTypeAnnotatedConstructors.get(0);
- log.finest("Exactly one constructor (" + constructor +") with parameters annotated with binding types defined, using it as the component constructor for " + getType());
- this.constructor = new SimpleConstructor<T>(constructor);
- return;
- }
- }
-
- if (getType().getConstructors().length == 0)
- {
- Constructor<T> constructor = (Constructor<T>) Reflections.getConstructor(getType());
- log.finest("No constructor defined, using implicit no arguement constructor for " + getType());
- this.constructor = new SimpleConstructor<T>(constructor);
- return;
- }
-
- throw new RuntimeException("Cannot determine constructor to use for " + getType());
- }
-
- public SimpleConstructor<T> getConstructor()
- {
- return constructor;
- }
-
-
- @Override
- public String toString()
- {
- return "SimpleWebBean[" + getAnnotatedItem().toString() + "]";
- }
-
- @Override
- public String getLocation()
- {
- if (location == null)
- {
- location = "type: Simple Component; declaring class: " + getType() +";";
- }
- return location;
- }
-
-}
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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -26,7 +26,7 @@
private Class<? extends Annotation> stereotypeClass;
private Annotation defaultDeploymentType;
private Annotation defaultScopeType;
- private boolean componentNameDefaulted;
+ private boolean beanNameDefaulted;
private Set<Class<? extends Annotation>> supportedScopes;
private Set<Class<?>> requiredTypes;
private Set<Annotation> interceptorBindings;
@@ -37,7 +37,7 @@
Stereotype stereotype = annotatedClass.getAnnotation(Stereotype.class);
initDefaultDeploymentType(annotatedClass);
initDefaultScopeType(annotatedClass);
- initComponentNameDefaulted(annotatedClass);
+ initBeanNameDefaulted(annotatedClass);
initSupportedScopes(annotatedClass, stereotype);
initRequiredTypes(annotatedClass, stereotype);
initInterceptorBindings(annotatedClass);
@@ -90,7 +90,7 @@
}
}
- private void initComponentNameDefaulted(AnnotatedType<T> annotatedElement)
+ private void initBeanNameDefaulted(AnnotatedType<T> annotatedElement)
{
if (annotatedElement.isAnnotationPresent(Named.class))
{
@@ -98,7 +98,7 @@
{
throw new RuntimeException("Cannot specify a value for a @Named stereotype " + annotatedElement);
}
- componentNameDefaulted = true;
+ beanNameDefaulted = true;
}
}
@@ -156,12 +156,12 @@
}
/**
- * Returns true if the stereotype specifies the component name should be
+ * Returns true if the stereotype specifies the bean name should be
* defaulted
*/
- public boolean isComponentNameDefaulted()
+ public boolean isBeanNameDefaulted()
{
- return componentNameDefaulted;
+ return beanNameDefaulted;
}
/**
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java (from rev 144, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,362 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
+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.Named;
+import javax.webbeans.Production;
+import javax.webbeans.ScopeType;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
+import org.jboss.webbeans.injectable.BeanConstructor;
+import org.jboss.webbeans.injectable.Injectable;
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.injectable.InjectableParameter;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.model.MergedStereotypesModel;
+import org.jboss.webbeans.util.LoggerUtil;
+
+public abstract class AbstractBeanModel<T, E> implements BeanModel<T, E>
+{
+
+ public static final String LOGGER_NAME = "beanModel";
+
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ private Set<Annotation> bindingTypes;
+ protected String name;
+ protected Class<? extends Annotation> scopeType;
+ private MergedStereotypesModel<T, E> mergedStereotypes;
+ protected Class<? extends Annotation> deploymentType;
+ protected Class<? extends T> type;
+ protected InjectableMethod<?> removeMethod;
+ private Set<Class<?>> apiTypes;
+ protected Set<Injectable<?, ?>> injectionPoints;
+
+ protected void init(ManagerImpl container)
+ {
+ mergedStereotypes = new MergedStereotypesModel<T, E>(getAnnotatedItem(), getXmlAnnotatedItem(), container);
+ initType();
+ log.fine("Building Web Bean bean metadata for " + getType());
+ initBindingTypes();
+ initName();
+ initDeploymentType(container);
+ checkDeploymentType();
+ initScopeType();
+ initApiTypes();
+ }
+
+ protected void initInjectionPoints()
+ {
+ injectionPoints = new HashSet<Injectable<?,?>>();
+ if (removeMethod != null)
+ {
+ for (InjectableParameter<?> injectable : removeMethod.getParameters())
+ {
+ injectionPoints.add(injectable);
+ }
+ }
+ }
+
+ protected abstract void initType();
+
+ protected void initApiTypes()
+ {
+ apiTypes = getTypeHierachy(getType());
+ }
+
+ protected Set<Class<?>> getTypeHierachy(Class<?> clazz)
+ {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ if (!(clazz == null || clazz == Object.class))
+ {
+ classes.add(clazz);
+ classes.addAll(getTypeHierachy(clazz.getSuperclass()));
+ for (Class<?> c : clazz.getInterfaces())
+ {
+ classes.addAll(getTypeHierachy(c));
+ }
+ }
+ return classes;
+ }
+
+ protected abstract AnnotatedItem<T, E> getAnnotatedItem();
+
+ protected abstract AnnotatedItem<T, E> getXmlAnnotatedItem();
+
+ protected void initBindingTypes()
+ {
+ Set<Annotation> xmlBindingTypes = getXmlAnnotatedItem().getAnnotations(BindingType.class);
+ if (xmlBindingTypes.size() > 0)
+ {
+ // TODO support producer expression default binding type
+ log.finest("Using binding types " + xmlBindingTypes + " specified in XML");
+ this.bindingTypes= xmlBindingTypes;
+ return;
+ }
+ else
+ {
+ Set<Annotation> bindingTypes = getAnnotatedItem().getAnnotations(BindingType.class);
+
+ if (bindingTypes.size() == 0)
+ {
+ log.finest("Adding default @Current binding type");
+ bindingTypes.add(new CurrentAnnotationLiteral());
+ }
+ else
+ {
+ log.finest("Using binding types " + bindingTypes + " specified by annotations");
+ }
+ this.bindingTypes = bindingTypes;
+ return;
+ }
+ }
+
+ /**
+ * Return the scope of the bean
+ */
+ protected void initScopeType()
+ {
+ Set<Annotation> xmlScopes = getXmlAnnotatedItem().getAnnotations(ScopeType.class);
+ if (xmlScopes.size() > 1)
+ {
+ throw new RuntimeException("At most one scope may be specified in XML");
+ }
+
+ if (xmlScopes.size() == 1)
+ {
+ this.scopeType = xmlScopes.iterator().next().annotationType();
+ log.finest("Scope " + scopeType + " specified in XML");
+ return;
+ }
+
+ Set<Annotation> scopes = getAnnotatedItem().getAnnotations(ScopeType.class);
+ if (scopes.size() > 1)
+ {
+ throw new RuntimeException("At most one scope may be specified");
+ }
+
+ if (scopes.size() == 1)
+ {
+ this.scopeType = scopes.iterator().next().annotationType();
+ log.finest("Scope " + scopeType + " specified b annotation");
+ return;
+ }
+
+ if (getMergedStereotypes().getPossibleScopeTypes().size() == 1)
+ {
+ this.scopeType = getMergedStereotypes().getPossibleScopeTypes().iterator().next().annotationType();
+ log.finest("Scope " + scopeType + " specified by stereotype");
+ return;
+ }
+ else if (getMergedStereotypes().getPossibleScopeTypes().size() > 1)
+ {
+ throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the bean");
+ }
+ this.scopeType = Dependent.class;
+ log.finest("Using default @Dependent scope");
+ }
+
+ protected void initName()
+ {
+ boolean beanNameDefaulted = false;
+ if (getXmlAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ String xmlName = getXmlAnnotatedItem().getAnnotation(Named.class).value();
+ if ("".equals(xmlName))
+ {
+ log.finest("Using default name (specified in XML)");
+ beanNameDefaulted = true;
+ }
+ else
+ {
+ log.finest("Using name " + xmlName + " specified in XML");
+ this.name = xmlName;
+ return;
+ }
+ }
+ else if (getAnnotatedItem().isAnnotationPresent(Named.class))
+ {
+ String javaName = getAnnotatedItem().getAnnotation(Named.class).value();
+ if ("".equals(javaName))
+ {
+ log.finest("Using default name (specified by annotations)");
+ beanNameDefaulted = true;
+ }
+ else
+ {
+ log.finest("Using name " + javaName + " specified in XML");
+ this.name = javaName;
+ return;
+ }
+ }
+ if (beanNameDefaulted || getMergedStereotypes().isBeanNameDefaulted())
+ {
+ this.name = getDefaultName();
+ return;
+ }
+ }
+
+ protected void initDeploymentType(ManagerImpl container)
+ {
+ Set<Annotation> xmlDeploymentTypes = getXmlAnnotatedItem().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)
+ {
+ this.deploymentType = xmlDeploymentTypes.iterator().next().annotationType();
+ log.finest("Deployment type " + deploymentType + " specified in XML");
+ return;
+ }
+
+
+ Set<Annotation> deploymentTypes = getAnnotatedItem().getAnnotations(DeploymentType.class);
+
+ if (deploymentTypes.size() > 1)
+ {
+ throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + getAnnotatedItem().getDelegate());
+ }
+ if (deploymentTypes.size() == 1)
+ {
+ this.deploymentType = deploymentTypes.iterator().next().annotationType();
+ log.finest("Deployment type " + deploymentType + " specified by annotation");
+ return;
+ }
+
+ if (getMergedStereotypes().getPossibleDeploymentTypes().size() > 0)
+ {
+ this.deploymentType = getDeploymentType(container.getEnabledDeploymentTypes(), getMergedStereotypes().getPossibleDeploymentTypes());
+ log.finest("Deployment type " + deploymentType + " specified by stereotype");
+ return;
+ }
+
+ if (getXmlAnnotatedItem().getDelegate() != null)
+ {
+ this.deploymentType = Production.class;
+ log.finest("Using default @Production deployment type");
+ return;
+ }
+ }
+
+ protected void checkDeploymentType()
+ {
+ if (deploymentType == null)
+ {
+ throw new RuntimeException("type: " + getType() + " must specify a deployment type");
+ }
+ }
+
+ public static Class<? extends Annotation> getDeploymentType(List<Class<? extends Annotation>> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
+ {
+ for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
+ {
+ if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i))))
+ {
+ return enabledDeploymentTypes.get(i);
+ }
+ }
+ return null;
+ }
+
+ protected MergedStereotypesModel<T, E> getMergedStereotypes()
+ {
+ return mergedStereotypes;
+ }
+
+ protected abstract String getDefaultName();
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getBindingTypes()
+ */
+ public Set<Annotation> getBindingTypes()
+ {
+ return bindingTypes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getScopeType()
+ */
+ public Class<? extends Annotation> getScopeType()
+ {
+ return scopeType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getType()
+ */
+ public Class<? extends T> getType()
+ {
+ return type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getApiTypes()
+ */
+ public Set<Class<?>> getApiTypes()
+ {
+ return apiTypes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getConstructor()
+ */
+ public abstract BeanConstructor<T> getConstructor();
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getLocation()
+ */
+ public abstract String getLocation();
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getDeploymentType()
+ */
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return deploymentType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getRemoveMethod()
+ */
+ public InjectableMethod<?> getRemoveMethod()
+ {
+ return removeMethod;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#getInjectionPoints()
+ */
+ public Set<Injectable<?, ?>> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.model.Model#isAssignableFrom(org.jboss.webbeans.introspector.AnnotatedItem)
+ */
+ public boolean isAssignableFrom(AnnotatedItem<?, ?> annotatedItem)
+ {
+ return this.getAnnotatedItem().isAssignableFrom(annotatedItem);
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java (from rev 148, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,149 @@
+package org.jboss.webbeans.model.bean;
+
+import java.util.logging.Logger;
+
+import javax.webbeans.BindingType;
+
+import org.jboss.webbeans.ManagerImpl;
+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 Bean meta model
+ *
+ * @author Pete Muir
+ *
+ */
+public abstract class AbstractClassBeanModel<T> extends AbstractBeanModel<T, Class<T>>
+{
+
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ private AnnotatedType<T> annotatedItem;
+ private AnnotatedType<T> xmlAnnotatedItem;
+
+ /**
+ *
+ * @param annotatedItem Annotations read from java classes
+ * @param xmlAnnotatedItem Annotations read from XML
+ * @param manager
+ */
+ public AbstractClassBeanModel(AnnotatedType<T> annotatedItem, AnnotatedType<T> xmlAnnotatedItem)
+ {
+ if (annotatedItem == null)
+ {
+ throw new NullPointerException("annotatedItem must not be null. If the bean is declared just in XML, pass in an empty annotatedItem");
+ }
+
+ if (xmlAnnotatedItem == null)
+ {
+ throw new NullPointerException("xmlAnnotatedItem must not be null. If the bean is declared just in Java, pass in an empty xmlAnnotatedItem");
+ }
+ this.annotatedItem = annotatedItem;
+ this.xmlAnnotatedItem = xmlAnnotatedItem;
+ }
+
+ @Override
+ protected void init(ManagerImpl container)
+ {
+ super.init(container);
+ checkRequiredTypesImplemented();
+ checkScopeAllowed();
+ // TODO This is too high
+ checkBeanImplementation();
+ // TODO Interceptors
+ }
+
+ @Override
+ protected AnnotatedType<T> getAnnotatedItem()
+ {
+ return annotatedItem;
+ }
+
+ @Override
+ protected AnnotatedType<T> getXmlAnnotatedItem()
+ {
+ return xmlAnnotatedItem;
+ }
+
+ protected void initType()
+ {
+ if (getAnnotatedItem().getDelegate() != null && getXmlAnnotatedItem().getDelegate() != null && !getAnnotatedItem().getDelegate().equals(getXmlAnnotatedItem().getDelegate()))
+ {
+ throw new IllegalArgumentException("Cannot build a bean which specifies different classes in XML and Java");
+ }
+ else if (getXmlAnnotatedItem().getDelegate() != null)
+ {
+ log.finest("Bean type specified in XML");
+ this.type = getXmlAnnotatedItem().getDelegate();
+ }
+ else if (getAnnotatedItem().getDelegate() != null)
+ {
+ log.finest("Bean type specified in Java");
+ this.type = getAnnotatedItem().getDelegate();
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot build a bean which doesn't specify a type");
+ }
+ }
+
+ @Override
+ protected void initInjectionPoints()
+ {
+ super.initInjectionPoints();
+ annotatedItem.getMetaAnnotatedFields(BindingType.class);
+ }
+
+ @Override
+ protected String getDefaultName()
+ {
+ String name = Strings.decapitalize(getType().getSimpleName());
+ log.finest("Default name of " + type + " is " + name );
+ return name;
+ }
+
+ /**
+ * Check that the types required by the stereotypes on the bean are implemented
+ */
+ protected void checkRequiredTypesImplemented()
+ {
+ for (Class<?> requiredType : getMergedStereotypes().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 bean and the bean type
+ * @param type
+ */
+ protected void checkScopeAllowed()
+ {
+ log.finest("Checking if " + getScopeType() + " is allowed for " + type);
+ if (getMergedStereotypes().getSupportedScopes().size() > 0)
+ {
+ if (!getMergedStereotypes().getSupportedScopes().contains(getScopeType()))
+ {
+ throw new RuntimeException("Scope " + getScopeType() + " is not an allowed by the stereotype for " + type);
+ }
+ }
+ }
+
+ protected void checkBeanImplementation()
+ {
+ if (Reflections.isAbstract(getType()))
+ {
+ throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
+ }
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractEnterpriseComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,52 @@
+package org.jboss.webbeans.model.bean;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.Dependent;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.ejb.EjbMetaData;
+import org.jboss.webbeans.introspector.AnnotatedType;
+
+public abstract class AbstractEnterpriseBeanModel<T> extends
+ AbstractClassBeanModel<T>
+{
+
+ private EjbMetaData<T> ejbMetaData;
+
+ public AbstractEnterpriseBeanModel(AnnotatedType<T> annotatedItem,
+ AnnotatedType<T> xmlAnnotatedItem)
+ {
+ super(annotatedItem, xmlAnnotatedItem);
+
+ }
+
+ @Override
+ protected void init(ManagerImpl container)
+ {
+ super.init(container);
+ ejbMetaData = container.getEjbManager().getEjbMetaData(getType());
+ checkEnterpriseScopeAllowed();
+ }
+
+ protected EjbMetaData<T> getEjbMetaData()
+ {
+ return ejbMetaData;
+ }
+
+ /**
+ * Check that the scope type is allowed by the stereotypes on the bean and the bean type
+ * @param type
+ */
+ protected void checkEnterpriseScopeAllowed()
+ {
+ if (getEjbMetaData().isStateless() && !getScopeType().equals(Dependent.class))
+ {
+ throw new RuntimeException("Scope " + getScopeType() + " is not allowed on stateless enterpise beans for " + getType() + ". Only @Dependent is allowed on stateless enterprise beans");
+ }
+ if (getEjbMetaData().isSingleton() && (!getScopeType().equals(Dependent.class) || !getScopeType().equals(ApplicationScoped.class)))
+ {
+ throw new RuntimeException("Scope " + getScopeType() + " is not allowed on singleton enterpise beans for " + getType() + ". Only @Dependent or @ApplicationScoped is allowed on singleton enterprise beans");
+ }
+ }
+
+}
\ No newline at end of file
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractProducerBeanModel.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractProducerComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractProducerBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractProducerBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.reflect.Method;
+
+public abstract class AbstractProducerBeanModel<T> extends
+ AbstractBeanModel<T, Method>
+{
+
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractProducerBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/BeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/BeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/BeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,40 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import org.jboss.webbeans.injectable.BeanConstructor;
+import org.jboss.webbeans.injectable.Injectable;
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+
+public interface BeanModel<T, E>
+{
+
+ public Set<Annotation> getBindingTypes();
+
+ public Class<? extends Annotation> getScopeType();
+
+ public Class<? extends T> getType();
+
+ public Set<Class<?>> getApiTypes();
+
+ public BeanConstructor<T> getConstructor();
+
+ /**
+ * Convenience method that return's the bean's "location" for logging
+ * and exception throwing
+ */
+ public String getLocation();
+
+ public Class<? extends Annotation> getDeploymentType();
+
+ public String getName();
+
+ public InjectableMethod<?> getRemoveMethod();
+
+ public Set<Injectable<?, ?>> getInjectionPoints();
+
+ public boolean isAssignableFrom(AnnotatedItem<?, ?> annotatedItem);
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/BeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,121 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.webbeans.Destructor;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injectable.BeanConstructor;
+import org.jboss.webbeans.injectable.EnterpriseConstructor;
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.injectable.InjectableParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.Reflections;
+
+public class EnterpriseBeanModel<T> extends AbstractEnterpriseBeanModel<T>
+{
+
+ private EnterpriseConstructor<T> constructor;
+
+ private String location;
+
+ public EnterpriseBeanModel(AnnotatedType<T> annotatedItem,
+ AnnotatedType<T> xmlAnnotatedItem, ManagerImpl container)
+ {
+ super(annotatedItem, xmlAnnotatedItem);
+ init(container);
+ }
+
+ @Override
+ protected void init(ManagerImpl container)
+ {
+ super.init(container);
+ this.constructor = new EnterpriseConstructor<T>(getEjbMetaData());
+ initRemoveMethod(container);
+ initInjectionPoints();
+ }
+
+ @Override
+ protected void initInjectionPoints()
+ {
+ super.initInjectionPoints();
+ if (removeMethod != null)
+ {
+ for (InjectableParameter<?> injectable : removeMethod.getParameters())
+ {
+ injectionPoints.add(injectable);
+ }
+ }
+ }
+
+ public BeanConstructor<T> getConstructor()
+ {
+ return constructor;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "EnterpriseBean[" + getType().getName() + "]";
+ }
+
+ @Override
+ public String getLocation()
+ {
+ if (location == null)
+ {
+ location = "type: Enterprise Bean; declaring class: " + getType() +";";
+ }
+ return location;
+ }
+
+// TODO loggigng
+ protected void initRemoveMethod(ManagerImpl container)
+ {
+ if (getEjbMetaData().isStateful())
+ {
+ if (getEjbMetaData().getRemoveMethods().size() == 1)
+ {
+ super.removeMethod = new InjectableMethod<Object>(getEjbMetaData().getRemoveMethods().get(0));
+ }
+ else if (getEjbMetaData().getRemoveMethods().size() > 1)
+ {
+ List<Method> possibleRemoveMethods = new ArrayList<Method>();
+ for (Method removeMethod : getEjbMetaData().getRemoveMethods())
+ {
+ if (removeMethod.isAnnotationPresent(Destructor.class))
+ {
+ possibleRemoveMethods.add(removeMethod);
+ }
+ }
+ if (possibleRemoveMethods.size() == 1)
+ {
+ super.removeMethod = new InjectableMethod<Object>(possibleRemoveMethods.get(0));
+ }
+ else if (possibleRemoveMethods.size() > 1)
+ {
+ throw new RuntimeException("Multiple remove methods are annotated @Destroys for " + getType());
+ }
+ else if (possibleRemoveMethods.size() == 0)
+ {
+ throw new RuntimeException("Multiple remove methods are declared, and none are annotated @Destroys for " + getType());
+ }
+ }
+ else if (getEjbMetaData().getRemoveMethods().size() == 0)
+ {
+ throw new RuntimeException("Stateful enterprise bean bean has no remove methods declared for " + getType());
+ }
+ }
+ else
+ {
+ List<Method> destroysMethods = Reflections.getMethods(getType(), Destructor.class);
+ if (destroysMethods.size() > 0)
+ {
+ throw new RuntimeException("Only stateful enterprise beans can have methods annotated @Destroys; " + getType() + " is not a stateful enterprise bean");
+ }
+ }
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,134 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.logging.Logger;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injectable.BeanConstructor;
+import org.jboss.webbeans.injectable.SimpleConstructor;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.SimpleAnnotatedField;
+import org.jboss.webbeans.util.LoggerUtil;
+
+/**
+ * Web Beans bean meta model for the container instantiated, injectable,
+ * observable events (Section 7.4).
+ *
+ * @author David Allen
+ *
+ */
+public class EventBeanModel<T> extends AbstractBeanModel<T, Field>
+{
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ private String location;
+ private SimpleAnnotatedField<T> annotatedItem;
+ private SimpleAnnotatedField<T> xmlAnnotatedItem;
+ private BeanConstructor<T> constructor;
+
+ public EventBeanModel(SimpleAnnotatedField<T> annotatedItem, SimpleAnnotatedField<T> xmlAnnotatedItem, ManagerImpl manager)
+ {
+ this.annotatedItem = annotatedItem;
+ this.xmlAnnotatedItem = xmlAnnotatedItem;
+ this.init(manager);
+ }
+
+ @Override
+ protected void init(ManagerImpl container)
+ {
+ super.init(container);
+ this.initConstructor();
+ }
+
+ /**
+ * Initializes the constructor field of this class.
+ */
+ protected void initConstructor()
+ {
+ // There should only be one constructor for the event implementation used here
+ // TODO Probably don't need to use reflection as this is a container supplied class
+ Constructor<T> classConstructor = this.annotatedItem.getType().getConstructors()[0];
+ constructor = new SimpleConstructor<T>(classConstructor);
+ }
+
+ @Override
+ public BeanConstructor<T> getConstructor()
+ {
+ return constructor;
+ }
+
+ @Override
+ public String getLocation()
+ {
+ if (location == null)
+ {
+ location = "type: Event Bean;";
+ }
+ return location;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "EventBean[" + getType().getName() + "]";
+ }
+
+ @Override
+ protected void initType()
+ {
+ if (getXmlAnnotatedItem().getDelegate() != null)
+ {
+ log.finest("Bean type specified in XML");
+ this.type = xmlAnnotatedItem.getType();
+ } else if (getAnnotatedItem().getDelegate() != null)
+ {
+ log.finest("Bean type specified in Java");
+ this.type = annotatedItem.getType();
+ }
+ }
+
+ @Override
+ protected AnnotatedItem<T, Field> getAnnotatedItem()
+ {
+ return this.annotatedItem;
+ }
+
+ @Override
+ protected String getDefaultName()
+ {
+ // No name per 7.4
+ return null;
+ }
+
+ @Override
+ protected AnnotatedItem<T, Field> getXmlAnnotatedItem()
+ {
+ return this.xmlAnnotatedItem;
+ }
+
+ @Override
+ protected void initDeploymentType(ManagerImpl container)
+ {
+ // This is always @Standard per 7.4
+ this.deploymentType = Standard.class;
+ }
+
+ @Override
+ protected void initName()
+ {
+ // No name per 7.4
+ this.name = null;
+ }
+
+ @Override
+ protected void initScopeType()
+ {
+ // This is always @Dependent per 7.4
+ this.scopeType = Dependent.class;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerExpressionBeanModel.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerExpressionComponent.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerExpressionBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerExpressionBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,90 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+
+import javax.webbeans.Dependent;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injectable.BeanConstructor;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.SimpleAnnotatedItem;
+
+public class ProducerExpressionBeanModel<T> extends AbstractProducerBeanModel<T>
+{
+
+ private AnnotatedItem<T, Method> xmlAnnotatedItem;
+ private AnnotatedItem<T, Method> annotatedItem = new SimpleAnnotatedItem<T, Method>(new HashMap<Class<? extends Annotation>, Annotation>());
+ private String location;
+
+ public ProducerExpressionBeanModel(AnnotatedItem<T, Method> xmlAnnotatedMethod, ManagerImpl container)
+ {
+ this.xmlAnnotatedItem = xmlAnnotatedMethod;
+ init(container);
+ }
+
+ protected void checkApiType()
+ {
+ if (!getScopeType().equals(Dependent.class))
+ {
+ if (Modifier.isFinal(getType().getModifiers()))
+ {
+ throw new RuntimeException(getLocation() + "Final producer method must have @Dependent scope");
+ }
+ }
+
+ }
+
+ @Override
+ protected void init(ManagerImpl container)
+ {
+ super.init(container);
+ initInjectionPoints();
+ }
+
+
+ @Override
+ protected AnnotatedItem<T, Method> getAnnotatedItem()
+ {
+ return annotatedItem;
+ }
+
+ @Override
+ public BeanConstructor<T> getConstructor()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected String getDefaultName()
+ {
+ throw new RuntimeException(getLocation() + " Cannot set a default name on producer expressions");
+ }
+
+ @Override
+ public String getLocation()
+ {
+ if (location == null)
+ {
+ location = "type: Producer Expression; declaring document: TODO;";
+ }
+ return location;
+ }
+
+ @Override
+ protected AnnotatedItem<T, Method> getXmlAnnotatedItem()
+ {
+ return xmlAnnotatedItem;
+ }
+
+ @Override
+ protected void initType()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerExpressionBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java (from rev 140, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,204 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Set;
+
+import javax.webbeans.Dependent;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injectable.BeanConstructor;
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.injectable.InjectableParameter;
+import org.jboss.webbeans.injectable.MethodConstructor;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.SimpleAnnotatedItem;
+import org.jboss.webbeans.util.Reflections;
+
+public class ProducerMethodBeanModel<T> extends AbstractProducerBeanModel<T>
+{
+
+ private MethodConstructor<T> constructor;
+
+ private AnnotatedItem<T, Method> xmlAnnotatedItem = new SimpleAnnotatedItem<T, Method>(new HashMap<Class<? extends Annotation>, Annotation>());
+ private AnnotatedMethod<T> annotatedMethod;
+
+ private BeanModel<?, ?> declaringBean;
+
+ // Cached values
+ private String location;
+ private Type declaredBeanType;
+
+ public ProducerMethodBeanModel(AnnotatedMethod<T> annotatedMethod, ManagerImpl container)
+ {
+ this.annotatedMethod = annotatedMethod;
+ init(container);
+ }
+
+ @Override
+ protected void init(ManagerImpl manager)
+ {
+ super.init(manager);
+ checkProducerMethod();
+ this.constructor = new MethodConstructor<T>(getAnnotatedItem().getDelegate());
+ initRemoveMethod(manager);
+ initInjectionPoints();
+ }
+
+ @Override
+ protected void initInjectionPoints()
+ {
+ super.initInjectionPoints();
+ for (InjectableParameter<?> injectable : constructor.getParameters())
+ {
+ injectionPoints.add(injectable);
+ }
+ if (removeMethod != null)
+ {
+ for (InjectableParameter<?> injectable : removeMethod.getParameters())
+ {
+ injectionPoints.add(injectable);
+ }
+ }
+ }
+
+ @Override
+ protected void initDeploymentType(ManagerImpl container)
+ {
+ super.initDeploymentType(container);
+ if (getDeploymentType() == null)
+ {
+ if (getDeclaringBean() == null)
+ {
+ initDeclaringBean(container);
+ }
+ deploymentType = declaringBean.getDeploymentType();
+ }
+ }
+
+ protected void initDeclaringBean(ManagerImpl container)
+ {
+ declaringBean = container.getModelManager().getBeanModel(getAnnotatedItem().getDelegate().getDeclaringClass());
+ }
+
+ @Override
+ public BeanConstructor<T> getConstructor()
+ {
+ return constructor;
+ }
+
+ protected void checkProducerMethod()
+ {
+ if (Modifier.isStatic(getAnnotatedItem().getDelegate().getModifiers()))
+ {
+ throw new RuntimeException("Producer method cannot be static " + annotatedMethod);
+ }
+ // TODO Check if declaring class is a WB bean
+ if (!getScopeType().equals(Dependent.class) && Modifier.isFinal(getAnnotatedItem().getDelegate().getModifiers()))
+ {
+ throw new RuntimeException("Final producer method must have @Dependent scope " + annotatedMethod);
+ }
+ }
+
+ protected void initRemoveMethod(ManagerImpl container)
+ {
+ Set<Method> disposalMethods = container.resolveDisposalMethods(getType(), getBindingTypes().toArray(new Annotation[0]));
+ if (disposalMethods.size() == 1)
+ {
+ removeMethod = new InjectableMethod<Object>(disposalMethods.iterator().next());
+ }
+ else if (disposalMethods.size() > 1)
+ {
+ // TODO List out found disposal methods
+ throw new RuntimeException(getLocation() + "Cannot declare multiple disposal methods for this producer method");
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ProducerMethodBean[" + getType().getName() + "]";
+ }
+
+ @Override
+ protected AnnotatedMethod<T> getAnnotatedItem()
+ {
+ return annotatedMethod;
+ }
+
+ @Override
+ protected String getDefaultName()
+ {
+ String propertyName = Reflections.getPropertyName(getAnnotatedItem().getDelegate());
+ if (propertyName != null)
+ {
+ return propertyName;
+ }
+ else
+ {
+ return getAnnotatedItem().getDelegate().getName();
+ }
+ }
+
+ @Override
+ protected AnnotatedItem<T, Method> getXmlAnnotatedItem()
+ {
+ return xmlAnnotatedItem;
+ }
+
+ @Override
+ protected void initType()
+ {
+ try
+ {
+ this.type = annotatedMethod.getType();
+ }
+ catch (ClassCastException e)
+ {
+ throw new RuntimeException(getLocation() + " Cannot cast producer method return type " + annotatedMethod.getAnnotatedMethod().getReturnType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
+ }
+ }
+
+ private Type getDeclaredBeanType()
+ {
+ if (declaredBeanType == null)
+ {
+ Type type = getClass();
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ if (parameterizedType.getActualTypeArguments().length == 1)
+ {
+ declaredBeanType = parameterizedType.getActualTypeArguments()[0];
+ }
+ }
+ }
+ return declaredBeanType;
+ }
+
+ @Override
+ public String getLocation()
+ {
+ if (location == null)
+ {
+ location = "type: Producer Method; declaring class: " + annotatedMethod.getAnnotatedMethod().getDeclaringClass() +"; producer method: " + annotatedMethod.getAnnotatedMethod().toString() + ";";
+ }
+ return location;
+ }
+
+ public InjectableMethod<?> getDisposalMethod()
+ {
+ return removeMethod;
+ }
+
+ public BeanModel<?, ?> getDeclaringBean()
+ {
+ return declaringBean;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java (from rev 144, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -0,0 +1,147 @@
+package org.jboss.webbeans.model.bean;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.webbeans.BindingType;
+import javax.webbeans.Initializer;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.injectable.InjectableParameter;
+import org.jboss.webbeans.injectable.SimpleConstructor;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.LoggerUtil;
+import org.jboss.webbeans.util.Reflections;
+
+public class SimpleBeanModel<T> extends AbstractClassBeanModel<T>
+{
+
+ private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+ private SimpleConstructor<T> constructor;
+
+ private String location;
+
+ /**
+ *
+ * @param annotatedItem Annotations read from java classes
+ * @param xmlAnnotatedItem Annotations read from XML
+ * @param container
+ */
+ public SimpleBeanModel(AnnotatedType<T> annotatedItem, AnnotatedType<T> xmlAnnotatedItem, ManagerImpl container)
+ {
+ super(annotatedItem, xmlAnnotatedItem);
+ init(container);
+ }
+
+ @Override
+ protected void init(ManagerImpl container)
+ {
+ super.init(container);
+ initConstructor();
+ checkType(getType());
+ initInjectionPoints();
+ // TODO Interceptors
+ }
+
+ @Override
+ protected void initInjectionPoints()
+ {
+ super.initInjectionPoints();
+ for (InjectableParameter<?> injectable : constructor.getParameters())
+ {
+ injectionPoints.add(injectable);
+ }
+ }
+
+ public static void checkType(Class<?> type)
+ {
+ if (type.isMemberClass())
+ {
+ throw new RuntimeException("Simple Web Bean " + type + " cannot be an inner class");
+ }
+ }
+
+ protected void initConstructor()
+ {
+ if (getType().getConstructors().length == 1)
+ {
+ Constructor<T> constructor = (Constructor<T>) getType().getConstructors()[0];
+ log.finest("Exactly one constructor (" + constructor +") defined, using it as the bean constructor for " + getType());
+ this.constructor = new SimpleConstructor<T>(constructor);
+ return;
+ }
+
+ if (getType().getConstructors().length > 1)
+ {
+ List<Constructor<T>> initializerAnnotatedConstructors = Reflections.getConstructors(getType(), Initializer.class);
+ List<Constructor<T>> bindingTypeAnnotatedConstructors = Reflections.getConstructorsForMetaAnnotatedParameter(getType(), BindingType.class);
+ log.finest("Found " + initializerAnnotatedConstructors + " constructors annotated with @Initializer for " + getType());
+ log.finest("Found " + bindingTypeAnnotatedConstructors + " with parameters annotated with binding types for " + getType());
+ if ((initializerAnnotatedConstructors.size() + bindingTypeAnnotatedConstructors.size()) > 1)
+ {
+ if (initializerAnnotatedConstructors.size() > 1)
+ {
+ throw new RuntimeException("Cannot have more than one constructor annotated with @Initializer for " + getType());
+ }
+
+ else if (bindingTypeAnnotatedConstructors.size() > 1)
+ {
+ throw new RuntimeException("Cannot have more than one constructor with binding types specified on constructor parameters for " + getType());
+ }
+ else
+ {
+ throw new RuntimeException("Specify a constructor either annotated with @Initializer or with parameters annotated with binding types for " + getType());
+ }
+ }
+ else if (initializerAnnotatedConstructors.size() == 1)
+ {
+ Constructor<T> constructor = initializerAnnotatedConstructors.get(0);
+ log.finest("Exactly one constructor (" + constructor +") annotated with @Initializer defined, using it as the bean constructor for " + getType());
+ this.constructor = new SimpleConstructor<T>(constructor);
+ return;
+ }
+ else if (bindingTypeAnnotatedConstructors.size() == 1)
+ {
+ Constructor<T> constructor = bindingTypeAnnotatedConstructors.get(0);
+ log.finest("Exactly one constructor (" + constructor +") with parameters annotated with binding types defined, using it as the bean constructor for " + getType());
+ this.constructor = new SimpleConstructor<T>(constructor);
+ return;
+ }
+ }
+
+ if (getType().getConstructors().length == 0)
+ {
+ Constructor<T> constructor = (Constructor<T>) Reflections.getConstructor(getType());
+ log.finest("No constructor defined, using implicit no arguement constructor for " + getType());
+ this.constructor = new SimpleConstructor<T>(constructor);
+ return;
+ }
+
+ throw new RuntimeException("Cannot determine constructor to use for " + getType());
+ }
+
+ public SimpleConstructor<T> getConstructor()
+ {
+ return constructor;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return "SimpleWebBean[" + getAnnotatedItem().toString() + "]";
+ }
+
+ @Override
+ public String getLocation()
+ {
+ if (location == null)
+ {
+ location = "type: Simple Bean; declaring class: " + getType() +";";
+ }
+ return location;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -11,7 +11,7 @@
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.bindings.AsynchronousAnnotationLiteral;
@@ -28,7 +28,7 @@
@Test @SpecAssertion(section={"2.3.3", "2.3.1"})
public void testDefaultBindingTypeDeclaredInJava()
{
- SimpleComponentModel<Order> order = createSimpleModel(Order.class, manager);
+ SimpleBeanModel<Order> order = createSimpleModel(Order.class, manager);
assert order.getBindingTypes().size() == 1;
order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -61,7 +61,7 @@
@Test @SpecAssertion(section="2.3.3")
public void testBindingTypesDeclaredInJava()
{
- SimpleComponentModel<Cat> cat = createSimpleModel(Cat.class, manager);
+ SimpleBeanModel<Cat> cat = createSimpleModel(Cat.class, manager);
assert cat.getBindingTypes().size() == 1;
assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
}
@@ -80,7 +80,7 @@
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
AnnotatedType annotatedItem = new SimpleAnnotatedType(Antelope.class, annotations);
- SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(getEmptyAnnotatedItem(Antelope.class), annotatedItem, manager);
+ SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(getEmptyAnnotatedItem(Antelope.class), annotatedItem, manager);
assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
}
@@ -92,7 +92,7 @@
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
AnnotatedType annotatedItem = new SimpleAnnotatedType(Cat.class, annotations);
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), annotatedItem, manager);
+ SimpleBeanModel<Cat> cat = new SimpleBeanModel<Cat>(new SimpleAnnotatedType(Cat.class), annotatedItem, manager);
assert cat.getBindingTypes().size() == 1;
assert Reflections.annotationSetMatches(cat.getBindingTypes(), Asynchronous.class);
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -6,7 +6,7 @@
import org.jboss.webbeans.injectable.SimpleConstructor;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.components.Chicken;
import org.jboss.webbeans.test.components.Donkey;
@@ -26,7 +26,7 @@
@Test
public void testImplicitConstructor()
{
- SimpleConstructor<Order> constructor = new SimpleComponentModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedItem(Order.class), manager).getConstructor();
+ SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedItem(Order.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
assert constructor.getParameters().size() == 0;
@@ -36,7 +36,7 @@
@Test
public void testSingleConstructor()
{
- SimpleConstructor<Donkey> constructor = new SimpleComponentModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedItem(Donkey.class), manager).getConstructor();
+ SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedItem(Donkey.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Donkey.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 1;
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
@@ -50,7 +50,7 @@
@Test
public void testInitializerAnnotatedConstructor()
{
- SimpleConstructor<Sheep> constructor = new SimpleComponentModel<Sheep>(new SimpleAnnotatedType<Sheep>(Sheep.class), getEmptyAnnotatedItem(Sheep.class), manager).getConstructor();
+ SimpleConstructor<Sheep> constructor = new SimpleBeanModel<Sheep>(new SimpleAnnotatedType<Sheep>(Sheep.class), getEmptyAnnotatedItem(Sheep.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Sheep.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
@@ -68,7 +68,7 @@
@Test
public void testBindingTypeAnnotatedConstructor()
{
- SimpleConstructor<Duck> constructor = new SimpleComponentModel<Duck>(new SimpleAnnotatedType<Duck>(Duck.class), getEmptyAnnotatedItem(Duck.class), manager).getConstructor();
+ SimpleConstructor<Duck> constructor = new SimpleBeanModel<Duck>(new SimpleAnnotatedType<Duck>(Duck.class), getEmptyAnnotatedItem(Duck.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Duck.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
@@ -88,7 +88,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedItem(Chicken.class), manager);
+ new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedItem(Chicken.class), manager);
}
catch (Exception e)
{
@@ -104,7 +104,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Turkey>(new SimpleAnnotatedType<Turkey>(Turkey.class), getEmptyAnnotatedItem(Turkey.class), manager);
+ new SimpleBeanModel<Turkey>(new SimpleAnnotatedType<Turkey>(Turkey.class), getEmptyAnnotatedItem(Turkey.class), manager);
}
catch (Exception e)
{
@@ -120,7 +120,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Goat>(new SimpleAnnotatedType<Goat>(Goat.class), getEmptyAnnotatedItem(Goat.class), manager);
+ new SimpleBeanModel<Goat>(new SimpleAnnotatedType<Goat>(Goat.class), getEmptyAnnotatedItem(Goat.class), manager);
}
catch (Exception e)
{
@@ -136,7 +136,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Goose>(new SimpleAnnotatedType<Goose>(Goose.class), getEmptyAnnotatedItem(Goose.class), manager);
+ new SimpleBeanModel<Goose>(new SimpleAnnotatedType<Goose>(Goose.class), getEmptyAnnotatedItem(Goose.class), manager);
}
catch (Exception e)
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -10,7 +10,7 @@
import org.jboss.webbeans.BasicContext;
import org.jboss.webbeans.BeanImpl;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.components.Tuna;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -34,13 +34,13 @@
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testGetWithCreateFalseReturnsNull() {
- Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
+ Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
assert context.get(tunaBean, false) == null;
}
@Test(groups="contexts") @SpecAssertion(section="8.1")
public void testGetWithCreateTrueReturnsBean() {
- Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
+ Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
assert context.get(tunaBean, true) != null;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -15,7 +15,7 @@
import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.bindings.AsynchronousAnnotationLiteral;
@@ -62,7 +62,7 @@
// invoked which in turn invokes the observer. Here the mock observer
// is used to keep track of the event being fired.
ManagerImpl manager;
- SimpleComponentModel<Tuna> tuna;
+ SimpleBeanModel<Tuna> tuna;
InjectableMethod<Object> om;
List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
enabledDeploymentTypes.add(Standard.class);
@@ -73,7 +73,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
AnnotatedType<Tuna> annotatedItem = new SimpleAnnotatedType<Tuna>(Tuna.class, annotations);
- tuna = new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
+ tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
om = new InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }));
AnObserver observerInstance = new AnObserver();
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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -11,8 +11,8 @@
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.AbstractEnterpriseComponentModel;
-import org.jboss.webbeans.model.EnterpriseComponentModel;
+import org.jboss.webbeans.model.bean.AbstractEnterpriseBeanModel;
+import org.jboss.webbeans.model.bean.EnterpriseBeanModel;
import org.jboss.webbeans.test.annotations.Synchronous;
import org.jboss.webbeans.test.components.Bear;
import org.jboss.webbeans.test.components.Cheetah;
@@ -40,7 +40,7 @@
@Test
public void testStateless()
{
- EnterpriseComponentModel<Lion> lion = new EnterpriseComponentModel<Lion>(new SimpleAnnotatedType<Lion>(Lion.class), getEmptyAnnotatedItem(Lion.class), manager);
+ EnterpriseBeanModel<Lion> lion = new EnterpriseBeanModel<Lion>(new SimpleAnnotatedType<Lion>(Lion.class), getEmptyAnnotatedItem(Lion.class), manager);
assert lion.getScopeType().equals(Dependent.class);
Reflections.annotationSetMatches(lion.getBindingTypes(), Current.class);
assert lion.getName().equals("lion");
@@ -53,7 +53,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
AnnotatedType annotatedItem = new SimpleAnnotatedType(Giraffe.class, annotations);
- EnterpriseComponentModel<Giraffe> giraffe = new EnterpriseComponentModel<Giraffe>(new SimpleAnnotatedType(Giraffe.class), annotatedItem, manager);
+ EnterpriseBeanModel<Giraffe> giraffe = new EnterpriseBeanModel<Giraffe>(new SimpleAnnotatedType(Giraffe.class), annotatedItem, manager);
assert giraffe.getScopeType().equals(Dependent.class);
Reflections.annotationSetMatches(giraffe.getBindingTypes(), Current.class);
}
@@ -64,7 +64,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Bear>(new SimpleAnnotatedType<Bear>(Bear.class), getEmptyAnnotatedItem(Bear.class), manager);
+ new EnterpriseBeanModel<Bear>(new SimpleAnnotatedType<Bear>(Bear.class), getEmptyAnnotatedItem(Bear.class), manager);
}
catch (Exception e)
{
@@ -94,7 +94,7 @@
public void testStateful()
{
- AbstractEnterpriseComponentModel<Tiger> tiger = new EnterpriseComponentModel<Tiger>(new SimpleAnnotatedType(Tiger.class), getEmptyAnnotatedItem(Tiger.class), manager);
+ AbstractEnterpriseBeanModel<Tiger> tiger = new EnterpriseBeanModel<Tiger>(new SimpleAnnotatedType(Tiger.class), getEmptyAnnotatedItem(Tiger.class), manager);
Reflections.annotationSetMatches(tiger.getBindingTypes(), Synchronous.class);
assert tiger.getRemoveMethod().getAnnotatedItem().getDelegate().getName().equals("remove");
assert tiger.getName() == null;
@@ -105,7 +105,7 @@
public void testMultipleRemoveMethodsWithDestroys()
{
- AbstractEnterpriseComponentModel<Elephant> elephant = new EnterpriseComponentModel<Elephant>(new SimpleAnnotatedType(Elephant.class), getEmptyAnnotatedItem(Elephant.class), manager);
+ AbstractEnterpriseBeanModel<Elephant> elephant = new EnterpriseBeanModel<Elephant>(new SimpleAnnotatedType(Elephant.class), getEmptyAnnotatedItem(Elephant.class), manager);
assert elephant.getRemoveMethod().getAnnotatedItem().getDelegate().getName().equals("remove2");
}
@@ -116,7 +116,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Puma>(new SimpleAnnotatedType(Puma.class), getEmptyAnnotatedItem(Puma.class), manager);
+ new EnterpriseBeanModel<Puma>(new SimpleAnnotatedType(Puma.class), getEmptyAnnotatedItem(Puma.class), manager);
}
catch (Exception e)
{
@@ -132,7 +132,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Cougar>(new SimpleAnnotatedType(Cougar.class), getEmptyAnnotatedItem(Cougar.class), manager);
+ new EnterpriseBeanModel<Cougar>(new SimpleAnnotatedType(Cougar.class), getEmptyAnnotatedItem(Cougar.class), manager);
}
catch (Exception e)
{
@@ -148,7 +148,7 @@
boolean exception = false;
try
{
- new EnterpriseComponentModel<Cheetah>(new SimpleAnnotatedType(Cheetah.class), getEmptyAnnotatedItem(Cheetah.class), manager);
+ new EnterpriseBeanModel<Cheetah>(new SimpleAnnotatedType(Cheetah.class), getEmptyAnnotatedItem(Cheetah.class), manager);
}
catch (Exception e)
{
@@ -162,7 +162,7 @@
public void testRemoveMethodWithDefaultBinding()
{
- AbstractEnterpriseComponentModel<Panther> panther = new EnterpriseComponentModel<Panther>(new SimpleAnnotatedType<Panther>(Panther.class), getEmptyAnnotatedItem(Panther.class), manager);
+ AbstractEnterpriseBeanModel<Panther> panther = new EnterpriseBeanModel<Panther>(new SimpleAnnotatedType<Panther>(Panther.class), getEmptyAnnotatedItem(Panther.class), manager);
assert panther.getRemoveMethod().getAnnotatedItem().getDelegate().getName().equals("remove");
assert panther.getRemoveMethod().getParameters().size() == 1;
@@ -175,7 +175,7 @@
@Test
public void testMessageDriven()
{
- AbstractEnterpriseComponentModel<Leopard> leopard = new EnterpriseComponentModel<Leopard>(new SimpleAnnotatedType(Leopard.class), getEmptyAnnotatedItem(Leopard.class), manager);
+ AbstractEnterpriseBeanModel<Leopard> leopard = new EnterpriseBeanModel<Leopard>(new SimpleAnnotatedType(Leopard.class), getEmptyAnnotatedItem(Leopard.class), manager);
Reflections.annotationSetMatches(leopard.getBindingTypes(), Current.class);
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -11,9 +11,9 @@
import javax.webbeans.Standard;
import org.jboss.webbeans.event.EventImpl;
-import org.jboss.webbeans.injectable.ComponentConstructor;
+import org.jboss.webbeans.injectable.BeanConstructor;
import org.jboss.webbeans.introspector.SimpleAnnotatedField;
-import org.jboss.webbeans.model.EventComponentModel;
+import org.jboss.webbeans.model.bean.EventBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.components.DangerCall;
import org.jboss.webbeans.test.mock.MockManagerImpl;
@@ -30,7 +30,7 @@
public class EventComponentModelTest
{
private MockManagerImpl manager = null;
- private EventComponentModel<EventImpl<DangerCall>> eventComponentModel = null;
+ private EventBeanModel<EventImpl<DangerCall>> eventBeanModel = null;
EventImpl<DangerCall> eventModelField = null;
@BeforeMethod
@@ -41,7 +41,7 @@
enabledDeploymentTypes.add(AnotherDeploymentType.class);
manager = new MockManagerImpl(enabledDeploymentTypes);
Field eventModelField = this.getClass().getDeclaredField("eventModelField");
- eventComponentModel = new EventComponentModel<EventImpl<DangerCall>>(
+ eventBeanModel = new EventBeanModel<EventImpl<DangerCall>>(
new SimpleAnnotatedField<EventImpl<DangerCall>>(eventModelField),
new SimpleAnnotatedField<EventImpl<DangerCall>>(eventModelField),
manager);
@@ -54,7 +54,7 @@
@Test(groups = "eventbus")
public void testName()
{
- assert eventComponentModel.getName() == null;
+ assert eventBeanModel.getName() == null;
}
/**
@@ -63,7 +63,7 @@
@Test(groups = "eventbus")
public void testScopeType()
{
- assert eventComponentModel.getScopeType().equals(Dependent.class);
+ assert eventBeanModel.getScopeType().equals(Dependent.class);
}
/**
@@ -72,13 +72,13 @@
@Test(groups = "eventbus")
public void testDeploymentType()
{
- assert eventComponentModel.getDeploymentType().equals(Standard.class);
+ assert eventBeanModel.getDeploymentType().equals(Standard.class);
}
@Test(groups = "eventbus")
public void testApiTypes()
{
- Set<Class<?>> apis = eventComponentModel.getApiTypes();
+ Set<Class<?>> apis = eventBeanModel.getApiTypes();
assert apis.size() >= 1;
for (Class<?> api : apis)
{
@@ -89,7 +89,7 @@
@Test(groups = "eventbus")
public void testConstructor()
{
- ComponentConstructor<EventImpl<DangerCall>> constructor = eventComponentModel.getConstructor();
+ BeanConstructor<EventImpl<DangerCall>> constructor = eventBeanModel.getConstructor();
assert constructor != null;
Event<DangerCall> event = constructor.invoke(manager);
assert event != null;
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -10,7 +10,7 @@
import org.jboss.webbeans.ResolutionManager;
import org.jboss.webbeans.injectable.InjectableField;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.components.Cod;
import org.jboss.webbeans.test.components.FishFarm;
import org.jboss.webbeans.test.components.Salmon;
@@ -25,9 +25,9 @@
public void testAmbiguousDependencies() throws Exception
{
InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
- Bean<Cod> plaiceBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<Cod> plaiceBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -42,8 +42,8 @@
public void testUnsatisfiedDependencies() throws Exception
{
InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
- Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
manager.addBean(codBean);
manager.addBean(salmonBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -13,7 +13,7 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.injectable.InjectableField;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.Whitefish;
import org.jboss.webbeans.test.components.Cod;
import org.jboss.webbeans.test.components.FishFarm;
@@ -32,9 +32,9 @@
public void testAmbiguousDependencies() throws Exception
{
InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
- Bean<Cod> plaiceBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<Cod> plaiceBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -49,9 +49,9 @@
public void testUnsatisfiedDependencies() throws Exception
{
InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
- Bean<Cod> plaiceBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<Cod> plaiceBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
manager.addBean(plaiceBean);
manager.addBean(salmonBean);
manager.addBean(soleBean);
@@ -66,7 +66,7 @@
public void testUnproxyableDependencies() throws Exception
{
InjectableField<Plaice> plaiceField = new InjectableField<Plaice>(PlaiceFarm.class.getDeclaredField("plaice"));
- Bean<Plaice> plaiceBean = new BeanImpl<Plaice>(new SimpleComponentModel<Plaice>(new SimpleAnnotatedType<Plaice>(Plaice.class), getEmptyAnnotatedItem(Plaice.class), super.manager), manager);
+ Bean<Plaice> plaiceBean = new BeanImpl<Plaice>(new SimpleBeanModel<Plaice>(new SimpleAnnotatedType<Plaice>(Plaice.class), getEmptyAnnotatedItem(Plaice.class), super.manager), manager);
manager.addBean(plaiceBean);
ResolutionManager resolutionManager = manager.getResolutionManager();
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameBasedResolutionTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -6,7 +6,7 @@
import org.jboss.webbeans.BeanImpl;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.components.Cod;
import org.jboss.webbeans.test.components.Haddock;
import org.jboss.webbeans.test.components.Plaice;
@@ -21,13 +21,13 @@
@Test
public void testNamedBasedResolution()
{
- Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
- Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
- Bean<SeaBass> seaBassBean = new BeanImpl<SeaBass>(new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), super.manager), manager);
- Bean<Haddock> haddockBean = new BeanImpl<Haddock>(new SimpleComponentModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), super.manager), manager);
- Bean<Plaice> plaiceBean = new BeanImpl<Plaice>(new SimpleComponentModel<Plaice>(new SimpleAnnotatedType<Plaice>(Plaice.class), getEmptyAnnotatedItem(Plaice.class), super.manager), manager);
+ Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
+ Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<SeaBass> seaBassBean = new BeanImpl<SeaBass>(new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), super.manager), manager);
+ Bean<Haddock> haddockBean = new BeanImpl<Haddock>(new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), super.manager), manager);
+ Bean<Plaice> plaiceBean = new BeanImpl<Plaice>(new SimpleBeanModel<Plaice>(new SimpleAnnotatedType<Plaice>(Plaice.class), getEmptyAnnotatedItem(Plaice.class), super.manager), manager);
manager.addBean(tunaBean);
manager.addBean(codBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -15,7 +15,7 @@
import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.bindings.AsynchronousAnnotationLiteral;
@@ -35,7 +35,7 @@
public class ObserverTest
{
private ManagerImpl manager;
- private SimpleComponentModel<Tuna> tuna;
+ private SimpleBeanModel<Tuna> tuna;
private InjectableMethod<?> om;
public class Event
@@ -66,7 +66,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
AnnotatedType<Tuna> annotatedItem = new SimpleAnnotatedType<Tuna>(Tuna.class, annotations);
- tuna = new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
+ tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
om = new InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }));
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -9,8 +9,8 @@
import org.jboss.webbeans.introspector.SimpleAnnotatedMethod;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.ProducerMethodComponentModel;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.ProducerMethodBeanModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.Tame;
import org.jboss.webbeans.test.components.Animal;
import org.jboss.webbeans.test.components.BlackWidow;
@@ -32,13 +32,13 @@
@Test @SpecAssertion(section="3.3")
public void testStaticMethod() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<ComponentWithStaticProducerMethod> componentModel = new SimpleComponentModel<ComponentWithStaticProducerMethod>(new SimpleAnnotatedType<ComponentWithStaticProducerMethod>(ComponentWithStaticProducerMethod.class), getEmptyAnnotatedItem(ComponentWithStaticProducerMethod.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<ComponentWithStaticProducerMethod> componentModel = new SimpleBeanModel<ComponentWithStaticProducerMethod>(new SimpleAnnotatedType<ComponentWithStaticProducerMethod>(ComponentWithStaticProducerMethod.class), getEmptyAnnotatedItem(ComponentWithStaticProducerMethod.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = ComponentWithStaticProducerMethod.class.getMethod("getString");
boolean exception = false;
try
{
- new ProducerMethodComponentModel<String>(new SimpleAnnotatedMethod<String>(method), manager);
+ new ProducerMethodBeanModel<String>(new SimpleAnnotatedMethod<String>(method), manager);
}
catch (Exception e)
{
@@ -50,10 +50,10 @@
@Test @SpecAssertion(section="3.3")
public void testApiTypes() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodComponentModel<Tarantula> tarantulaModel = new ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
+ ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
assert tarantulaModel.getApiTypes().contains(Tarantula.class);
assert tarantulaModel.getApiTypes().contains(DeadlySpider.class);
assert tarantulaModel.getApiTypes().contains(Spider.class);
@@ -65,10 +65,10 @@
@Test @SpecAssertion(section="3.3.1")
public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodComponentModel<Tarantula> tarantulaModel = new ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
+ ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
}
@@ -76,10 +76,10 @@
@Test
public void testBindingType() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- ProducerMethodComponentModel<Tarantula> tarantulaModel = new ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
+ ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
assert tarantulaModel.getBindingTypes().size() == 1;
assert tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
}
@@ -87,13 +87,13 @@
@Test @SpecAssertion(section="3.3")
public void testFinalMethod() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<ComponentWithFinalProducerMethod> componentModel = new SimpleComponentModel<ComponentWithFinalProducerMethod>(new SimpleAnnotatedType<ComponentWithFinalProducerMethod>(ComponentWithFinalProducerMethod.class), getEmptyAnnotatedItem(ComponentWithFinalProducerMethod.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<ComponentWithFinalProducerMethod> componentModel = new SimpleBeanModel<ComponentWithFinalProducerMethod>(new SimpleAnnotatedType<ComponentWithFinalProducerMethod>(ComponentWithFinalProducerMethod.class), getEmptyAnnotatedItem(ComponentWithFinalProducerMethod.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = ComponentWithFinalProducerMethod.class.getMethod("getString");
boolean exception = false;
try
{
- new ProducerMethodComponentModel<String>(new SimpleAnnotatedMethod<String>(method), manager);
+ new ProducerMethodBeanModel<String>(new SimpleAnnotatedMethod<String>(method), manager);
}
catch (Exception e)
{
@@ -105,40 +105,40 @@
@Test @SpecAssertion(section="3.3")
public void testFinalMethodWithDependentScope() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("produceTrapdoorSpider");
- ProducerMethodComponentModel<TrapdoorSpider> trapdoorSpiderModel = new ProducerMethodComponentModel<TrapdoorSpider>(new SimpleAnnotatedMethod<TrapdoorSpider>(method), manager);
+ ProducerMethodBeanModel<TrapdoorSpider> trapdoorSpiderModel = new ProducerMethodBeanModel<TrapdoorSpider>(new SimpleAnnotatedMethod<TrapdoorSpider>(method), manager);
assert trapdoorSpiderModel.getScopeType().equals(Dependent.class);
}
@Test @SpecAssertion(section="3.3.6")
public void testNamedMethod() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodComponentModel<BlackWidow> blackWidowSpiderModel = new ProducerMethodComponentModel<BlackWidow>(new SimpleAnnotatedMethod<BlackWidow>(method), manager);
+ ProducerMethodBeanModel<BlackWidow> blackWidowSpiderModel = new ProducerMethodBeanModel<BlackWidow>(new SimpleAnnotatedMethod<BlackWidow>(method), manager);
assert blackWidowSpiderModel.getName().equals("blackWidow");
}
@Test @SpecAssertion(section="3.3.6")
public void testDefaultNamedMethod() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- ProducerMethodComponentModel<DaddyLongLegs> daddyLongLegsSpiderModel = new ProducerMethodComponentModel<DaddyLongLegs>(new SimpleAnnotatedMethod<DaddyLongLegs>(method), manager);
+ ProducerMethodBeanModel<DaddyLongLegs> daddyLongLegsSpiderModel = new ProducerMethodBeanModel<DaddyLongLegs>(new SimpleAnnotatedMethod<DaddyLongLegs>(method), manager);
assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
}
@Test @SpecAssertion(section="3.3.6")
public void testDefaultNamedJavaBeanMethod() throws SecurityException, NoSuchMethodException
{
- SimpleComponentModel<SpiderProducer> componentModel = new SimpleComponentModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
- manager.getModelManager().addComponentModel(componentModel);
+ SimpleBeanModel<SpiderProducer> componentModel = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedItem(SpiderProducer.class), manager);
+ manager.getModelManager().addBeanModel(componentModel);
Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
- ProducerMethodComponentModel<LadybirdSpider> ladybirdSpiderModel = new ProducerMethodComponentModel<LadybirdSpider>(new SimpleAnnotatedMethod<LadybirdSpider>(method), manager);
+ ProducerMethodBeanModel<LadybirdSpider> ladybirdSpiderModel = new ProducerMethodBeanModel<LadybirdSpider>(new SimpleAnnotatedMethod<LadybirdSpider>(method), manager);
assert ladybirdSpiderModel.getName().equals("ladybirdSpider");
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -15,7 +15,7 @@
import org.jboss.webbeans.bindings.RequestScopedAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.annotations.FishStereotype;
import org.jboss.webbeans.test.annotations.RiverFishStereotype;
@@ -59,7 +59,7 @@
@Test @SpecAssertion(section="2.4.3")
public void testScopeDeclaredInJava()
{
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -69,7 +69,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new SimpleAnnotatedType<ComponentWithTooManyScopeTypes>(ComponentWithTooManyScopeTypes.class), getEmptyAnnotatedItem(ComponentWithTooManyScopeTypes.class), manager);
+ new SimpleBeanModel<ComponentWithTooManyScopeTypes>(new SimpleAnnotatedType<ComponentWithTooManyScopeTypes>(ComponentWithTooManyScopeTypes.class), getEmptyAnnotatedItem(ComponentWithTooManyScopeTypes.class), manager);
}
catch (Exception e)
{
@@ -88,7 +88,7 @@
annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
AnnotatedType<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedType<Antelope>(Antelope.class, annotations);
- new SimpleComponentModel<Antelope>(getEmptyAnnotatedItem(Antelope.class), antelopeAnnotatedItem, manager);
+ new SimpleBeanModel<Antelope>(getEmptyAnnotatedItem(Antelope.class), antelopeAnnotatedItem, manager);
}
catch (Exception e)
{
@@ -104,7 +104,7 @@
annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
AnnotatedType<Order> annotatedItem = new SimpleAnnotatedType<Order>(Order.class, annotations);
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType<Order>(Order.class), annotatedItem, manager);
+ SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), annotatedItem, manager);
assert order.getScopeType().equals(RequestScoped.class);
}
@@ -114,7 +114,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -124,14 +124,14 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(ConversationScoped.class);
}
@Test @SpecAssertion(section="2.4.5")
public void testDefaultScope()
{
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedItem(Order.class), manager);
+ SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedItem(Order.class), manager);
assert order.getScopeType().equals(Dependent.class);
}
@@ -141,7 +141,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -156,7 +156,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), annotatedItem, manager);
+ new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), annotatedItem, manager);
}
catch (Exception e)
{
@@ -173,7 +173,7 @@
annotations.put(AnimalStereotype.class, new AnimalStereotypeAnnotationLiteral());
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -185,7 +185,7 @@
annotations.put(RiverFishStereotype.class, new RiverFishStereotypeAnnotationLiteral());
AnnotatedType<Haddock> annotatedItem = new SimpleAnnotatedType<Haddock>(Haddock.class, annotations);
- SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), annotatedItem, manager);
+ SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), annotatedItem, manager);
assert haddock.getScopeType().equals(ApplicationScoped.class);
}
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-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -17,7 +17,7 @@
import org.jboss.webbeans.bindings.DependentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.FishStereotype;
import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
@@ -59,7 +59,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType<ComponentWithTooManyDeploymentTypes>(ComponentWithTooManyDeploymentTypes.class), getEmptyAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), manager);
+ new SimpleBeanModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType<ComponentWithTooManyDeploymentTypes>(ComponentWithTooManyDeploymentTypes.class), getEmptyAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), manager);
}
catch (Exception e)
{
@@ -75,7 +75,7 @@
xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
AnnotatedType<ComponentWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedType<ComponentWithTooManyDeploymentTypes>(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
- SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType<ComponentWithTooManyDeploymentTypes>(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, manager);
+ SimpleBeanModel<ComponentWithTooManyDeploymentTypes> component = new SimpleBeanModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType<ComponentWithTooManyDeploymentTypes>(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, manager);
assert component.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -83,7 +83,7 @@
public void testXmlDefaultDeploymentType()
{
AnnotatedType<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedType<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
- SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(getEmptyAnnotatedItem(Antelope.class), antelopeAnnotatedItem, manager);
+ SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(getEmptyAnnotatedItem(Antelope.class), antelopeAnnotatedItem, manager);
assert antelope.getDeploymentType().equals(Production.class);
}
@@ -91,7 +91,7 @@
public void testXmlRespectsJavaDeploymentType()
{
AnnotatedType<Tuna> annotatedItem = new SimpleAnnotatedType<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
- SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
+ SimpleBeanModel<Tuna> tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -102,7 +102,7 @@
annotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
AnnotatedType<Moose> annotatedItem = new SimpleAnnotatedType<Moose>(Moose.class, annotations);
- SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType<Moose>(Moose.class), annotatedItem, manager);
+ SimpleBeanModel<Moose> moose = new SimpleBeanModel<Moose>(new SimpleAnnotatedType<Moose>(Moose.class), annotatedItem, manager);
assert moose.getDeploymentType().equals(HornedAnimalDeploymentType.class);
}
@@ -113,7 +113,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -126,7 +126,7 @@
@Test @SpecAssertion(section="2.6.1")
public void testDefaultNamed()
{
- SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), manager);
+ SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
@@ -144,7 +144,7 @@
});
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getName() != null;
assert trout.getName().equals("seaBass");
@@ -163,7 +163,7 @@
});
AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getName().equals("aTrout");
}
@@ -171,14 +171,14 @@
@Test @SpecAssertion(section="2.6.4")
public void testNotNamed()
{
- SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), manager);
assert trout.getName() == null;
}
@Test @SpecAssertion(section="2.6.1")
public void testNonDefaultNamed()
{
- SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType<Moose>(Moose.class), getEmptyAnnotatedItem(Moose.class), manager);
+ SimpleBeanModel<Moose> moose = new SimpleBeanModel<Moose>(new SimpleAnnotatedType<Moose>(Moose.class), getEmptyAnnotatedItem(Moose.class), manager);
assert moose.getName().equals("aMoose");
}
@@ -202,7 +202,7 @@
});
AnnotatedType currentSynchronousOrderAnnotatedItem = new SimpleAnnotatedType(Order.class, orderXmlAnnotations);
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), currentSynchronousOrderAnnotatedItem, manager);
+ SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedType(Order.class), currentSynchronousOrderAnnotatedItem, manager);
assert Production.class.equals(order.getDeploymentType());
assert "currentSynchronousOrder".equals(order.getName());
assert order.getBindingTypes().size() == 2;
@@ -213,7 +213,7 @@
@Test @SpecAssertion(section="2.7.2")
public void testSingleStereotype()
{
- SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType<Gorilla>(Gorilla.class), getEmptyAnnotatedItem(Gorilla.class), manager);
+ SimpleBeanModel<Gorilla> gorilla = new SimpleBeanModel<Gorilla>(new SimpleAnnotatedType<Gorilla>(Gorilla.class), getEmptyAnnotatedItem(Gorilla.class), manager);
assert gorilla.getName() == null;
assert gorilla.getDeploymentType().equals(Production.class);
assert gorilla.getBindingTypes().iterator().next().annotationType().equals(Current.class);
@@ -225,7 +225,7 @@
{
try
{
- new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType<Gorilla>(Gorilla.class), getEmptyAnnotatedItem(Gorilla.class), manager);
+ new SimpleBeanModel<Gorilla>(new SimpleAnnotatedType<Gorilla>(Gorilla.class), getEmptyAnnotatedItem(Gorilla.class), manager);
}
catch (Exception e)
{
@@ -237,7 +237,7 @@
@Test(expectedExceptions=Exception.class) @SpecAssertion(section="2.7.4")
public void testRequiredTypeIsNotImplemented()
{
- new SimpleComponentModel<Chair>(new SimpleAnnotatedType<Chair>(Chair.class), getEmptyAnnotatedItem(Chair.class), manager);
+ new SimpleBeanModel<Chair>(new SimpleAnnotatedType<Chair>(Chair.class), getEmptyAnnotatedItem(Chair.class), manager);
}
@Test @SpecAssertion(section="2.7.4")
@@ -245,7 +245,7 @@
{
try
{
- new SimpleComponentModel<Goldfish>(new SimpleAnnotatedType<Goldfish>(Goldfish.class), getEmptyAnnotatedItem(Goldfish.class), manager);
+ new SimpleBeanModel<Goldfish>(new SimpleAnnotatedType<Goldfish>(Goldfish.class), getEmptyAnnotatedItem(Goldfish.class), manager);
}
catch (Exception e)
{
@@ -257,7 +257,7 @@
@Test(expectedExceptions=Exception.class) @SpecAssertion(section="2.7.4")
public void testScopeIsNotSupported()
{
- new SimpleComponentModel<Carp>(new SimpleAnnotatedType<Carp>(Carp.class), getEmptyAnnotatedItem(Carp.class), manager);
+ new SimpleBeanModel<Carp>(new SimpleAnnotatedType<Carp>(Carp.class), getEmptyAnnotatedItem(Carp.class), manager);
}
@Test @SpecAssertion(section="2.7.2")
@@ -274,7 +274,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Cow>(new SimpleAnnotatedType<Cow>(Cow.class), getEmptyAnnotatedItem(Cow.class), manager);
+ new SimpleBeanModel<Cow>(new SimpleAnnotatedType<Cow>(Cow.class), getEmptyAnnotatedItem(Cow.class), manager);
}
catch (Exception e)
{
@@ -289,7 +289,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<InnerComponent>(new SimpleAnnotatedType<InnerComponent>(InnerComponent.class), getEmptyAnnotatedItem(InnerComponent.class), manager);
+ new SimpleBeanModel<InnerComponent>(new SimpleAnnotatedType<InnerComponent>(InnerComponent.class), getEmptyAnnotatedItem(InnerComponent.class), manager);
}
catch (Exception e)
{
@@ -304,7 +304,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Horse>(new SimpleAnnotatedType<Horse>(Horse.class), getEmptyAnnotatedItem(Horse.class), manager);
+ new SimpleBeanModel<Horse>(new SimpleAnnotatedType<Horse>(Horse.class), getEmptyAnnotatedItem(Horse.class), manager);
}
catch (Exception e)
{
@@ -317,7 +317,7 @@
AnnotatedType<Horse> annotatedItem = new SimpleAnnotatedType<Horse>(Horse.class, annotations);
try
{
- new SimpleComponentModel<Horse>(new SimpleAnnotatedType<Horse>(Horse.class), annotatedItem, manager);
+ new SimpleBeanModel<Horse>(new SimpleAnnotatedType<Horse>(Horse.class), annotatedItem, manager);
}
catch (Exception e)
{
@@ -331,7 +331,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Pig>(new SimpleAnnotatedType<Pig>(Pig.class), getEmptyAnnotatedItem(Pig.class), manager);
+ new SimpleBeanModel<Pig>(new SimpleAnnotatedType<Pig>(Pig.class), getEmptyAnnotatedItem(Pig.class), manager);
}
catch (Exception e)
{
@@ -344,7 +344,7 @@
AnnotatedType<Pig> annotatedItem = new SimpleAnnotatedType<Pig>(Pig.class, annotations);
try
{
- new SimpleComponentModel<Pig>(new SimpleAnnotatedType<Pig>(Pig.class), annotatedItem, manager);
+ new SimpleBeanModel<Pig>(new SimpleAnnotatedType<Pig>(Pig.class), annotatedItem, manager);
}
catch (Exception e)
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -49,7 +49,7 @@
assert animalStereotype.getRequiredTypes().size() == 1;
assert animalStereotype.getRequiredTypes().contains(Animal.class);
assert animalStereotype.getSupportedScopes().size() == 0;
- assert !animalStereotype.isComponentNameDefaulted();
+ assert !animalStereotype.isBeanNameDefaulted();
assert animalStereotype.getDefaultDeploymentType() == null;
}
@@ -63,7 +63,7 @@
Class<?> [] requiredTypes = {Animal.class, Order.class};
assert animalStereotype.getRequiredTypes().containsAll(Arrays.asList(requiredTypes));
assert animalStereotype.getSupportedScopes().size() == 0;
- assert !animalStereotype.isComponentNameDefaulted();
+ assert !animalStereotype.isBeanNameDefaulted();
assert animalStereotype.getDefaultDeploymentType() == null;
}
@@ -77,7 +77,7 @@
assert Animal.class.equals(animalStereotype.getRequiredTypes().iterator().next());
assert animalStereotype.getSupportedScopes().size() == 1;
assert animalStereotype.getSupportedScopes().contains(RequestScoped.class);
- assert !animalStereotype.isComponentNameDefaulted();
+ assert !animalStereotype.isBeanNameDefaulted();
assert animalStereotype.getDefaultDeploymentType() == null;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeSafeResolutionTest.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -15,7 +15,7 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.injectable.InjectableField;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.Whitefish;
import org.jboss.webbeans.test.bindings.ChunkyAnnotationLiteral;
import org.jboss.webbeans.test.components.Animal;
@@ -51,7 +51,7 @@
public void testSingleApiTypeWithCurrent() throws Exception
{
InjectableField<Tuna> tunaField = new InjectableField<Tuna>(FishFarm.class.getDeclaredField("tuna"));
- Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
+ Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
Set<Bean<?>> beans = new HashSet<Bean<?>>();
beans.add(tunaBean);
Set<Bean<?>> possibleTargets = tunaField.getMatchingBeans(beans);
@@ -63,9 +63,9 @@
public void testOneBindingType() throws Exception
{
InjectableField<ScottishFish> whiteScottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
- Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
Set<Bean<?>> beans = new HashSet<Bean<?>>();
beans.add(codBean);
beans.add(salmonBean);
@@ -80,9 +80,9 @@
public void testABindingType() throws Exception
{
InjectableField<Animal> whiteChunkyFishField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"));
- Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
Set<Bean<?>> beans = new HashSet<Bean<?>>();
beans.add(codBean);
beans.add(salmonBean);
@@ -96,8 +96,8 @@
public void testMultipleApiTypeWithCurrent() throws Exception
{
InjectableField<Animal> animalField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("animal"));
- Bean<SeaBass> seaBassBean = new BeanImpl<SeaBass>(new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), super.manager), manager);
- Bean<Haddock> haddockBean = new BeanImpl<Haddock>(new SimpleComponentModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), super.manager), manager);
+ Bean<SeaBass> seaBassBean = new BeanImpl<SeaBass>(new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), super.manager), manager);
+ Bean<Haddock> haddockBean = new BeanImpl<Haddock>(new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), super.manager), manager);
Set<Bean<?>> beans = new HashSet<Bean<?>>();
beans.add(seaBassBean);
beans.add(haddockBean);
@@ -115,12 +115,12 @@
InjectableField<ScottishFish> scottishFishField = new InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
InjectableField<Tuna> tunaField = new InjectableField<Tuna>(FishFarm.class.getDeclaredField("tuna"));
- Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleComponentModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
- Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleComponentModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
- Bean<SeaBass> seaBassBean = new BeanImpl<SeaBass>(new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), super.manager), manager);
- Bean<Haddock> haddockBean = new BeanImpl<Haddock>(new SimpleComponentModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), super.manager), manager);
+ Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
+ Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class), getEmptyAnnotatedItem(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<SeaBass> seaBassBean = new BeanImpl<SeaBass>(new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedItem(SeaBass.class), super.manager), manager);
+ Bean<Haddock> haddockBean = new BeanImpl<Haddock>(new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedItem(Haddock.class), super.manager), manager);
manager.addBean(tunaBean);
manager.addBean(codBean);
@@ -174,8 +174,8 @@
{
InjectableField<Farmer<ScottishFish>> scottishFishFarmerField = new InjectableField<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"));
- Bean<ScottishFishFarmer> scottishFishFarmerBean = new BeanImpl<ScottishFishFarmer>(new SimpleComponentModel<ScottishFishFarmer>(new SimpleAnnotatedType<ScottishFishFarmer>(ScottishFishFarmer.class), getEmptyAnnotatedItem(ScottishFishFarmer.class), super.manager), manager);
- Bean<Farmer> farmerBean = new BeanImpl<Farmer>(new SimpleComponentModel<Farmer>(new SimpleAnnotatedType<Farmer>(Farmer.class), getEmptyAnnotatedItem(Farmer.class), super.manager), manager);
+ Bean<ScottishFishFarmer> scottishFishFarmerBean = new BeanImpl<ScottishFishFarmer>(new SimpleBeanModel<ScottishFishFarmer>(new SimpleAnnotatedType<ScottishFishFarmer>(ScottishFishFarmer.class), getEmptyAnnotatedItem(ScottishFishFarmer.class), super.manager), manager);
+ Bean<Farmer> farmerBean = new BeanImpl<Farmer>(new SimpleBeanModel<Farmer>(new SimpleAnnotatedType<Farmer>(Farmer.class), getEmptyAnnotatedItem(Farmer.class), super.manager), manager);
manager.addBean(scottishFishFarmerBean);
manager.addBean(farmerBean);
@@ -192,9 +192,9 @@
{
InjectableField<Animal> whiteFishField = new InjectableField<Animal>(FishFarm.class.getDeclaredField("whiteFish"));
- Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleComponentModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
- Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleComponentModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
- Bean<Plaice> plaiceBean = new BeanImpl<Plaice>(new SimpleComponentModel<Plaice>(new SimpleAnnotatedType<Plaice>(Plaice.class), getEmptyAnnotatedItem(Plaice.class), super.manager), manager);
+ Bean<Cod> codBean = new BeanImpl<Cod>(new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), getEmptyAnnotatedItem(Cod.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class), getEmptyAnnotatedItem(Sole.class), super.manager), manager);
+ Bean<Plaice> plaiceBean = new BeanImpl<Plaice>(new SimpleBeanModel<Plaice>(new SimpleAnnotatedType<Plaice>(Plaice.class), getEmptyAnnotatedItem(Plaice.class), super.manager), manager);
manager.addBean(plaiceBean);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -4,7 +4,7 @@
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.model.AbstractComponentModel;
+import org.jboss.webbeans.model.bean.BeanModel;
/**
* An implementation used for unit testing only.
@@ -17,7 +17,7 @@
- public MockObserverImpl(AbstractComponentModel<?, ?> componentModel,
+ public MockObserverImpl(BeanModel<?, ?> componentModel,
InjectableMethod<?> observer, Class<T> eventType)
{
super(componentModel, observer, eventType);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java 2008-10-25 18:49:56 UTC (rev 149)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java 2008-10-25 19:12:52 UTC (rev 150)
@@ -7,7 +7,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.bean.SimpleBeanModel;
public class Util
@@ -17,9 +17,9 @@
return new BeanImpl<T>(createSimpleModel(clazz, manager), manager);
}
- public static <T> SimpleComponentModel<T> createSimpleModel(Class<T> clazz, ManagerImpl manager)
+ public static <T> SimpleBeanModel<T> createSimpleModel(Class<T> clazz, ManagerImpl manager)
{
- return new SimpleComponentModel<T>(new SimpleAnnotatedType<T>(clazz), getEmptyAnnotatedItem(clazz), manager);
+ return new SimpleBeanModel<T>(new SimpleAnnotatedType<T>(clazz), getEmptyAnnotatedItem(clazz), manager);
}
public static <T> AnnotatedType<T> getEmptyAnnotatedItem(Class<T> type)
More information about the weld-commits
mailing list